Adam Litke has uploaded a new change for review.
Change subject: Don't prepare image with illegal volumes
......................................................................
Don't prepare image with illegal volumes
The irs verb 'prepareImage' is used only by clientIF when preparing the
host to start a VM. Currently, this operation succeeds even if one or
more of the volumes in the image is illegal. Since we should never
permit a VM to start with an illegal disk, check for this and report an
error if any illegal volumes are found.
The pivot stage of a live merge operation depends on this behavior to
ensure that a VM is not accidentally started using a stale leaf volume.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1206722
Change-Id: Ie543aeb8bdb52305419613ab6297681817124308
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/39302/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 8f07586..dc8ca77 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3225,6 +3225,11 @@
if leafUUID not in imgVolumes:
raise se.VolumeDoesNotExist(leafUUID)
+ for volUUID in imgVolumes:
+ legality = dom.produceVolume(imgUUID, volUUID).getLegality()
+ if legality == volume.ILLEGAL_VOL:
+ raise se.prepareIllegalVolumeError(volUUID)
+
imgPath = dom.activateVolumes(imgUUID, imgVolumes)
if spUUID and spUUID != sd.BLANK_UUID:
runImgPath = dom.linkBCImage(imgPath, imgUUID)
--
To view, visit https://gerrit.ovirt.org/39302
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie543aeb8bdb52305419613ab6297681817124308
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Hello Nir Soffer, Dan Kenigsberg,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/40030
to review the following change.
Change subject: tests: Enable again utils.memoized in the tests
......................................................................
tests: Enable again utils.memoized in the tests
Tests that may leave dirt in memoized functions should invalidate the
functions during teardown.
Since we disabled memoizing becuase of pulluted memoized functions in
caps module, caps tests invalidate all memoized functions now.
Change-Id: I019e2a2ad75973511cccd195a7e9eaa105d8154f
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/37841
Reviewed-by: Francesco Romani <fromani(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
Tested-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/capsTests.py
M tests/testrunner.py
2 files changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/40030/1
diff --git a/tests/capsTests.py b/tests/capsTests.py
index e3f7d6a..d0ac3d5 100644
--- a/tests/capsTests.py
+++ b/tests/capsTests.py
@@ -41,6 +41,13 @@
class TestCaps(TestCaseBase):
+
+ def tearDown(self):
+ for name in dir(caps):
+ obj = getattr(caps, name)
+ if isinstance(obj, utils.memoized):
+ obj.invalidate()
+
def _readCaps(self, fileName):
testPath = os.path.realpath(__file__)
dirName = os.path.split(testPath)[0]
diff --git a/tests/testrunner.py b/tests/testrunner.py
index 13fe55e..37b4c95 100644
--- a/tests/testrunner.py
+++ b/tests/testrunner.py
@@ -411,10 +411,6 @@
raise AssertionError(msg)
-def fakeMemoized(func):
- return func
-
-
if __name__ == '__main__':
if "--help" in sys.argv:
print("testrunner options:\n"
@@ -426,6 +422,4 @@
# Mock panic() calls for tests
utils.panic = panicMock
- # Memoization during tests is a bad idea.
- utils.memoized = fakeMemoized
run()
--
To view, visit https://gerrit.ovirt.org/40030
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I019e2a2ad75973511cccd195a7e9eaa105d8154f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Hello Nir Soffer, Dan Kenigsberg,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/39949
to review the following change.
Change subject: tests: disable memoization in testrunner
......................................................................
tests: disable memoization in testrunner
memoization during tests is harmful, because
it adds another one hidden layer of global state
shared across test runs.
This may lead -and actually did- to hard
to debug failures in apparently unrelated code.
The net result is waste of developer's time,
and decreased trust in automated tests
because of mysterious failures.
To fix that, we now monkeypatch in testrunner
only utils.memoized with a fake which avoids caching.
Change-Id: Ibd986403a76268995b83c9e6ac400e942ed24cb6
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/37748
Reviewed-by: Nir Soffer <nsoffer(a)redhat.com>
Tested-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/testrunner.py
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/39949/1
diff --git a/tests/testrunner.py b/tests/testrunner.py
index 37b4c95..13fe55e 100644
--- a/tests/testrunner.py
+++ b/tests/testrunner.py
@@ -411,6 +411,10 @@
raise AssertionError(msg)
+def fakeMemoized(func):
+ return func
+
+
if __name__ == '__main__':
if "--help" in sys.argv:
print("testrunner options:\n"
@@ -422,4 +426,6 @@
# Mock panic() calls for tests
utils.panic = panicMock
+ # Memoization during tests is a bad idea.
+ utils.memoized = fakeMemoized
run()
--
To view, visit https://gerrit.ovirt.org/39949
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd986403a76268995b83c9e6ac400e942ed24cb6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Hello Nir Soffer, Dan Kenigsberg,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/39948
to review the following change.
Change subject: tests: clear libvirtconnection cache
......................................................................
tests: clear libvirtconnection cache
the libvirtconnection has a cache to reuse connections,
and this caching doesn't play well with the monkeypatching
which we do in tests.
In libvirtconnectionTests, we create fake libvirt objects,
most notably fake virConnect-s. Unfortunately, the test fails
to clean up properly the libvirtconnection cache.
So, the test runs just fine in isolation, but if run in batch
like in 'make check', later tests which expect the real object
become broken.
The failure presents itself like the following:
AttributeError: 'virConnect' object has no attribute 'getMemoryStats'
This patch fixes this error adding a facility to clear
the libvirtconnection cache, and clearing it after each
test.
Change-Id: If4d64920e5f26c276accf26b7a532461d04f02df
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/37747
Reviewed-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/libvirtconnection.py
M tests/libvirtconnectionTests.py
2 files changed, 12 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/39948/1
diff --git a/lib/vdsm/libvirtconnection.py b/lib/vdsm/libvirtconnection.py
index b1332db..33fdf11 100644
--- a/lib/vdsm/libvirtconnection.py
+++ b/lib/vdsm/libvirtconnection.py
@@ -95,6 +95,14 @@
return utils.retry(libvirtOpen, timeout=10, sleep=0.2)
+def _clear():
+ """
+ For clearing connections during the tests.
+ """
+ with __connectionLock:
+ __connections.clear()
+
+
def get(target=None, killOnFailure=True):
"""Return current connection to libvirt or open a new one.
Use target to get/create the connection object linked to that object.
diff --git a/tests/libvirtconnectionTests.py b/tests/libvirtconnectionTests.py
index 1ac60a0..18e1984 100644
--- a/tests/libvirtconnectionTests.py
+++ b/tests/libvirtconnectionTests.py
@@ -103,6 +103,10 @@
class testLibvirtconnection(TestCaseBase):
+
+ def tearDown(self):
+ libvirtconnection._clear()
+
@MonkeyPatch(libvirtconnection, 'libvirt', LibvirtMock())
def testCallSucceeded(self):
"""Positive test - libvirtMock does not raise any errors"""
--
To view, visit https://gerrit.ovirt.org/39948
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If4d64920e5f26c276accf26b7a532461d04f02df
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
John Taylor has uploaded a new change for review.
Change subject: vdsm: Fix memory leak in netlink.py
......................................................................
vdsm: Fix memory leak in netlink.py
The documentation for libnl says that calls to rtnl_link_get_by_name
increment the reference counter and should be released by a call to
rtnl_link_put(). That's not done in the get_link(name) function where
it is used and causes a memory leak.
Add a C function prototype for the libnl rtnl_link_put function,
construct the link_info, and call rtnl_link_put before returning from
get_link(name).
Change-Id: I6e4dc72bd77e46ba4f95dd8a622f5c3288115315
Signed-off-by: John Taylor <jtt77777(a)yahoo.com>
---
M lib/vdsm/netlink.py
1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/39372/1
diff --git a/lib/vdsm/netlink.py b/lib/vdsm/netlink.py
index afae5ce..d822944 100644
--- a/lib/vdsm/netlink.py
+++ b/lib/vdsm/netlink.py
@@ -64,8 +64,9 @@
if not link:
raise IOError(errno.ENODEV, '%s is not present in the system' %
name)
- return _link_info(cache, link)
-
+ link_info = _link_info(cache, link)
+ _rtnl_link_put(link)
+ return link_info
class NLSocketPool(object):
"""Pool of netlink sockets."""
@@ -332,5 +333,7 @@
_nl_af2str = _int_char_proto(('nl_af2str', LIBNL))
_rtnl_scope2str = _int_char_proto(('rtnl_scope2str', LIBNL_ROUTE))
+_rtnl_link_put = _none_proto(('rtnl_link_put', LIBNL_ROUTE))
+
_nl_link_cache = partial(_cache_manager, _rtnl_link_alloc_cache)
_nl_addr_cache = partial(_cache_manager, _rtnl_addr_alloc_cache)
--
To view, visit https://gerrit.ovirt.org/39372
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e4dc72bd77e46ba4f95dd8a622f5c3288115315
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: John Taylor <jtt77777(a)yahoo.com>