master - raid: disallow reshape of stacked LVs
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7737ffb11ceba0f4220...
Commit: 7737ffb11ceba0f4220e1dfb79b8e97f20e7b8e9
Parent: dad2660a387ed32dc8146b497d279089c1ce48ed
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 13 17:27:24 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jan 13 17:42:31 2020 +0100
raid: disallow reshape of stacked LVs
Until we resolve reshape for 'stacked' devices, we need to disable it.
So users can no longer reshape i.e. thin-pool data volumes, causing
ATM bad thin-pool problems.
---
lib/metadata/raid_manip.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index a1c51aa..4855039 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6438,6 +6438,12 @@ int lv_raid_convert(struct logical_volume *lv,
uint32_t available_slvs, removed_slvs;
takeover_fn_t takeover_fn;
+ /* FIXME Can't reshape volume in use - aka not toplevel devices */
+ if (!dm_list_empty(&lv->segs_using_this_lv)) {
+ log_error("Can't reshape stacked volume %s.", display_lvname(lv));
+ return 0;
+ }
+
/* FIXME If not active, prompt and activate */
/* FIXME Some operations do not require the LV to be active */
/* LV must be active to perform raid conversion operations */
4 years, 3 months
stable-2.02 - WHATS_NEW: update
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=846ae8d49d74ac61c2c...
Commit: 846ae8d49d74ac61c2caed84c9720aedbe9867ae
Parent: c575c1c9ff71d95b6af0ec75798dd597491ca0b8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 13 17:37:29 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jan 13 17:41:44 2020 +0100
WHATS_NEW: update
---
WHATS_NEW | 2 ++
1 file changed, 2 insertions(+)
diff --git a/WHATS_NEW b/WHATS_NEW
index 047479b..c885a21 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.02.187 -
===================================
+ Avoid running cache input arg validation when creating vdo pool.
+ Prevent raid reshaping of stacked volumes.
Ensure minimum required region size on striped RaidLV creation.
Fix resize of thin-pool with data and metadata of different segtype.
Fix splitting mirror leg in cluster.
4 years, 3 months
stable-2.02 - vdo: avoid running initialization of cache pool vars
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c575c1c9ff71d95b6af...
Commit: c575c1c9ff71d95b6af0ec75798dd597491ca0b8
Parent: 36210c2b491424d7a0ab27d0a65effd6fc6ecc4c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 6 15:57:08 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jan 13 17:41:22 2020 +0100
vdo: avoid running initialization of cache pool vars
Since VDO is also pool, the old if() case missed to know about this,
and executed unnecesserily initialization of cache pool variables.
This was usually harmless when using 'smaller' sizes of VDO pools,
but for big VDO pool size, we were reporting senseless messages
about big cache chunk sizes.
---
tools/lvcreate.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index c27b798..4be8e03 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -395,13 +395,15 @@ static int _update_extents_params(struct volume_group *vg,
&lp->discards,
&lp->zero_new_blocks))
return_0;
- } else if (!update_cache_pool_params(vg->cmd, vg->profile, vg->extent_size,
- lp->segtype, lp->target_attr,
- lp->extents,
- &lp->pool_metadata_extents,
- &lp->thin_chunk_size_calc_policy,
- &lp->chunk_size))
- return_0;
+ } else if (segtype_is_cache_pool(lp->segtype) || segtype_is_cache(lp->segtype)) {
+ if (!update_cache_pool_params(vg->cmd, vg->profile, vg->extent_size,
+ lp->segtype, lp->target_attr,
+ lp->extents,
+ &lp->pool_metadata_extents,
+ &lp->thin_chunk_size_calc_policy,
+ &lp->chunk_size))
+ return_0;
+ }
if (lcp->percent == PERCENT_FREE || lcp->percent == PERCENT_PVS) {
if (lp->extents <= (2 * lp->pool_metadata_extents)) {
4 years, 3 months
stable-2.02 - raid: disallow reshape of stacked LVs
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=36210c2b491424d7a0a...
Commit: 36210c2b491424d7a0ab27d0a65effd6fc6ecc4c
Parent: 50c56ade2a7a89f751091669fb8b31854f93eff1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 13 17:27:24 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jan 13 17:41:22 2020 +0100
raid: disallow reshape of stacked LVs
Until we resolve reshape for 'stacked' devices, we need to disable it.
So users can no longer reshape i.e. thin-pool data volumes, causing
ATM bad thin-pool problems.
---
lib/metadata/raid_manip.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 9030261..548faf1 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6444,6 +6444,12 @@ int lv_raid_convert(struct logical_volume *lv,
uint32_t available_slvs, removed_slvs;
takeover_fn_t takeover_fn;
+ /* FIXME Can't reshape volume in use - aka not toplevel devices */
+ if (!dm_list_empty(&lv->segs_using_this_lv)) {
+ log_error("Can't reshape stacked volume %s.", display_lvname(lv));
+ return 0;
+ }
+
/* FIXME If not active, prompt and activate */
/* FIXME Some operations do not require the LV to be active */
/* LV must be active to perform raid conversion operations */
4 years, 3 months
master - WHATS_NEW: VDO lvmdbusd adds
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dad2660a387ed32dc81...
Commit: dad2660a387ed32dc8146b497d279089c1ce48ed
Parent: c496ba6505dda29bb1fb48b326cfd959ab0facd4
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Jan 9 13:11:41 2020 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Jan 9 13:11:41 2020 -0600
WHATS_NEW: VDO lvmdbusd adds
---
WHATS_NEW | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ec41e54..b3c6102 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.03.08 -
====================================
+ Added VDO lvmdbusd methods for enable/disable compression & dedupe.
+ Added VDO lvmdbusd method for converting LV to VDO pool.
Version 2.03.07 - 30th November 2019
====================================
4 years, 3 months
master - lvmdbusd: Add function to convert LV into a VDO pool
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c496ba6505dda29bb1f...
Commit: c496ba6505dda29bb1fb48b326cfd959ab0facd4
Parent: c3ef41f620418bc9d5932fc6f7284a600e6cebec
Author: Vojtech Trefny <vtrefny(a)redhat.com>
AuthorDate: Mon Jan 6 11:28:41 2020 +0100
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Jan 9 13:07:55 2020 -0600
lvmdbusd: Add function to convert LV into a VDO pool
---
daemons/lvmdbusd/cmdhandler.py | 8 ++++++++
daemons/lvmdbusd/vg.py | 32 ++++++++++++++++++++++++++++++++
test/dbus/lvmdbustest.py | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index aa5199f..7d2f4c4 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -398,6 +398,14 @@ def vg_create_vdo_pool_lv_and_lv(vg_name, pool_name, lv_name, data_size,
return call(cmd)
+def vg_create_vdo_pool(pool_full_name, lv_name, virtual_size, create_options):
+ cmd = ['lvconvert']
+ cmd.extend(options_to_cli_args(create_options))
+ cmd.extend(['--type', 'vdo-pool', '-n', lv_name, '--force', '-y',
+ '-V', '%dB' % virtual_size, pool_full_name])
+ return call(cmd)
+
+
def lv_remove(lv_path, remove_options):
cmd = ['lvremove']
cmd.extend(options_to_cli_args(remove_options))
diff --git a/daemons/lvmdbusd/vg.py b/daemons/lvmdbusd/vg.py
index 789626c..51fd07e 100644
--- a/daemons/lvmdbusd/vg.py
+++ b/daemons/lvmdbusd/vg.py
@@ -813,3 +813,35 @@ class VgVdo(Vg):
round_size(virtual_size),
create_options), cb, cbe)
cfg.worker_q.put(r)
+
+ @staticmethod
+ def _vdo_pool_create(uuid, vg_name, pool_lv, name, virtual_size, create_options):
+ Vg.validate_dbus_object(uuid, vg_name)
+
+ # Retrieve the full name of the pool lv
+ pool = cfg.om.get_object_by_path(pool_lv)
+ if not pool:
+ msg = 'LV with object path %s not present!' % \
+ (pool_lv)
+ raise dbus.exceptions.DBusException(VG_VDO_INTERFACE, msg)
+
+ Vg.handle_execute(*cmdhandler.vg_create_vdo_pool(
+ pool.lv_full_name(), name, virtual_size,
+ create_options))
+ return Vg.fetch_new_lv(vg_name, pool.Name)
+
+ @dbus.service.method(
+ dbus_interface=VG_VDO_INTERFACE,
+ in_signature='ostia{sv}',
+ out_signature='(oo)',
+ async_callbacks=('cb', 'cbe'))
+ def CreateVdoPool(self, pool_lv, name, virtual_size,
+ tmo, create_options, cb, cbe):
+ utils.validate_lv_name(VG_VDO_INTERFACE, self.Name, name)
+
+ r = RequestEntry(tmo, VgVdo._vdo_pool_create,
+ (self.state.Uuid, self.state.lvm_id,
+ pool_lv, name,
+ round_size(virtual_size),
+ create_options), cb, cbe)
+ cfg.worker_q.put(r)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index b819a04..8753e65 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1903,6 +1903,44 @@ class TestDbusService(unittest.TestCase):
vg, _, _ = self._create_vdo_pool_and_lv()
self.handle_return(vg.Vg.Remove(dbus.Int32(g_tmo), EOD))
+ def _create_vdo_pool(self):
+ pool_name = lv_n('_vdo_pool')
+ lv_name = lv_n('_vdo_data')
+ vg_proxy = self._vg_create(vg_prefix="vdo_conv_")
+ lv = self._test_lv_create(
+ vg_proxy.Vg.LvCreate,
+ (dbus.String(pool_name), dbus.UInt64(mib(4096)),
+ dbus.Array([], signature='(ott)'), dbus.Int32(g_tmo),
+ EOD), vg_proxy.Vg, LV_BASE_INT)
+ lv_obj_path = self._lookup("%s/%s" % (vg_proxy.Vg.Name, pool_name))
+ self.assertNotEqual(lv_obj_path, "/")
+
+ vdo_pool_path = self.handle_return(
+ vg_proxy.VgVdo.CreateVdoPool(
+ dbus.ObjectPath(lv.object_path), lv_name,
+ dbus.UInt64(mib(8192)),
+ dbus.Int32(g_tmo),
+ EOD))
+
+ self.assertNotEqual(vdo_pool_path, "/")
+ self.assertEqual(
+ vdo_pool_path,
+ self._lookup("%s/%s" % (vg_proxy.Vg.Name, pool_name)))
+ intf = [LV_COMMON_INT, LV_INT]
+ vdo_lv_obj_path = self._lookup("%s/%s" % (vg_proxy.Vg.Name, lv_name))
+ vdo_lv = ClientProxy(self.bus, vdo_lv_obj_path, interfaces=intf)
+ intf.append(VDOPOOL_INT)
+ vdo_pool_lv = ClientProxy(self.bus, vdo_pool_path, interfaces=intf)
+ return vg_proxy, vdo_pool_lv, vdo_lv
+
+ def test_vdo_pool_convert(self):
+ # Basic vdo sanity testing
+ if not self.vdo:
+ raise unittest.SkipTest('vdo not supported')
+
+ vg, _pool, _lv = self._create_vdo_pool()
+ self.handle_return(vg.Vg.Remove(dbus.Int32(g_tmo), EOD))
+
def test_vdo_pool_compression_deduplication(self):
if not self.vdo:
raise unittest.SkipTest('vdo not supported')
4 years, 3 months
master - lvmdbusd: Add VDO enable/disable compress & dedup
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c3ef41f620418bc9d59...
Commit: c3ef41f620418bc9d5932fc6f7284a600e6cebec
Parent: 87e88078c993a149af6d2f104998c508b7aee9be
Author: Vojtech Trefny <vtrefny(a)redhat.com>
AuthorDate: Fri Dec 27 15:29:15 2019 +0100
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Jan 9 13:07:47 2020 -0600
lvmdbusd: Add VDO enable/disable compress & dedup
Added methods to vdo pool interface to allow enabling and
disabling of VDO:
* Compression
* Deduplication
---
daemons/lvmdbusd/cmdhandler.py | 22 +++++++++++++
daemons/lvmdbusd/lv.py | 66 ++++++++++++++++++++++++++++++++++++++++
test/dbus/lvmdbustest.py | 32 ++++++++++++++++++-
3 files changed, 118 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index e0bb105..aa5199f 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -460,6 +460,28 @@ def lv_detach_cache(lv_full_name, detach_options, destroy_cache):
return call(cmd)
+def lv_vdo_compression(lv_path, enable, comp_options):
+ cmd = ['lvchange', '--compression']
+ if enable:
+ cmd.append('y')
+ else:
+ cmd.append('n')
+ cmd.extend(options_to_cli_args(comp_options))
+ cmd.append(lv_path)
+ return call(cmd)
+
+
+def lv_vdo_deduplication(lv_path, enable, dedup_options):
+ cmd = ['lvchange', '--deduplication']
+ if enable:
+ cmd.append('y')
+ else:
+ cmd.append('n')
+ cmd.extend(options_to_cli_args(dedup_options))
+ cmd.append(lv_path)
+ return call(cmd)
+
+
def supports_json():
cmd = ['help']
rc, out, err = call(cmd)
diff --git a/daemons/lvmdbusd/lv.py b/daemons/lvmdbusd/lv.py
index 3018749..fd46f34 100644
--- a/daemons/lvmdbusd/lv.py
+++ b/daemons/lvmdbusd/lv.py
@@ -780,6 +780,72 @@ class LvVdoPool(Lv):
def DataLv(self):
return dbus.ObjectPath(self._data_lv)
+ @staticmethod
+ def _enable_disable_compression(pool_uuid, pool_name, enable, comp_options):
+ # Make sure we have a dbus object representing it
+ LvCommon.validate_dbus_object(pool_uuid, pool_name)
+ # Rename the logical volume
+ LvCommon.handle_execute(*cmdhandler.lv_vdo_compression(
+ pool_name, enable, comp_options))
+ return '/'
+
+ @dbus.service.method(
+ dbus_interface=VDO_POOL_INTERFACE,
+ in_signature='ia{sv}',
+ out_signature='o',
+ async_callbacks=('cb', 'cbe'))
+ def EnableCompression(self, tmo, comp_options, cb, cbe):
+ r = RequestEntry(
+ tmo, LvVdoPool._enable_disable_compression,
+ (self.Uuid, self.lvm_id, True, comp_options),
+ cb, cbe, False)
+ cfg.worker_q.put(r)
+
+ @dbus.service.method(
+ dbus_interface=VDO_POOL_INTERFACE,
+ in_signature='ia{sv}',
+ out_signature='o',
+ async_callbacks=('cb', 'cbe'))
+ def DisableCompression(self, tmo, comp_options, cb, cbe):
+ r = RequestEntry(
+ tmo, LvVdoPool._enable_disable_compression,
+ (self.Uuid, self.lvm_id, False, comp_options),
+ cb, cbe, False)
+ cfg.worker_q.put(r)
+
+ @staticmethod
+ def _enable_disable_deduplication(pool_uuid, pool_name, enable, dedup_options):
+ # Make sure we have a dbus object representing it
+ LvCommon.validate_dbus_object(pool_uuid, pool_name)
+ # Rename the logical volume
+ LvCommon.handle_execute(*cmdhandler.lv_vdo_deduplication(
+ pool_name, enable, dedup_options))
+ return '/'
+
+ @dbus.service.method(
+ dbus_interface=VDO_POOL_INTERFACE,
+ in_signature='ia{sv}',
+ out_signature='o',
+ async_callbacks=('cb', 'cbe'))
+ def EnableDeduplication(self, tmo, dedup_options, cb, cbe):
+ r = RequestEntry(
+ tmo, LvVdoPool._enable_disable_deduplication,
+ (self.Uuid, self.lvm_id, True, dedup_options),
+ cb, cbe, False)
+ cfg.worker_q.put(r)
+
+ @dbus.service.method(
+ dbus_interface=VDO_POOL_INTERFACE,
+ in_signature='ia{sv}',
+ out_signature='o',
+ async_callbacks=('cb', 'cbe'))
+ def DisableDeduplication(self, tmo, dedup_options, cb, cbe):
+ r = RequestEntry(
+ tmo, LvVdoPool._enable_disable_deduplication,
+ (self.Uuid, self.lvm_id, False, dedup_options),
+ cb, cbe, False)
+ cfg.worker_q.put(r)
+
# noinspection PyPep8Naming
class LvThinPool(Lv):
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 8215968..b819a04 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1858,11 +1858,11 @@ 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):
+ def _create_vdo_pool_and_lv(self, vg_prefix="vdo_"):
pool_name = lv_n("_vdo_pool")
lv_name = lv_n()
- vg_proxy = self._vg_create(vg_prefix="vdo_")
+ vg_proxy = self._vg_create(vg_prefix=vg_prefix)
vdo_pool_object_path = self.handle_return(
vg_proxy.VgVdo.CreateVdoPoolandLv(
pool_name, lv_name,
@@ -1903,6 +1903,34 @@ class TestDbusService(unittest.TestCase):
vg, _, _ = self._create_vdo_pool_and_lv()
self.handle_return(vg.Vg.Remove(dbus.Int32(g_tmo), EOD))
+ def test_vdo_pool_compression_deduplication(self):
+ if not self.vdo:
+ raise unittest.SkipTest('vdo not supported')
+
+ vg, pool, _lv = self._create_vdo_pool_and_lv(vg_prefix="vdo2_")
+
+ # compression and deduplication should be enabled by default
+ self.assertEqual(pool.VdoPool.Compression, "enabled")
+ self.assertEqual(pool.VdoPool.Deduplication, "enabled")
+
+ self.handle_return(
+ pool.VdoPool.DisableCompression(dbus.Int32(g_tmo), EOD))
+ self.handle_return(
+ pool.VdoPool.DisableDeduplication(dbus.Int32(g_tmo), EOD))
+ pool.update()
+ self.assertEqual(pool.VdoPool.Compression, "")
+ self.assertEqual(pool.VdoPool.Deduplication, "")
+
+ self.handle_return(
+ pool.VdoPool.EnableCompression(dbus.Int32(g_tmo), EOD))
+ self.handle_return(
+ pool.VdoPool.EnableDeduplication(dbus.Int32(g_tmo), EOD))
+ pool.update()
+ self.assertEqual(pool.VdoPool.Compression, "enabled")
+ self.assertEqual(pool.VdoPool.Deduplication, "enabled")
+
+ self.handle_return(vg.Vg.Remove(dbus.Int32(g_tmo), EOD))
+
def _test_lv_method_interface(self, lv):
self._rename_lv_test(lv)
self._test_activate_deactivate(lv)
4 years, 3 months