Change in vdsm[master]: tests: add vdscli.cannonizeHostPort unit tests
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: tests: add vdscli.cannonizeHostPort unit tests
......................................................................
tests: add vdscli.cannonizeHostPort unit tests
This patch adds tests to cannonizeHostPort as is.
Future patches will address the FIXMEs and the
quirks of the function, bulding on the safety
added by these test.
Change-Id: I26ff1ccb6b258c7adf7014fb9bc8c09cb3f32f1a
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/vdsClientTests.py
1 file changed, 70 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/35270/1
diff --git a/tests/vdsClientTests.py b/tests/vdsClientTests.py
index 1840cfc..aee4fa7 100644
--- a/tests/vdsClientTests.py
+++ b/tests/vdsClientTests.py
@@ -26,6 +26,7 @@
from testlib import VdsmTestCase as TestCaseBase
from monkeypatch import MonkeyPatch
+from vdsm import vdscli
import vdsClient
@@ -518,6 +519,75 @@
'key3': 'val3'})
+class CannonizeHostPortTest(TestCaseBase):
+ def _assertValidPort(self, port_str):
+ try:
+ port = int(port_str)
+ except ValueError:
+ raise AssertionError('malformed port: %s' % port_str)
+ if port <= 0 or port >= 2**16:
+ raise AssertionError('malformed port: %s' % port_str)
+
+ def assertIsIpAddressWithPort(self, addrWithPort):
+ try:
+ addr, port = addrWithPort.split(':')
+ except ValueError:
+ raise AssertionError('%s is not a valid IP address:' %
+ addrWithPort)
+ # assertGreater is nicer, but is in python >= 2.7
+ self.assertTrue(len(addr) > 0)
+ # TODO: validate well formed ipv4 or v6
+ self._assertValidPort(port)
+
+ def testNoArguments(self):
+ self.assertIsIpAddressWithPort(vdscli.cannonizeHostPort())
+
+ def testNoneArgument(self):
+ self.assertIsIpAddressWithPort(vdscli.cannonizeHostPort(None))
+
+ def testNoneArgumentAndPort(self):
+ port = '65432'
+ res = vdscli.cannonizeHostPort(None, port)
+ self.assertIsIpAddressWithPort(res)
+ # address must include the given port
+ self.assertTrue(res.endswith(port))
+
+ def testEmptyAddress(self):
+ # FIXME: fix cannonizeHostPort to handle this error or to
+ # raise a more meaningful error
+ self.assertRaises(AttributeError,
+ vdscli.cannonizeHostPort,
+ '')
+
+ def testAddressNoPort(self):
+ self.assertIsIpAddressWithPort(
+ vdscli.cannonizeHostPort('127.0.0.1'))
+
+ def testAddressWithPort(self):
+ port = 65432
+ res = vdscli.cannonizeHostPort('127.0.0.1:%i' % port)
+ self.assertIsIpAddressWithPort(res)
+ # address must include the given port
+ self.assertTrue(res.endswith(str(port)))
+
+ def testAddressWithPortParameter(self):
+ # TODO: fix cannonizeHostPort to require port as int
+ addr = '127.0.0.1'
+ port = '65432'
+ res = vdscli.cannonizeHostPort(addr, port)
+ self.assertIsIpAddressWithPort(res)
+ # address must include the given port
+ self.assertTrue(res.endswith(port))
+
+ def testAddressWithBadPortParameter(self):
+ # TODO: fix cannonizeHostPort to require port as int
+ addr = '127.0.0.1'
+ port = 65432
+ self.assertRaises(TypeError,
+ vdscli.cannonizeHostPort,
+ addr, port)
+
+
class FakeExit():
def exit(self, code):
pass
--
To view, visit http://gerrit.ovirt.org/35270
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I26ff1ccb6b258c7adf7014fb9bc8c09cb3f32f1a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: xmlrpc: remove useless 'serverPort' attribute
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: xmlrpc: remove useless 'serverPort' attribute
......................................................................
xmlrpc: remove useless 'serverPort' attribute
The BindingXMLRPC class used to have one
'serverPort' attribute, which was used only on the migration
path.
Since commit 3be9ad1f278 was merged some time ago, this
attribute is unused and could be removed.
This patch does that.
Change-Id: I120754b2c934da3393e5ea4323225c14e25b2087
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/jsonRpcHelper.py
M vdsm/clientIF.py
M vdsm/rpc/BindingXMLRPC.py
3 files changed, 5 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/35271/1
diff --git a/tests/jsonRpcHelper.py b/tests/jsonRpcHelper.py
index 066eaeb..5ab8abe 100644
--- a/tests/jsonRpcHelper.py
+++ b/tests/jsonRpcHelper.py
@@ -64,8 +64,7 @@
acceptor = MultiProtocolAcceptor("127.0.0.1", 0, sslctx)
cif = FakeClientIf()
- _, port = acceptor._socket.getsockname()
- xml_binding = BindingXMLRPC(cif, cif.log, port)
+ xml_binding = BindingXMLRPC(cif, cif.log)
xml_binding.start()
xmlDetector = XmlDetector(xml_binding)
acceptor.add_detector(xmlDetector)
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index b7a7ef8..a17fd20 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -106,7 +106,7 @@
host = config.get('addresses', 'management_ip')
port = config.get('addresses', 'management_port')
self._createAcceptor(host, port)
- self._prepareXMLRPCBinding(port)
+ self._prepareXMLRPCBinding()
self._prepareJSONRPCBinding()
except:
self.log.error('failed to init clientIF, '
@@ -171,7 +171,7 @@
protocol=protocol)
return sslctx
- def _prepareXMLRPCBinding(self, port):
+ def _prepareXMLRPCBinding(self):
if config.getboolean('vars', 'xmlrpc_enable'):
try:
from rpc.BindingXMLRPC import BindingXMLRPC
@@ -180,7 +180,7 @@
self.log.error('Unable to load the xmlrpc server module. '
'Please make sure it is installed.')
else:
- xml_binding = BindingXMLRPC(self, self.log, port)
+ xml_binding = BindingXMLRPC(self, self.log)
self.bindings['xmlrpc'] = xml_binding
xml_detector = XmlDetector(xml_binding)
self._acceptor.add_detector(xml_detector)
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py
index 0164691..ec223e8 100644
--- a/vdsm/rpc/BindingXMLRPC.py
+++ b/vdsm/rpc/BindingXMLRPC.py
@@ -43,10 +43,9 @@
class BindingXMLRPC(object):
- def __init__(self, cif, log, port):
+ def __init__(self, cif, log):
self.cif = cif
self.log = log
- self.serverPort = port
self._enabled = False
self.server = self._createXMLRPCServer()
--
To view, visit http://gerrit.ovirt.org/35271
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I120754b2c934da3393e5ea4323225c14e25b2087
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: vm: split slow disk access from normalization
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: split slow disk access from normalization
......................................................................
vm: split slow disk access from normalization
split utp potentially slow disk access from fast
disk normalization.
Change-Id: I6d8cb7a3c58e37540e56f4359aa67ea4dce875cc
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 19 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/34752/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9740ab3..05b15e9 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1337,6 +1337,10 @@
if 'device' not in drv:
drv['device'] = 'disk'
+ drv['truesize'] = 0
+ drv['apparentsize'] = 0
+
+ def _getVdsmImgSizes(self, drv):
if drv['device'] == 'disk':
res = self.cif.irs.getVolumeSize(drv['domainID'], drv['poolID'],
drv['imageID'], drv['volumeID'])
@@ -1348,9 +1352,6 @@
# if a key is missing here, is hsm bug and we cannot handle it.
drv['truesize'] = res['truesize']
drv['apparentsize'] = res['apparentsize']
- else:
- drv['truesize'] = 0
- drv['apparentsize'] = 0
def __legacyDrives(self):
"""
@@ -1419,14 +1420,7 @@
# Normalize vdsm images
for drv in devices[DISK_DEVICES]:
if isVdsmImage(drv):
- try:
- self._normalizeVdsmImg(drv)
- except StorageUnavailableError:
- # storage unavailable is not fatal on recovery;
- # the storage subsystem monitors the devices
- # and will notify when they come up later.
- if not self.recovering:
- raise
+ self._normalizeVdsmImg(drv)
self.normalizeDrivesIndices(devices[DISK_DEVICES])
@@ -1435,6 +1429,18 @@
self._normalizeBalloonDevice(devices[BALLOON_DEVICES])
return devices
+
+ def _updateDiskSizes(self, drives):
+ for drv in drives:
+ if isVdsmImage(drv):
+ try:
+ self._getVdsmImgSizes(drv)
+ except StorageUnavailableError:
+ # storage unavailable is not fatal on recovery;
+ # the storage subsystem monitors the devices
+ # and will notify when they come up later.
+ if not self.recovering:
+ raise
def _normalizeBalloonDevice(self, balloonDevices):
EMPTY_BALLOON = {'type': BALLOON_DEVICES,
@@ -2640,6 +2646,7 @@
def _run(self):
self.log.info("VM wrapper has started")
devices = self.buildConfDevices()
+ self._updateDiskSizes(devices[DISK_DEVICES])
# recovery flow note:
# we do not start disk stats collection here since
@@ -3330,6 +3337,7 @@
if isVdsmImage(diskParams):
self._normalizeVdsmImg(diskParams)
+ self._getVdsmImgSizes(diskParams)
self._createTransientDisk(diskParams)
self.updateDriveIndex(diskParams)
--
To view, visit http://gerrit.ovirt.org/34752
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d8cb7a3c58e37540e56f4359aa67ea4dce875cc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 5 months
Change in vdsm[ovirt-3.5]: Restore the default value of rhev_build in the spec file
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: Restore the default value of rhev_build in the spec file
......................................................................
Restore the default value of rhev_build in the spec file
Change-Id: I8deca956e80bcacad1e6446975fe916d9247abdd
Signed-off-by: Martin Sivak <mars(a)montik.net>
Reviewed-on: http://gerrit.ovirt.org/35794
Tested-by: Martin Sivák <msivak(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/35859/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 5becd4a..57c8bc1 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -15,6 +15,9 @@
# Fedora official build
%global fedora_koji_build 0
+# RHEV build - overridable using rpmbuild --define "rhev_build 1"
+%{!?rhev_build: %global rhev_build 0}
+
# Default to skipping autoreconf. Distros can change just this one line
# (or provide a command-line override) if they backport any patches that
# touch configure.ac or Makefile.am.
--
To view, visit http://gerrit.ovirt.org/35859
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8deca956e80bcacad1e6446975fe916d9247abdd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
9 years, 5 months
Change in vdsm[ovirt-3.5]: Add the missing --enable-rhev definition to configure.ac
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: Add the missing --enable-rhev definition to configure.ac
......................................................................
Add the missing --enable-rhev definition to configure.ac
This fixes an error reported by autogen.sh when
--enable-rhev was on the command line.
Change-Id: I3b253be2710bc979e3e14f1525f0157a0e65440f
Signed-off-by: Martin Sivak <msivak(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35796
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M configure.ac
1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/35860/1
diff --git a/configure.ac b/configure.ac
index a70b3d5..7d3472c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,16 @@
[enable_hooks="no"]
)
AM_CONDITIONAL([HOOKS], [test "${enable_hooks}" = "yes"])
+
+AC_ARG_ENABLE(
+ [rhev],
+ [AS_HELP_STRING(
+ [--enable-rhev],
+ [build RHEV version @<:@default=no@:>@]
+ )],
+ ,
+ [enable_rhev="no"]
+)
AM_CONDITIONAL([RHEV], [test "${enable_rhev}" = "yes"])
AC_ARG_ENABLE(
--
To view, visit http://gerrit.ovirt.org/35860
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b253be2710bc979e3e14f1525f0157a0e65440f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: fixed TestConfigNetwork.testAddNetworkValidation
by ibarkan@redhat.com
Ido Barkan has uploaded a new change for review.
Change subject: fixed TestConfigNetwork.testAddNetworkValidation
......................................................................
fixed TestConfigNetwork.testAddNetworkValidation
Change-Id: Ieebd1c90577c37c3245d09936b44e1bc2fab520d
Signed-off-by: ibarkan <ibarkan(a)redhat.com>
---
M tests/configNetworkTests.py
1 file changed, 4 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/77/35777/1
diff --git a/tests/configNetworkTests.py b/tests/configNetworkTests.py
index 5241f91..46d11bb 100644
--- a/tests/configNetworkTests.py
+++ b/tests/configNetworkTests.py
@@ -25,7 +25,8 @@
from testlib import VdsmTestCase as TestCaseBase
from monkeypatch import MonkeyPatch
-from network import api, configurators
+from network import api
+from network.configurators import ifcfg
from network import errors
from network.models import Bond, Bridge, Nic, Vlan
@@ -51,9 +52,9 @@
@MonkeyPatch(netinfo, 'networks', _fakeNetworks)
@MonkeyPatch(netinfo, 'getMaxMtu', lambda *x: 1500)
@MonkeyPatch(netinfo, 'getMtu', lambda *x: 1500)
- @MonkeyPatch(configurators.ifcfg, 'ifdown', lambda *x:
+ @MonkeyPatch(ifcfg, 'ifdown', lambda *x:
_raiseInvalidOpException())
- @MonkeyPatch(configurators.ifcfg, 'ifup',
+ @MonkeyPatch(ifcfg, 'ifup',
lambda *x: _raiseInvalidOpException())
@MonkeyPatch(Bond, 'configure', lambda *x: _raiseInvalidOpException())
@MonkeyPatch(Bridge, 'configure', lambda *x: _raiseInvalidOpException())
--
To view, visit http://gerrit.ovirt.org/35777
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieebd1c90577c37c3245d09936b44e1bc2fab520d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: Revert "Instruct MOM to ignore ballooning when guest agent i...
by phoracek@redhat.com
Petr Horáček has uploaded a new change for review.
Change subject: Revert "Instruct MOM to ignore ballooning when guest agent is not running"
......................................................................
Revert "Instruct MOM to ignore ballooning when guest agent is not running"
This reverts commit a99bacf9562c686d585c9af99454e9647b14cc4e.
Change-Id: I2508225646cf9f86846a6c5975c5ca28168265f0
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
---
M vdsm.spec.in
M vdsm/mom.conf.in
M vdsm/mom.d/02-balloon.policy
3 files changed, 5 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/35558/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index d15f5c2..59d31c1 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -137,7 +137,7 @@
Requires: libnl3
Requires: %{name}-xmlrpc = %{version}-%{release}
Requires: %{name}-jsonrpc = %{version}-%{release}
-Requires: mom >= 0.4.3
+Requires: mom >= 0.4.2
# Numactl is not available on s390[x] and ARM
%ifnarch s390 s390x %{arm}
Requires: numactl
diff --git a/vdsm/mom.conf.in b/vdsm/mom.conf.in
index 35d90a8..c850fff 100644
--- a/vdsm/mom.conf.in
+++ b/vdsm/mom.conf.in
@@ -71,4 +71,4 @@
[guest]
# A comma-separated list of Collector plugins to use for Guest data collection.
-collectors: GuestQemuProc, GuestMemoryOptional, GuestBalloon, GuestCpuTune
+collectors: GuestQemuProc, GuestMemory, GuestBalloon, GuestCpuTune
diff --git a/vdsm/mom.d/02-balloon.policy b/vdsm/mom.d/02-balloon.policy
index 570c751..c98a231 100644
--- a/vdsm/mom.d/02-balloon.policy
+++ b/vdsm/mom.d/02-balloon.policy
@@ -108,17 +108,9 @@
# If the balloon is disabled, only deflate the balloon when possible
(defvar host_free_percent (/ (Host.StatAvg "mem_free") Host.mem_available))
-
-(def balloon_logic (g) {
- (if (and (< host_free_percent pressure_threshold) balloonEnabled)
- (shrink_guest g)
- (grow_guest g))
-})
-
-(with Guests guest
- (if (valid guest.balloon_cur (guest.StatAvg "mem_unused"))
- (balloon_logic guest)
- (debug "Memory information is missing, ballooning for" guest "disabled")))
+(if (and (< host_free_percent pressure_threshold) balloonEnabled)
+ (with Guests guest (shrink_guest guest))
+ (with Guests guest (grow_guest guest)))
#
# Balloon minimum guaranteed memory ruleset
--
To view, visit http://gerrit.ovirt.org/35558
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2508225646cf9f86846a6c5975c5ca28168265f0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: test jenkins
by phoracek@redhat.com
Petr Horáček has uploaded a new change for review.
Change subject: test jenkins
......................................................................
test jenkins
Change-Id: I8dc42f138b55f1f5bc116ab4d9b06714720f7369
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
---
M vdsm/network/api.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/35784/1
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 34362ba..553fdb7 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -39,6 +39,7 @@
import hooks # TODO: Turn into parent package import when vdsm is a package
CONNECTIVITY_TIMEOUT_DEFAULT = 4
+# hello jenkins
def _getConfiguratorClass():
--
To view, visit http://gerrit.ovirt.org/35784
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8dc42f138b55f1f5bc116ab4d9b06714720f7369
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: vdsm: check libvirt availability at startup
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vdsm: check libvirt availability at startup
......................................................................
vdsm: check libvirt availability at startup
When VDSM starts, it checks the availability
of the needed servers, like supervdsm, and panic()s
if it cannot connects to them.
libvirtd is among the critical dependencies of VDSM,
yet its presence is checked lazily.
This may lead to the scenario on which VDSM starts
up without a valid libvirt connection, a situation
that we try hard to avoid otherwise.
This is not a made up scenario. If libvirt crashes,
VDSM detects that and kills itself; it is possible,
although unlikely, that VDSM respawns faster than
libvirt, especially on overloaded systems.
This patch adds an explicit check about libvirt
availability, and makes VDSM panic() if no connection
at all is possible.
As side effect of this approach, the internal
connection pool is populated early, so the builtin
existing protection against libvirt crashes engages
earlier for added safety.
Change-Id: I36137a424427b03a5dd3f24b5a7af1af454d0a23
Related-To: https://bugzilla.redhat.com/1167388
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/vdsm
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/96/35596/1
diff --git a/vdsm/vdsm b/vdsm/vdsm
index 5c1ab71..e5d69bc 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -79,6 +79,13 @@
libvirtconnection.start_event_loop()
+ try:
+ conn = libvirtconnection.get()
+ except Exception:
+ conn = None
+ if not conn:
+ utils.panic("failed to connect to libvirt")
+
if config.getboolean('irs', 'irs_enable'):
try:
irs = Dispatcher(HSM())
--
To view, visit http://gerrit.ovirt.org/35596
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36137a424427b03a5dd3f24b5a7af1af454d0a23
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: vdscli: rename constants and make them private
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vdscli: rename constants and make them private
......................................................................
vdscli: rename constants and make them private
the various d_* constants found in the vdscli
module should not be exported and their naming
should reflect they are private.
Change-Id: I525505f6bdf77db9595539c3f67b3399447c3242
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/vdscli.py
1 file changed, 15 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/35272/1
diff --git a/lib/vdsm/vdscli.py b/lib/vdsm/vdscli.py
index f8690da..d4bd39a 100644
--- a/lib/vdsm/vdscli.py
+++ b/lib/vdsm/vdscli.py
@@ -27,10 +27,10 @@
from . import sslutils
-d_useSSL = False
-d_tsPath = '/etc/pki/vdsm'
-d_addr = '0'
-d_port = '54321'
+_USE_SSL = False
+_TRUSTED_STORE_PATH = '/etc/pki/vdsm'
+_ADDRESS = '0'
+_PORT = '54321'
def wrap_transport(transport):
@@ -60,15 +60,15 @@
def __guessDefaults():
- global d_useSSL, d_tsPath, d_addr, d_port
+ global _USE_SSL, _TRUSTED_STORE_PATH, _ADDRESS, _PORT
VDSM_CONF = '/etc/vdsm/vdsm.conf'
try:
from .config import config
config.read(VDSM_CONF)
- d_useSSL = config.getboolean('vars', 'ssl')
- d_tsPath = config.get('vars', 'trust_store_path')
- d_port = config.get('addresses', 'management_port')
- d_addr = config.get('addresses', 'management_ip')
+ _USE_SSL = config.getboolean('vars', 'ssl')
+ _TRUSTED_STORE_PATH = config.get('vars', 'trust_store_path')
+ _PORT = config.get('addresses', 'management_port')
+ _ADDRESS = config.get('addresses', 'management_ip')
except:
pass
@@ -76,9 +76,9 @@
__guessDefaults()
-def cannonizeHostPort(hostPort=None, port=d_port):
+def cannonizeHostPort(hostPort=None, port=_PORT):
if hostPort is None or hostPort == '0':
- addr = d_addr
+ addr = _ADDRESS
if ':' in addr:
# __guessDefaults() might set an IPv6 address, cannonize it
addr = '[%s]' % addr
@@ -95,9 +95,9 @@
TransportClass=sslutils.VerifyingSafeTransport):
hostPort = cannonizeHostPort(hostPort)
if useSSL is None:
- useSSL = d_useSSL
+ useSSL = _USE_SSL
if tsPath is None:
- tsPath = d_tsPath
+ tsPath = _TRUSTED_STORE_PATH
if useSSL:
KEYFILE = tsPath + '/keys/vdsmkey.pem'
CERTFILE = tsPath + '/certs/vdsmcert.pem'
@@ -117,7 +117,7 @@
return server
if __name__ == '__main__':
- print('connecting to %s:%s ssl %s ts %s' % (d_addr, d_port,
- d_useSSL, d_tsPath))
+ print('connecting to %s:%s ssl %s ts %s' % (
+ _ADDRESS, _PORT, _USE_SSL, _TRUSTED_STORE_PATH))
server = connect()
print(server.getVdsCapabilities())
--
To view, visit http://gerrit.ovirt.org/35272
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I525505f6bdf77db9595539c3f67b3399447c3242
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 5 months