Skip to contentSkip to conversation

master - lvmdbusd: Add VgVdo class & assoc. interface

PATCH Tony Asleson 1 participant 1 message Oct 30, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6204955347b2d57ded9e6385aa5118392e182a48
Commit:        6204955347b2d57ded9e6385aa5118392e182a48
Parent:        9d2ef05c5d0b57139d8405a2af947091f2c13942
Author:        Tony Asleson <[email protected]>
AuthorDate:    Mon Oct 7 16:58:10 2019 -0500
Committer:     Tony Asleson <[email protected]>
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(-)
daemons/lvmdbusd/cfg.py +1 -0
index 13143ef..b11d9f8 100644
@@ -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'
daemons/lvmdbusd/cmdhandler.py +20 -0
index f7f6acd..137027b 100644
@@ -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',
daemons/lvmdbusd/vg.py +43 -3

67 lines not on this page · raw message