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>
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>
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>
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>