master - lvmdbustest.py: WS corrections
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e1d3a6c552e8d23837c...
Commit: e1d3a6c552e8d23837c17934a83c3925cd40252d
Parent: df2292020bd9298d511e4e2fb6a54fe0cb6e7607
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Oct 9 11:45:41 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: WS corrections
---
test/dbus/lvmdbustest.py | 123 ++++++++++++++++++++++------------------------
1 files changed, 58 insertions(+), 65 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index c589fd1..a9d7fac 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -119,8 +119,8 @@ def get_objects():
object_manager_object = bus.get_object(
BUS_NAME, "/com/redhat/lvmdbus1", introspect=False)
- manager_interface = dbus.Interface(object_manager_object,
- "org.freedesktop.DBus.ObjectManager")
+ manager_interface = dbus.Interface(
+ object_manager_object, "org.freedesktop.DBus.ObjectManager")
objects = manager_interface.GetManagedObjects()
@@ -166,8 +166,8 @@ def call_lvm(command):
# in different locations on the same box
command.insert(0, LVM_EXECUTABLE)
- process = Popen(command, stdout=PIPE, stderr=PIPE, close_fds=True,
- env=os.environ)
+ process = Popen(
+ command, stdout=PIPE, stderr=PIPE, close_fds=True, env=os.environ)
out = process.communicate()
stdout_text = bytes(out[0]).decode("utf-8")
@@ -391,10 +391,8 @@ class TestDbusService(unittest.TestCase):
)
# Get thin pool client proxy
- thin_pool = ClientProxy(self.bus, thin_pool_path,
- interfaces=(LV_COMMON_INT,
- LV_INT,
- THINPOOL_INT))
+ intf = (LV_COMMON_INT, LV_INT, THINPOOL_INT)
+ thin_pool = ClientProxy(self.bus, thin_pool_path, interfaces=intf)
return vg, thin_pool
@@ -420,10 +418,9 @@ class TestDbusService(unittest.TestCase):
)
# Get object proxy for cached thin pool
- cached_thin_pool_object = ClientProxy(self.bus, cached_thin_pool_path,
- interfaces=(LV_COMMON_INT,
- LV_INT,
- THINPOOL_INT))
+ intf = (LV_COMMON_INT, LV_INT, THINPOOL_INT)
+ cached_thin_pool_object = ClientProxy(
+ self.bus, cached_thin_pool_path, interfaces=intf)
# Check properties on cache pool
self.assertTrue(cached_thin_pool_object.ThinPool.DataLv != '/')
@@ -494,8 +491,8 @@ class TestDbusService(unittest.TestCase):
lv_paths = vg.Lvs
for l in lv_paths:
- lv_proxy = ClientProxy(self.bus, l,
- interfaces=(LV_COMMON_INT,)).LvCommon
+ lv_proxy = ClientProxy(
+ self.bus, l, interfaces=(LV_COMMON_INT,)).LvCommon
self.assertTrue(
lv_proxy.Vg == vg.object_path, "%s != %s" %
(lv_proxy.Vg, vg.object_path))
@@ -547,8 +544,8 @@ class TestDbusService(unittest.TestCase):
hidden_lv_paths = lv_common_object.HiddenLvs
for h in hidden_lv_paths:
- h_lv = ClientProxy(self.bus, h,
- interfaces=(LV_COMMON_INT,)).LvCommon
+ h_lv = ClientProxy(
+ self.bus, h, interfaces=(LV_COMMON_INT,)).LvCommon
if len(h_lv.HiddenLvs) > 0:
self._verify_hidden_lookups(h_lv, vgname)
@@ -634,8 +631,8 @@ class TestDbusService(unittest.TestCase):
lv = self._test_lv_create(
vg.LvCreate,
(dbus.String(lv_name), dbus.UInt64(mib(4)),
- dbus.Array([], signature='(ott)'), dbus.Int32(g_tmo),
- EOD), vg, LV_BASE_INT)
+ dbus.Array([], signature='(ott)'), dbus.Int32(g_tmo),
+ EOD), vg, LV_BASE_INT)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
def test_lv_create_job(self):
@@ -660,8 +657,7 @@ class TestDbusService(unittest.TestCase):
lv = self._test_lv_create(
vg.LvCreateLinear,
(dbus.String(lv_name), dbus.UInt64(mib(4)), dbus.Boolean(False),
- dbus.Int32(g_tmo), EOD),
- vg, LV_BASE_INT)
+ dbus.Int32(g_tmo), EOD), vg, LV_BASE_INT)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
def _all_pv_object_paths(self):
@@ -673,9 +669,8 @@ class TestDbusService(unittest.TestCase):
lv = self._test_lv_create(
vg.LvCreateStriped,
(dbus.String(lv_name), dbus.UInt64(mib(4)),
- dbus.UInt32(2), dbus.UInt32(8), dbus.Boolean(False),
- dbus.Int32(g_tmo), EOD),
- vg, LV_BASE_INT)
+ dbus.UInt32(2), dbus.UInt32(8), dbus.Boolean(False),
+ dbus.Int32(g_tmo), EOD), vg, LV_BASE_INT)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
def test_lv_create_mirror(self):
@@ -684,7 +679,7 @@ class TestDbusService(unittest.TestCase):
lv = self._test_lv_create(
vg.LvCreateMirror,
(dbus.String(lv_name), dbus.UInt64(mib(4)), dbus.UInt32(2),
- dbus.Int32(g_tmo), EOD), vg, LV_BASE_INT)
+ dbus.Int32(g_tmo), EOD), vg, LV_BASE_INT)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
def test_lv_create_raid(self):
@@ -693,10 +688,8 @@ class TestDbusService(unittest.TestCase):
lv = self._test_lv_create(
vg.LvCreateRaid,
(dbus.String(lv_name), dbus.String('raid5'), dbus.UInt64(mib(16)),
- dbus.UInt32(2), dbus.UInt32(8), dbus.Int32(g_tmo),
- EOD),
- vg,
- LV_BASE_INT)
+ dbus.UInt32(2), dbus.UInt32(8), dbus.Int32(g_tmo), EOD),
+ vg, LV_BASE_INT)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
def _create_lv(self, thinpool=False, size=None, vg=None, suffix=None):
@@ -716,7 +709,7 @@ class TestDbusService(unittest.TestCase):
lv = self._test_lv_create(
vg.LvCreateLinear,
(dbus.String(lv_name), dbus.UInt64(size),
- dbus.Boolean(thinpool), dbus.Int32(g_tmo), EOD),
+ dbus.Boolean(thinpool), dbus.Int32(g_tmo), EOD),
vg, interfaces)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
@@ -737,8 +730,8 @@ class TestDbusService(unittest.TestCase):
new_name = 'renamed_' + lv.LvCommon.Name
- self.handle_return(lv.Lv.Rename(dbus.String(new_name),
- dbus.Int32(g_tmo), EOD))
+ self.handle_return(
+ lv.Lv.Rename(dbus.String(new_name), dbus.Int32(g_tmo), EOD))
path = self._lookup(new_name)
@@ -774,8 +767,8 @@ class TestDbusService(unittest.TestCase):
)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), thin_path)
- lv = ClientProxy(self.bus, thin_path,
- interfaces=(LV_COMMON_INT, LV_INT))
+ lv = ClientProxy(
+ self.bus, thin_path, interfaces=(LV_COMMON_INT, LV_INT))
return vg, thin_path, lv
# noinspection PyUnresolvedReferences
@@ -815,7 +808,7 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(rc != '/')
- # noinspection PyUnresolvedReferences
+ # noinspection PyUnresolvedReferences,PyUnusedLocal
def _wait_for_job(self, j_path):
rc = None
j = ClientProxy(self.bus, j_path, interfaces=(JOB_INT, )).Job
@@ -850,8 +843,9 @@ class TestDbusService(unittest.TestCase):
vg.LvCreate, (
dbus.String(lv_name),
dbus.UInt64(mib(4)),
- dbus.Array([[pvp.object_path, 0, (pvp.Pv.PeCount - 1)]],
- signature='(ott)'),
+ dbus.Array(
+ [[pvp.object_path, 0, (pvp.Pv.PeCount - 1)]],
+ signature='(ott)'),
dbus.Int32(g_tmo), EOD), vg, LV_BASE_INT)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
@@ -909,10 +903,10 @@ class TestDbusService(unittest.TestCase):
lv = self._create_lv(vg=vg)
with self.assertRaises(dbus.exceptions.DBusException):
- lv.Lv.Resize(
- dbus.UInt64(lv.LvCommon.SizeBytes),
- dbus.Array([], '(oii)'),
- dbus.Int32(-1), EOD)
+ lv.Lv.Resize(
+ dbus.UInt64(lv.LvCommon.SizeBytes),
+ dbus.Array([], '(oii)'),
+ dbus.Int32(-1), EOD)
def test_lv_move(self):
lv = self._create_lv()
@@ -1071,6 +1065,7 @@ class TestDbusService(unittest.TestCase):
return rc
+ # noinspection PyUnusedLocal
def test_job_handling_timer(self):
yes = False
@@ -1247,8 +1242,9 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(len(self.objs[PV_INT]) > 0)
if len(self.objs[PV_INT]) > 0:
- pv = ClientProxy(self.bus, self.objs[PV_INT][0].object_path,
- interfaces=(PV_INT, )).Pv
+ pv = ClientProxy(
+ self.bus, self.objs[PV_INT][0].object_path,
+ interfaces=(PV_INT, )).Pv
original_size = pv.SizeBytes
@@ -1365,8 +1361,8 @@ class TestDbusService(unittest.TestCase):
dbus.Int32(g_tmo),
EOD))
- ss = ClientProxy(self.bus, snapshot_path,
- interfaces=(LV_COMMON_INT, LV_INT, SNAPSHOT_INT, ))
+ intf = (LV_COMMON_INT, LV_INT, SNAPSHOT_INT, )
+ ss = ClientProxy(self.bus, snapshot_path, interfaces=intf)
# Write some data to snapshot so merge takes some time
TestDbusService._write_some_data(ss.LvCommon.Path, ss_size // 2)
@@ -1389,8 +1385,8 @@ class TestDbusService(unittest.TestCase):
dbus.Int32(g_tmo),
EOD))
- ss = ClientProxy(self.bus, snapshot_path,
- interfaces=(LV_INT, LV_COMMON_INT, SNAPSHOT_INT))
+ intf = (LV_INT, LV_COMMON_INT, SNAPSHOT_INT)
+ ss = ClientProxy(self.bus, snapshot_path, interfaces=intf)
job_path = self.handle_return(
ss.Snapshot.Merge(
@@ -1413,8 +1409,8 @@ class TestDbusService(unittest.TestCase):
dbus.Int32(g_tmo),
EOD))
- cp = ClientProxy(self.bus, cache_pool_path,
- interfaces=(CACHE_POOL_INT, ))
+ intf = (CACHE_POOL_INT, )
+ cp = ClientProxy(self.bus, cache_pool_path, interfaces=intf)
return vg, cp
@@ -1438,9 +1434,8 @@ class TestDbusService(unittest.TestCase):
dbus.Int32(g_tmo),
EOD))
- cached_lv = ClientProxy(self.bus, c_lv_path,
- interfaces=(LV_COMMON_INT, LV_INT,
- CACHE_LV_INT))
+ intf = (LV_COMMON_INT, LV_INT, CACHE_LV_INT)
+ cached_lv = ClientProxy(self.bus, c_lv_path, interfaces=intf)
uncached_lv_path = self.handle_return(
cached_lv.CachedLv.DetachCachePool(
@@ -1475,13 +1470,12 @@ class TestDbusService(unittest.TestCase):
cur_objs, _ = get_objects()
self.assertEqual(len(cur_objs[CACHE_LV_INT]), 2)
- cached_lv = ClientProxy(self.bus, c_lv_path,
- interfaces=(LV_COMMON_INT, LV_INT,
- CACHE_LV_INT))
+ intf = (LV_COMMON_INT, LV_INT, CACHE_LV_INT)
+ cached_lv = ClientProxy(self.bus, c_lv_path, interfaces=intf)
new_name = 'renamed_' + cached_lv.LvCommon.Name
- self.handle_return(cached_lv.Lv.Rename(dbus.String(new_name),
- dbus.Int32(g_tmo), EOD))
+ self.handle_return(
+ cached_lv.Lv.Rename(dbus.String(new_name), dbus.Int32(g_tmo), EOD))
# Make sure we only have expected # of cached LV
cur_objs, _ = get_objects()
@@ -1707,23 +1701,22 @@ class TestDbusService(unittest.TestCase):
pv = ClientProxy(self.bus, pv_object_path, interfaces=(PV_INT,))
self.assertEqual(pv.Pv.Vg, vg.object_path)
- self.assertIn(pv_object_path, vg.Vg.Pvs,
- "Expecting PV object path in Vg.Pvs")
+ self.assertIn(
+ pv_object_path, vg.Vg.Pvs, "Expecting PV object path in Vg.Pvs")
- lv = self._create_lv(vg=vg.Vg, size=vg.Vg.FreeBytes,
- suffix="_pv")
+ lv = self._create_lv(
+ vg=vg.Vg, size=vg.Vg.FreeBytes, suffix="_pv")
device_path = '/dev/%s/%s' % (vg.Vg.Name, lv.LvCommon.Name)
new_pv_object_path = self._pv_create(device_path)
vg.update()
self.assertEqual(lv.LvCommon.Vg, vg.object_path)
- self.assertIn(lv.object_path, vg.Vg.Lvs,
- "Expecting LV object path in Vg.Lvs")
+ self.assertIn(
+ lv.object_path, vg.Vg.Lvs, "Expecting LV object path in Vg.Lvs")
- new_pv_proxy = ClientProxy(self.bus,
- new_pv_object_path,
- interfaces=(PV_INT, ))
+ new_pv_proxy = ClientProxy(
+ self.bus, new_pv_object_path, interfaces=(PV_INT, ))
self.assertEqual(new_pv_proxy.Pv.Name, device_path)
return new_pv_object_path
4 years, 5 months
master - lvmdbusd: Prevent running --nojson with VDO support
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=df2292020bd9298d511...
Commit: df2292020bd9298d511e4e2fb6a54fe0cb6e7607
Parent: 5b224d58f7cb72852c0bad87d3a0b4fb9250b132
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Oct 9 11:20:18 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbusd: Prevent running --nojson with VDO support
---
daemons/lvmdbusd/main.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index de384ce..c128535 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -131,6 +131,10 @@ def main():
# exists.
cfg.vdo_support = supports_vdo()
+ if cfg.vdo_support and not cfg.args.use_json:
+ log_error("You cannot specify --nojson when lvm has VDO support")
+ sys.exit(1)
+
# List of threads that we start up
thread_list = []
4 years, 5 months
master - lvmdbustest.py: Add cache LV rename test
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5b224d58f7cb72852c0...
Commit: 5b224d58f7cb72852c0bad87d3a0b4fb9250b132
Parent: 6204955347b2d57ded9e6385aa5118392e182a48
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Oct 8 08:03:50 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: Add cache LV rename test
---
test/dbus/lvmdbustest.py | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 1e4d40d..c589fd1 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1455,6 +1455,39 @@ class TestDbusService(unittest.TestCase):
vg.Remove(dbus.Int32(g_tmo), EOD))
self.assertTrue(rc == '/')
+ def test_cache_lv_rename(self):
+ """
+ Make sure that if we rename a cache lv that we correctly handle the
+ internal state update.
+ :return:
+ """
+ vg, cache_pool = self._create_cache_pool()
+
+ lv_to_cache = self._create_lv(size=mib(8), vg=vg)
+
+ c_lv_path = self.handle_return(
+ cache_pool.CachePool.CacheLv(
+ dbus.ObjectPath(lv_to_cache.object_path),
+ dbus.Int32(g_tmo),
+ EOD))
+
+ # Make sure we only have expected # of cached LV
+ cur_objs, _ = get_objects()
+ self.assertEqual(len(cur_objs[CACHE_LV_INT]), 2)
+
+ cached_lv = ClientProxy(self.bus, c_lv_path,
+ interfaces=(LV_COMMON_INT, LV_INT,
+ CACHE_LV_INT))
+ new_name = 'renamed_' + cached_lv.LvCommon.Name
+
+ self.handle_return(cached_lv.Lv.Rename(dbus.String(new_name),
+ dbus.Int32(g_tmo), EOD))
+
+ # Make sure we only have expected # of cached LV
+ cur_objs, _ = get_objects()
+ self.assertEqual(len(cur_objs[CACHE_LV_INT]), 2)
+ self._check_consistency()
+
def test_vg_change(self):
vg_proxy = self._vg_create()
4 years, 5 months
master - lvmdbusd: Add VgVdo class & assoc. interface
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6204955347b2d57ded9...
Commit: 6204955347b2d57ded9e6385aa5118392e182a48
Parent: 9d2ef05c5d0b57139d8405a2af947091f2c13942
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Oct 7 16:58:10 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbusd: Add VgVdo class & assoc. interface
When VDO support is available we will create VG object instances
which will allow the API user to create VDO pool LVs.
---
daemons/lvmdbusd/cfg.py | 1 +
daemons/lvmdbusd/cmdhandler.py | 20 +++++++++++++++++
daemons/lvmdbusd/vg.py | 46 +++++++++++++++++++++++++++++++++++++--
3 files changed, 64 insertions(+), 3 deletions(-)
diff --git a/daemons/lvmdbusd/cfg.py b/daemons/lvmdbusd/cfg.py
index 13143ef..b11d9f8 100644
--- a/daemons/lvmdbusd/cfg.py
+++ b/daemons/lvmdbusd/cfg.py
@@ -47,6 +47,7 @@ BUS_NAME = os.getenv('LVM_DBUS_NAME', 'com.redhat.lvmdbus1')
BASE_INTERFACE = 'com.redhat.lvmdbus1'
PV_INTERFACE = BASE_INTERFACE + '.Pv'
VG_INTERFACE = BASE_INTERFACE + '.Vg'
+VG_VDO_INTERFACE = BASE_INTERFACE + '.VgVdo'
LV_INTERFACE = BASE_INTERFACE + '.Lv'
LV_COMMON_INTERFACE = BASE_INTERFACE + '.LvCommon'
THIN_POOL_INTERFACE = BASE_INTERFACE + '.ThinPool'
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index f7f6acd..137027b 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -388,6 +388,16 @@ def vg_create_thin_pool(md_full_name, data_full_name, create_options):
return call(cmd)
+def vg_create_vdo_pool_lv_and_lv(vg_name, pool_name, lv_name, data_size,
+ virtual_size, create_options):
+ cmd = ['lvcreate']
+ cmd.extend(options_to_cli_args(create_options))
+ cmd.extend(['-y', '--type', 'vdo', '-n', lv_name,
+ '-L', '%dB' % data_size, '-V', '%dB' % virtual_size,
+ "%s/%s" % (vg_name, pool_name)])
+ return call(cmd)
+
+
def lv_remove(lv_path, remove_options):
cmd = ['lvremove']
cmd.extend(options_to_cli_args(remove_options))
@@ -462,6 +472,16 @@ def supports_json():
return False
+def supports_vdo():
+ cmd = ['segtypes']
+ rc, out, err = call(cmd)
+ if rc == 0:
+ if "vdo" in out:
+ log_debug("We have VDO support")
+ return True
+ return False
+
+
def lvm_full_report_json():
pv_columns = ['pv_name', 'pv_uuid', 'pv_fmt', 'pv_size', 'pv_free',
'pv_used', 'dev_size', 'pv_mda_size', 'pv_mda_free',
diff --git a/daemons/lvmdbusd/vg.py b/daemons/lvmdbusd/vg.py
index d022ff1..789626c 100644
--- a/daemons/lvmdbusd/vg.py
+++ b/daemons/lvmdbusd/vg.py
@@ -14,7 +14,7 @@ from .utils import pv_obj_path_generate, vg_obj_path_generate, n, \
_handle_execute
import dbus
from . import cfg
-from .cfg import VG_INTERFACE
+from .cfg import VG_INTERFACE, VG_VDO_INTERFACE
from . import cmdhandler
from .request import RequestEntry
from .loader import common
@@ -47,7 +47,7 @@ def vgs_state_retrieve(selection, cache_refresh=True):
def load_vgs(vg_specific=None, object_path=None, refresh=False,
emit_signal=False, cache_refresh=True):
- return common(vgs_state_retrieve, (Vg,), vg_specific, object_path, refresh,
+ return common(vgs_state_retrieve, (Vg, VgVdo, ), vg_specific, object_path, refresh,
emit_signal, cache_refresh)
@@ -99,7 +99,11 @@ class VgState(State):
if not path:
path = cfg.om.get_object_path_by_uuid_lvm_id(
self.Uuid, self.internal_name, vg_obj_path_generate)
- return Vg(path, self)
+
+ if cfg.vdo_support:
+ return VgVdo(path, self)
+ else:
+ return Vg(path, self)
# noinspection PyMethodMayBeStatic
def creation_signature(self):
@@ -773,3 +777,39 @@ class Vg(AutomatedProperties):
@property
def Clustered(self):
return self._attribute(5, 'c')
+
+
+class VgVdo(Vg):
+
+ # noinspection PyUnusedLocal,PyPep8Naming
+ def __init__(self, object_path, object_state):
+ super(VgVdo, self).__init__(object_path, vgs_state_retrieve)
+ self.set_interface(VG_VDO_INTERFACE)
+ self._object_path = object_path
+ self.state = object_state
+
+ @staticmethod
+ def _lv_vdo_pool_create_with_lv(uuid, vg_name, pool_name, lv_name,
+ data_size, virtual_size, create_options):
+ Vg.validate_dbus_object(uuid, vg_name)
+ Vg.handle_execute(*cmdhandler.vg_create_vdo_pool_lv_and_lv(
+ vg_name, pool_name, lv_name, data_size, virtual_size,
+ create_options))
+ return Vg.fetch_new_lv(vg_name, pool_name)
+
+ @dbus.service.method(
+ dbus_interface=VG_VDO_INTERFACE,
+ in_signature='ssttia{sv}',
+ out_signature='(oo)',
+ async_callbacks=('cb', 'cbe'))
+ def CreateVdoPoolandLv(self, pool_name, lv_name, data_size, virtual_size,
+ tmo, create_options, cb, cbe):
+ utils.validate_lv_name(VG_VDO_INTERFACE, self.Name, pool_name)
+ utils.validate_lv_name(VG_VDO_INTERFACE, self.Name, lv_name)
+
+ r = RequestEntry(tmo, VgVdo._lv_vdo_pool_create_with_lv,
+ (self.state.Uuid, self.state.lvm_id,
+ pool_name, lv_name, round_size(data_size),
+ round_size(virtual_size),
+ create_options), cb, cbe)
+ cfg.worker_q.put(r)
4 years, 5 months
master - lvmdbusd: Add cfg.vdo_support
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9d2ef05c5d0b57139d8...
Commit: 9d2ef05c5d0b57139d8405a2af947091f2c13942
Parent: ceb808d26f56ebd75baa379780ad55163197a20f
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Oct 7 16:57:05 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbusd: Add cfg.vdo_support
Will be used to add vdo interfaces on demand.
---
daemons/lvmdbusd/cfg.py | 3 +++
daemons/lvmdbusd/main.py | 6 +++++-
test/dbus/lvmdbustest.py | 2 +-
test/dbus/testlib.py | 1 +
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/cfg.py b/daemons/lvmdbusd/cfg.py
index be497d0..13143ef 100644
--- a/daemons/lvmdbusd/cfg.py
+++ b/daemons/lvmdbusd/cfg.py
@@ -79,6 +79,9 @@ hidden_lv = itertools.count()
load = None
event = None
+# Boolean to denote if lvm supports VDO integration
+vdo_support = False
+
# Global cached state
db = None
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index 7f0a028..de384ce 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -29,7 +29,7 @@ from .utils import log_debug, log_error
import argparse
import os
import sys
-from .cmdhandler import LvmFlightRecorder
+from .cmdhandler import LvmFlightRecorder, supports_vdo
from .request import RequestEntry
@@ -127,6 +127,10 @@ def main():
log_error("You cannot specify --lvmshell and --nojson")
sys.exit(1)
+ # We will dynamically add interfaces which support vdo if it
+ # exists.
+ cfg.vdo_support = supports_vdo()
+
# List of threads that we start up
thread_list = []
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index d703a0a..1e4d40d 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -114,7 +114,7 @@ def get_objects():
rc = {
MANAGER_INT: [], PV_INT: [], VG_INT: [], LV_INT: [],
THINPOOL_INT: [], JOB_INT: [], SNAPSHOT_INT: [], LV_COMMON_INT: [],
- CACHE_POOL_INT: [], CACHE_LV_INT: []}
+ CACHE_POOL_INT: [], CACHE_LV_INT: [], VG_VDO_INT: []}
object_manager_object = bus.get_object(
BUS_NAME, "/com/redhat/lvmdbus1", introspect=False)
diff --git a/test/dbus/testlib.py b/test/dbus/testlib.py
index 08f612c..872ed80 100644
--- a/test/dbus/testlib.py
+++ b/test/dbus/testlib.py
@@ -24,6 +24,7 @@ MANAGER_INT = BASE_INTERFACE + '.Manager'
MANAGER_OBJ = '/' + BASE_INTERFACE.replace('.', '/') + '/Manager'
PV_INT = BASE_INTERFACE + ".Pv"
VG_INT = BASE_INTERFACE + ".Vg"
+VG_VDO_INT = BASE_INTERFACE + ".VgVdo"
LV_INT = BASE_INTERFACE + ".Lv"
THINPOOL_INT = BASE_INTERFACE + ".ThinPool"
SNAPSHOT_INT = BASE_INTERFACE + ".Snapshot"
4 years, 5 months
master - lvmdbustest.py: Remove 2 TODOs
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ceb808d26f56ebd75ba...
Commit: ceb808d26f56ebd75baa379780ad55163197a20f
Parent: c5f4f2efb64944ea8a1eae0eee46069d8328324f
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Oct 3 17:01:27 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: Remove 2 TODOs
This issue has been resolved, sizes > 2**32-1 not supported.
---
test/dbus/lvmdbustest.py | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 92e4331..d703a0a 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1181,9 +1181,6 @@ class TestDbusService(unittest.TestCase):
def test_vg_max_pv(self):
vg = self._vg_create().Vg
-
- # BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1280496
- # TODO: Add a test back for larger values here when bug is resolved
for p in [0, 1, 10, 100, 100, 1024, 2 ** 32 - 1]:
rc = self.handle_return(
vg.MaxPvSet(
@@ -1196,9 +1193,6 @@ class TestDbusService(unittest.TestCase):
def test_vg_max_lv(self):
vg = self._vg_create().Vg
-
- # BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1280496
- # TODO: Add a test back for larger values here when bug is resolved
for p in [0, 1, 10, 100, 100, 1024, 2 ** 32 - 1]:
rc = self.handle_return(
vg.MaxLvSet(
4 years, 5 months
master - lvmdbustest.py: Add func. _pv_scan
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c5f4f2efb64944ea8a1...
Commit: c5f4f2efb64944ea8a1eae0eee46069d8328324f
Parent: 69d48479759693b8118e2a32b53cab8a9758e21f
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Oct 3 16:11:18 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: Add func. _pv_scan
---
test/dbus/lvmdbustest.py | 77 +++++++++++----------------------------------
1 files changed, 19 insertions(+), 58 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 497a605..92e4331 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1314,75 +1314,36 @@ class TestDbusService(unittest.TestCase):
context = pyudev.Context()
return context.list_devices(subsystem='block', MAJOR='8')
- def test_pv_scan(self):
- devices = TestDbusService._get_devices()
-
+ def _pv_scan(self, activate, cache, device_paths, major_minors):
mgr = self._manager().Manager
+ return self.handle_return(
+ mgr.PvScan(
+ dbus.Boolean(activate),
+ dbus.Boolean(cache),
+ dbus.Array(device_paths, 's'),
+ dbus.Array(major_minors, '(ii)'),
+ dbus.Int32(g_tmo),
+ EOD))
- self.assertEqual(
- self.handle_return(
- mgr.PvScan(
- dbus.Boolean(False),
- dbus.Boolean(True),
- dbus.Array([], 's'),
- dbus.Array([], '(ii)'),
- dbus.Int32(g_tmo),
- EOD)), '/')
+ def test_pv_scan(self):
+ devices = TestDbusService._get_devices()
+ self.assertEqual(self._pv_scan(False, True, [], []), '/')
self._check_consistency()
- self.assertEqual(
- self.handle_return(
- mgr.PvScan(
- dbus.Boolean(False),
- dbus.Boolean(False),
- dbus.Array([], 's'),
- dbus.Array([], '(ii)'),
- dbus.Int32(g_tmo),
- EOD)), '/')
-
+ self.assertEqual(self._pv_scan(False, False, [], []), '/')
self._check_consistency()
- block_path = []
- for d in devices:
- block_path.append(d.properties['DEVNAME'])
-
- self.assertEqual(
- self.handle_return(
- mgr.PvScan(
- dbus.Boolean(False),
- dbus.Boolean(True),
- dbus.Array(block_path, 's'),
- dbus.Array([], '(ii)'),
- dbus.Int32(g_tmo),
- EOD)), '/')
-
+ block_path = [d.properties['DEVNAME'] for d in devices]
+ self.assertEqual(self._pv_scan(False, True, block_path, []), '/')
self._check_consistency()
- mm = []
- for d in devices:
- mm.append((int(d.properties['MAJOR']), int(d.properties['MINOR'])))
-
- self.assertEqual(
- self.handle_return(
- mgr.PvScan(
- dbus.Boolean(False),
- dbus.Boolean(True),
- dbus.Array(block_path, 's'),
- dbus.Array(mm, '(ii)'),
- dbus.Int32(g_tmo),
- EOD)), '/')
+ mm = [(int(d.properties['MAJOR']), int(d.properties['MINOR']))
+ for d in devices]
+ self.assertEqual(self._pv_scan(False, True, block_path, mm), '/')
self._check_consistency()
- self.assertEqual(
- self.handle_return(
- mgr.PvScan(
- dbus.Boolean(False),
- dbus.Boolean(True),
- dbus.Array([], 's'),
- dbus.Array(mm, '(ii)'),
- dbus.Int32(g_tmo),
- EOD)), '/')
+ self.assertEqual(self._pv_scan(False, True, [], mm), '/')
self._check_consistency()
@staticmethod
4 years, 5 months
master - lvmdbustest.py: Use existing _create_lv
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=69d48479759693b8118...
Commit: 69d48479759693b8118e2a32b53cab8a9758e21f
Parent: 293f6d27951829940f35b6728cfbf3e1b4574ab6
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Oct 3 15:56:45 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: Use existing _create_lv
---
test/dbus/lvmdbustest.py | 25 ++-----------------------
1 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 082c958..497a605 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1147,17 +1147,7 @@ class TestDbusService(unittest.TestCase):
def test_lv_tags(self):
vg = self._vg_create().Vg
- lv_name = lv_n()
- lv = self._test_lv_create(
- vg.LvCreateLinear,
- (dbus.String(lv_name),
- dbus.UInt64(mib(4)),
- dbus.Boolean(False),
- dbus.Int32(g_tmo),
- EOD),
- vg, LV_BASE_INT)
-
- self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
+ lv = self._create_lv(vg=vg)
t = ['Testing', 'tags']
@@ -1234,18 +1224,7 @@ class TestDbusService(unittest.TestCase):
def test_vg_activate_deactivate(self):
vg = self._vg_create().Vg
- lv_name = lv_n()
- lv = self._test_lv_create(
- vg.LvCreateLinear, (
- dbus.String(lv_name),
- dbus.UInt64(mib(4)),
- dbus.Boolean(False),
- dbus.Int32(g_tmo),
- EOD),
- vg, LV_BASE_INT)
-
- self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
-
+ self._create_lv(vg=vg)
vg.update()
rc = self.handle_return(
4 years, 5 months
master - lvmdbustest.py: Add func. _create_thin_lv
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=293f6d27951829940f3...
Commit: 293f6d27951829940f35b6728cfbf3e1b4574ab6
Parent: a4666f63ade186e960c5f70399389e0d2fb28c81
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Oct 3 15:50:08 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: Add func. _create_thin_lv
---
test/dbus/lvmdbustest.py | 32 +++++++++-----------------------
1 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index d3e1f53..082c958 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -759,12 +759,7 @@ class TestDbusService(unittest.TestCase):
self._check_consistency()
self.assertEqual(new_name, tp.LvCommon.Name)
- # noinspection PyUnresolvedReferences
- def test_lv_on_thin_pool_rename(self):
- # Rename a LV on a thin Pool
-
- # This returns a LV with the LV interface, need to get a proxy for
- # thinpool interface too
+ def _create_thin_lv(self):
vg = self._vg_create().Vg
tp = self._create_lv(thinpool=True, vg=vg)
@@ -773,15 +768,20 @@ class TestDbusService(unittest.TestCase):
thin_path = self.handle_return(
tp.ThinPool.LvCreate(
dbus.String(lv_name),
- dbus.UInt64(mib(8)),
+ dbus.UInt64(mib(10)),
dbus.Int32(g_tmo),
EOD)
)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), thin_path)
lv = ClientProxy(self.bus, thin_path,
- interfaces=(LV_COMMON_INT, LV_INT))
+ interfaces=(LV_COMMON_INT, LV_INT))
+ return vg, thin_path, lv
+ # noinspection PyUnresolvedReferences
+ def test_lv_on_thin_pool_rename(self):
+ # Rename a LV on a thin Pool
+ vg, thin_path, lv = self._create_thin_lv()
re_named = 'rename_test' + lv.LvCommon.Name
rc = self.handle_return(
lv.Lv.Rename(
@@ -1445,21 +1445,7 @@ class TestDbusService(unittest.TestCase):
def test_snapshot_merge_thin(self):
# Create a thin LV, snapshot it and merge it
- vg = self._vg_create().Vg
- tp = self._create_lv(thinpool=True, vg=vg)
- lv_name = lv_n('_thin_lv')
-
- thin_path = self.handle_return(
- tp.ThinPool.LvCreate(
- dbus.String(lv_name),
- dbus.UInt64(mib(10)),
- dbus.Int32(g_tmo),
- EOD))
-
- self._validate_lookup("%s/%s" % (vg.Name, lv_name), thin_path)
-
- lv_p = ClientProxy(self.bus, thin_path,
- interfaces=(LV_INT, LV_COMMON_INT))
+ _vg, _thin_path, lv_p = self._create_thin_lv()
ss_name = lv_p.LvCommon.Name + '_snap'
snapshot_path = self.handle_return(
4 years, 5 months
master - lvmdbustest.py: Add func. _all_pv_object_paths
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a4666f63ade186e960c...
Commit: a4666f63ade186e960c5f70399389e0d2fb28c81
Parent: b8d496911765ec07f80eee174623e503506e7401
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Oct 3 15:25:17 2019 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: Add func. _all_pv_object_paths
This is needed in a number of places.
---
test/dbus/lvmdbustest.py | 67 ++++++++++-----------------------------------
1 files changed, 15 insertions(+), 52 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 1ab4ce6..d3e1f53 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -356,11 +356,7 @@ class TestDbusService(unittest.TestCase):
data_name = "data_r5"
if not vg:
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
-
- vg = self._vg_create(pv_paths).Vg
+ vg = self._vg_create(self._all_pv_object_paths()).Vg
lv_meta_path = self.handle_return(
vg.LvCreateRaid(
@@ -668,13 +664,12 @@ class TestDbusService(unittest.TestCase):
vg, LV_BASE_INT)
self._validate_lookup("%s/%s" % (vg.Name, lv_name), lv.object_path)
+ def _all_pv_object_paths(self):
+ return [pp.object_path for pp in self.objs[PV_INT]]
+
def test_lv_create_striped(self):
lv_name = lv_n()
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
-
- vg = self._vg_create(pv_paths).Vg
+ vg = self._vg_create(self._all_pv_object_paths()).Vg
lv = self._test_lv_create(
vg.LvCreateStriped,
(dbus.String(lv_name), dbus.UInt64(mib(4)),
@@ -685,11 +680,7 @@ class TestDbusService(unittest.TestCase):
def test_lv_create_mirror(self):
lv_name = lv_n()
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
-
- vg = self._vg_create(pv_paths).Vg
+ vg = self._vg_create(self._all_pv_object_paths()).Vg
lv = self._test_lv_create(
vg.LvCreateMirror,
(dbus.String(lv_name), dbus.UInt64(mib(4)), dbus.UInt32(2),
@@ -698,11 +689,7 @@ class TestDbusService(unittest.TestCase):
def test_lv_create_raid(self):
lv_name = lv_n()
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
-
- vg = self._vg_create(pv_paths).Vg
+ vg = self._vg_create(self._all_pv_object_paths()).Vg
lv = self._test_lv_create(
vg.LvCreateRaid,
(dbus.String(lv_name), dbus.String('raid5'), dbus.UInt64(mib(16)),
@@ -721,11 +708,7 @@ class TestDbusService(unittest.TestCase):
interfaces.append(THINPOOL_INT)
if not vg:
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
-
- vg = self._vg_create(pv_paths).Vg
+ vg = self._vg_create(self._all_pv_object_paths()).Vg
if size is None:
size = mib(4)
@@ -922,11 +905,7 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(lv.LvCommon.SizeBytes <= prev)
def test_lv_resize_same(self):
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
-
- vg = self._vg_create(pv_paths).Vg
+ vg = self._vg_create(self._all_pv_object_paths()).Vg
lv = self._create_lv(vg=vg)
with self.assertRaises(dbus.exceptions.DBusException):
@@ -1025,10 +1004,7 @@ class TestDbusService(unittest.TestCase):
self._check_consistency()
def test_job_handling(self):
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
-
+ pv_paths = self._all_pv_object_paths()
vg_name = vg_n()
# Test getting a job right away
@@ -1046,15 +1022,12 @@ class TestDbusService(unittest.TestCase):
def _test_expired_timer(self, num_lvs):
rc = False
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
# In small configurations lvm is pretty snappy, so lets create a VG
# add a number of LVs and then remove the VG and all the contained
# LVs which appears to consistently run a little slow.
- vg_proxy = self._vg_create(pv_paths)
+ vg_proxy = self._vg_create(self._all_pv_object_paths())
for i in range(0, num_lvs):
lv_name = lv_n()
@@ -1118,12 +1091,7 @@ class TestDbusService(unittest.TestCase):
def test_pv_tags(self):
pvs = []
-
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
-
- vg = self._vg_create(pv_paths).Vg
+ vg = self._vg_create(self._all_pv_object_paths()).Vg
# Get the PVs
for p in vg.Pvs:
@@ -1333,12 +1301,7 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(pv.SizeBytes == original_size)
def test_pv_allocation(self):
-
- pv_paths = []
- for pp in self.objs[PV_INT]:
- pv_paths.append(pp.object_path)
-
- vg = self._vg_create(pv_paths).Vg
+ vg = self._vg_create(self._all_pv_object_paths()).Vg
pv = ClientProxy(self.bus, vg.Pvs[0], interfaces=(PV_INT, )).Pv
@@ -1753,10 +1716,10 @@ class TestDbusService(unittest.TestCase):
vg_name = vg_n()
# Get all the PV device paths
- pv_paths = [p.Pv.Name for p in self.objs[PV_INT]]
+ pv_device_paths = [p.Pv.Name for p in self.objs[PV_INT]]
cmd = ['vgcreate', vg_name]
- cmd.extend(pv_paths)
+ cmd.extend(pv_device_paths)
self._verify_existence(cmd, cmd[0], vg_name)
def test_external_lv_create(self):
4 years, 5 months