Skip to contentSkip to conversation

master - toollib: Split --cachesettings from --cachepolicy.

PATCH Petr Rockai 1 participant 1 message Nov 20, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4b9b8e12825d5611d3b8d73aa8e381a4caffff5a
Commit:        4b9b8e12825d5611d3b8d73aa8e381a4caffff5a
Parent:        310beb73a8a2d3a6ed7a28a3346306be82bbc533
Author:        Petr Rockai <[email protected]>
AuthorDate:    Thu Nov 20 11:30:19 2014 +0100
Committer:     Petr Rockai <[email protected]>
CommitterDate: Thu Nov 20 16:51:07 2014 +0100

toollib: Split --cachesettings from --cachepolicy.

---
 test/shell/lvchange-cache.sh |    7 +++--
 tools/args.h                 |    3 +-
 tools/commands.h             |    4 +-
 tools/lvchange.c             |    3 +-
 tools/toollib.c              |   53 +++++++++++++++++++++--------------------
 5 files changed, 37 insertions(+), 33 deletions(-)
test/shell/lvchange-cache.sh +4 -3
index e790cbb..997b770 100644
@@ -18,9 +18,10 @@ lvcreate --type cache-pool -an -v -L 2 -n cpool $vg
 lvcreate -H -L 4 -n corigin --cachepool $vg/cpool
 lvcreate -n noncache -l 1 $vg
 
-not lvchange --cachepolicy policy=mq $vg/noncache
+not lvchange --cachepolicy mq $vg/noncache
+not lvchange --cachesettings foo=bar $vg/noncache
 
-lvchange --cachepolicy policy=mq --cachepolicy migration_threshold=333 $vg/corigin
+lvchange --cachepolicy mq --cachesettings migration_threshold=333 $vg/corigin
 dmsetup status | grep $vg-corigin | grep 'migration_threshold 333'
 lvchange --refresh $vg/corigin
 dmsetup status | grep $vg-corigin | grep 'migration_threshold 333'
@@ -28,7 +29,7 @@ lvchange -an $vg
 lvchange -ay $vg
 dmsetup status | grep $vg-corigin | grep 'migration_threshold 333'
 
-lvchange --cachepolicy 'migration_threshold = 233 sequential_threshold = 13' $vg/corigin
+lvchange --cachesettings 'migration_threshold = 233 sequential_threshold = 13' $vg/corigin
 dmsetup status | grep $vg-corigin | grep 'migration_threshold 233'
 dmsetup status | grep $vg-corigin | grep 'sequential_threshold 13'
 
tools/args.h +2 -1
index 63fee14..1abe0eb 100644
@@ -104,7 +104,8 @@ arg(trustcache_ARG, '\0', "trustcache", NULL, 0)
 arg(type_ARG, '\0', "type", segtype_arg, 0)
 arg(unbuffered_ARG, '\0', "unbuffered", NULL, 0)
 arg(uncache_ARG, '\0', "uncache", NULL, 0)
-arg(cachepolicy_ARG, '\0', "cachepolicy", string_arg, ARG_GROUPABLE)
+arg(cachepolicy_ARG, '\0', "cachepolicy", string_arg, 0)
+arg(cachesettings_ARG, '\0', "cachesettings", string_arg, ARG_GROUPABLE)
 arg(units_ARG, '\0', "units", string_arg, 0)
 arg(unquoted_ARG, '\0', "unquoted", NULL, 0)
 arg(use_policies_ARG, '\0', "use-policies", NULL, 0)
tools/commands.h +2 -2
index e3bac1f..4765923 100644
@@ -106,7 +106,7 @@ xx(lvchange,
    "\t[--addtag Tag]\n"
    "\t[--alloc AllocationPolicy]\n"
    "\t[-C|--contiguous y|n]\n"
-   "\t[--cachepolicy policy=type] [--cachepolicy parameter=value]\n"
+   "\t[--cachepolicy policyname] [--cachesettings parameter=value]\n"
    "\t[--commandprofile ProfileName]\n"
    "\t[-d|--debug]\n"
    "\t[--deltag Tag]\n"
@@ -144,7 +144,7 @@ xx(lvchange,
 
    activationmode_ARG, addtag_ARG, alloc_ARG, autobackup_ARG, activate_ARG,
    available_ARG,
-   cachepolicy_ARG, contiguous_ARG, deltag_ARG, discards_ARG, detachprofile_ARG, force_ARG,
+   cachepolicy_ARG, cachesettings_ARG, contiguous_ARG, deltag_ARG, discards_ARG, detachprofile_ARG, force_ARG,
    ignorelockingfailure_ARG, ignoremonitoring_ARG, ignoreactivationskip_ARG,
    ignoreskippedcluster_ARG, major_ARG, metadataprofile_ARG, minor_ARG,
    monitor_ARG, minrecoveryrate_ARG, maxrecoveryrate_ARG, noudevsync_ARG,
tools/lvchange.c +2 -1
index 144295b..d9003b4 100644
@@ -1014,7 +1014,7 @@ static int _lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
 		docmds++;
 	}
 
-	if (arg_count(cmd, cachepolicy_ARG)) {
+	if (arg_count(cmd, cachepolicy_ARG) || arg_count(cmd, cachesettings_ARG)) {
 		if (!archive(lv->vg))
 			return_ECMD_FAILED;
 		doit += lvchange_cachepolicy(cmd, lv);
@@ -1081,6 +1081,7 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
 		arg_count(cmd, resync_ARG) ||
 		arg_count(cmd, syncaction_ARG) ||
 		arg_count(cmd, cachepolicy_ARG) ||
+		arg_count(cmd, cachesettings_ARG) ||
 		arg_count(cmd, writebehind_ARG) ||
 		arg_count(cmd, writemostly_ARG) ||
 		arg_count(cmd, zero_ARG);
tools/toollib.c +26 -25

82 lines not on this page · raw message