Change in vdsm[ovirt-3.6]: tests: Fix loop device leak in mount tests

nsoffer at redhat.com nsoffer at redhat.com
Tue Feb 16 09:20:08 UTC 2016


Hello Fabian Deutsch, Dan Kenigsberg, Edward Haas,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/53561

to review the following change.

Change subject: tests: Fix loop device leak in mount tests
......................................................................

tests: Fix loop device leak in mount tests

We used to unmount loop devices without using force=True and
freeloop=True. This may lead to loop device leak, failing the later
tests trying to mount loop devices. We also did not wait for udev events
when unmounting a loop device, which is asynchronous operation.

Both issues were fixed long time ago (commit dbfdc90) in the mkimageTests.
Apply the same fix for mount tests.

Change-Id: Iada8f3d962778c53ada4a6f0a7f3e75b80c07239
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/51614
Continuous-Integration: Jenkins CI
Reviewed-by: Fabian Deutsch <fabiand at redhat.com>
Reviewed-by: Edward Haas <edwardh at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M tests/mountTests.py
1 file changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/61/53561/1

diff --git a/tests/mountTests.py b/tests/mountTests.py
index c0e05a2..f481ae2 100644
--- a/tests/mountTests.py
+++ b/tests/mountTests.py
@@ -25,6 +25,9 @@
 import shutil
 import stat
 
+from vdsm import udevadm
+from vdsm.utils import stopwatch
+
 from nose.plugins.skip import SkipTest
 
 from testlib import VdsmTestCase as TestCaseBase
@@ -129,7 +132,10 @@
                 try:
                     self.assertTrue(m.isMounted())
                 finally:
-                    m.umount()
+                    m.umount(force=True, freeloop=True)
+                    # TODO: Use libudev to wait for specific event
+                    with stopwatch("Wait for udev events"):
+                        udevadm.settle(5)
 
     def testSymlinkMount(self):
         checkSudo(["mount", "-o", "loop", "somefile", "target"])
@@ -151,7 +157,10 @@
             try:
                 self.assertTrue(m.isMounted())
             finally:
-                m.umount()
+                m.umount(force=True, freeloop=True)
+                # TODO: Use libudev to wait for specific event
+                with stopwatch("Wait for udev events"):
+                    udevadm.settle(5)
 
 
 class IterMountsPerfTests(TestCaseBase):


-- 
To view, visit https://gerrit.ovirt.org/53561
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iada8f3d962778c53ada4a6f0a7f3e75b80c07239
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at redhat.com>


More information about the vdsm-patches mailing list