summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2019-04-15 16:58:56 -0500
committerDavid Teigland <teigland@redhat.com>2019-04-15 16:58:56 -0500
commitabba3efe9e90618e554aae834efd287efc40d6f4 (patch)
tree1300ee091f763ae5e42c2562a5866ae8a65226c4
parentaa75b31db54782fb24b6b7e3c681a61b3579117c (diff)
downloadlvm2-abba3efe9e90618e554aae834efd287efc40d6f4.tar.gz
cachevol: allow activating attached cachevol
-rw-r--r--lib/metadata/metadata-exported.h1
-rw-r--r--tools/lvchange.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 0683d5f32..9f3f550b8 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -272,6 +272,7 @@
#define lv_is_component(lv) (lv_is_cache_origin(lv) || ((lv)->status & (\
CACHE_POOL_DATA |\
CACHE_POOL_METADATA |\
+ LV_CACHE_VOL |\
LV_VDO_POOL_DATA |\
MIRROR_IMAGE |\
MIRROR_LOG |\
diff --git a/tools/lvchange.c b/tools/lvchange.c
index ad5abddeb..e70001705 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1383,6 +1383,20 @@ static int _lvchange_activate_check(struct cmd_context *cmd,
struct processing_handle *handle,
int lv_is_named_arg)
{
+ int do_activate = is_change_activating((activation_change_t)arg_uint_value(cmd, activate_ARG, CHANGE_AY));
+
+ if (lv_is_cache_vol(lv) && lv_is_named_arg) {
+ if (!do_activate)
+ return 1;
+
+ if (arg_is_set(cmd, yes_ARG) ||
+ (yes_no_prompt("Do you want to activate component LV in read-only mode? [y/n]: ") == 'y')) {
+ log_print_unless_silent("Allowing activation of component LV.");
+ cmd->activate_component = 1;
+ }
+ return 1;
+ }
+
if (!lv_is_visible(lv) &&
!cmd->activate_component && /* activation of named component LV */
((first_seg(lv)->status & MERGING) || /* merging already started */