summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Asleson <tasleson@redhat.com>2019-10-09 16:55:39 -0500
committerTony Asleson <tasleson@redhat.com>2019-10-30 10:38:40 -0500
commit89373761c808c21181751d622e987b323355b677 (patch)
treeb34fed0d71b24e3fdad0277f3f3d16b587ff9af9
parented7e365ae5a2b79bf14a3f9772e8e1f663bb6c4f (diff)
downloadlvm2-89373761c808c21181751d622e987b323355b677.tar.gz
lvmdbustest.py: Add basic vdo test
-rwxr-xr-xtest/dbus/lvmdbustest.py54
-rw-r--r--test/dbus/testlib.py1
2 files changed, 54 insertions, 1 deletions
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 1d340dfd8..f8842ef76 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -176,6 +176,15 @@ def call_lvm(command):
return process.returncode, stdout_text, stderr_text
+def supports_vdo():
+ cmd = ['segtypes']
+ rc, out, err = call_lvm(cmd)
+ if rc == 0:
+ if "vdo" in out:
+ return True
+ return False
+
+
# noinspection PyUnresolvedReferences
class TestDbusService(unittest.TestCase):
def setUp(self):
@@ -198,6 +207,8 @@ class TestDbusService(unittest.TestCase):
for p in self.objs[PV_INT]:
self.pvs.append(p.Pv.Name)
+ self.vdo = supports_vdo()
+
def _recurse_vg_delete(self, vg_proxy, pv_proxy, nested_pv_hash):
for pv_device_name, t in nested_pv_hash.items():
@@ -320,7 +331,12 @@ class TestDbusService(unittest.TestCase):
self._validate_lookup(vg_name, vg_path)
self.assertTrue(vg_path is not None and len(vg_path) > 0)
- return ClientProxy(self.bus, vg_path, interfaces=(VG_INT, ))
+
+ intf = [VG_INT, ]
+ if self.vdo:
+ intf.append(VG_VDO_INT)
+
+ return ClientProxy(self.bus, vg_path, interfaces=intf)
def test_vg_create(self):
self._vg_create()
@@ -1776,6 +1792,42 @@ class TestDbusService(unittest.TestCase):
self.assertEqual(pv_object_path, self._lookup(symlink))
self.assertEqual(pv_object_path, self._lookup(pv_device_path))
+ def _create_vdo_pool_and_lv(self):
+ pool_name = lv_n("_vdo_pool")
+ lv_name = lv_n()
+
+ vg_proxy = self._vg_create()
+ vdo_pool_object_path = self.handle_return(
+ vg_proxy.VgVdo.CreateVdoPoolandLv(
+ pool_name, lv_name,
+ dbus.UInt64(mib(4096)),
+ dbus.UInt64(mib(8192)),
+ dbus.Int32(g_tmo),
+ EOD))
+
+ self.assertNotEqual(vdo_pool_object_path, "/")
+ self.assertEqual(
+ vdo_pool_object_path,
+ self._lookup("%s/%s" % (vg_proxy.Vg.Name, pool_name)))
+
+ vdo_lv = self._lookup("%s/%s" % (vg_proxy.Vg.Name, lv_name))
+ self.assertNotEqual(vdo_lv, "/")
+ intf = (LV_COMMON_INT, LV_INT, VDOPOOL_INT)
+ pool_lv = ClientProxy(self.bus, vdo_lv, interfaces=intf)
+ return vg_proxy, pool_lv
+
+ def test_vdo_pool_create(self):
+ # Basic vdo sanity testing
+ if not self.vdo:
+ raise unittest.SkipTest('vdo not supported')
+
+ # Do this twice to ensure we are providing the correct flags to force
+ # the operation when if finds an existing vdo signature, which likely
+ # shouldn't exist.
+ for _ in range(0, 2):
+ vg, _ = self._create_vdo_pool_and_lv()
+ self.handle_return(vg.Vg.Remove(dbus.Int32(g_tmo), EOD))
+
class AggregateResults(object):
diff --git a/test/dbus/testlib.py b/test/dbus/testlib.py
index e6655a5b3..bf88beb3a 100644
--- a/test/dbus/testlib.py
+++ b/test/dbus/testlib.py
@@ -243,6 +243,7 @@ class ClientProxy(object):
Pv = None
Lv = None
Vg = None
+ VgVdo = None
@staticmethod
def _intf_short_name(nm):