summaryrefslogtreecommitdiff
path: root/tools/lvmcmdline.c
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2014-07-09 22:56:11 -0500
committerJonathan Brassow <jbrassow@redhat.com>2014-07-09 22:56:11 -0500
commitbe75076dfc842945a03fa42073e9e03f51bd3a3c (patch)
tree48cbd4796909f8f92f0da27cf46028facd5bd9b2 /tools/lvmcmdline.c
parenta098cba0ebbd0682570cff2fc756a59533321f03 (diff)
downloadlvm2-be75076dfc842945a03fa42073e9e03f51bd3a3c.tar.gz
activation: Add "degraded" activation mode
Currently, we have two modes of activation, an unnamed nominal mode (which I will refer to as "complete") and "partial" mode. The "complete" mode requires that a volume group be 'complete' - that is, no missing PVs. If there are any missing PVs, no affected LVs are allowed to activate - even RAID LVs which might be able to tolerate a failure. The "partial" mode allows anything to be activated (or at least attempted). If a non-redundant LV is missing a portion of its addressable space due to a device failure, it will be replaced with an error target. RAID LVs will either activate or fail to activate depending on how badly their redundancy is compromised. This patch adds a third option, "degraded" mode. This mode can be selected via the '--activationmode {complete|degraded|partial}' option to lvchange/vgchange. It can also be set in lvm.conf. The "degraded" activation mode allows RAID LVs with a sufficient level of redundancy to activate (e.g. a RAID5 LV with one device failure, a RAID6 with two device failures, or RAID1 with n-1 failures). RAID LVs with too many device failures are not allowed to activate - nor are any non-redundant LVs that may have been affected. This patch also makes the "degraded" mode the default activation mode. The degraded activation mode does not yet work in a cluster. A new cluster lock flag (LCK_DEGRADED_MODE) will need to be created to make that work. Currently, there is limited space for this extra flag and I am looking for possible solutions. One possible solution is to usurp LCK_CONVERT, as it is not used. When the locking_type is 3, the degraded mode flag simply gets dropped and the old ("complete") behavior is exhibited.
Diffstat (limited to 'tools/lvmcmdline.c')
-rw-r--r--tools/lvmcmdline.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 780e9d0a5..fc51c4a7a 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -866,6 +866,8 @@ int version(struct cmd_context *cmd __attribute__((unused)),
static int _get_settings(struct cmd_context *cmd)
{
+ const char *activation_mode;
+
cmd->current_settings = cmd->default_settings;
if (arg_count(cmd, debug_ARG))
@@ -903,10 +905,34 @@ static int _get_settings(struct cmd_context *cmd)
}
cmd->partial_activation = 0;
+ cmd->degraded_activation = 0;
+ activation_mode = find_config_tree_str(cmd, activation_mode_CFG, NULL);
+ if (!activation_mode)
+ activation_mode = DEFAULT_ACTIVATION_MODE;
+
+ if (arg_count(cmd, activationmode_ARG)) {
+ activation_mode = arg_str_value(cmd, activationmode_ARG,
+ activation_mode);
+
+ /* complain only if the two arguments conflict */
+ if (arg_count(cmd, partial_ARG) &&
+ strcmp(activation_mode, "partial")) {
+ log_error("--partial and --activationmode are mutually"
+ " exclusive arguments");
+ return EINVALID_CMD_LINE;
+ }
+ } else if (arg_count(cmd, partial_ARG))
+ activation_mode = "partial";
- if (arg_count(cmd, partial_ARG)) {
+ if (!strcmp(activation_mode, "partial")) {
cmd->partial_activation = 1;
log_warn("PARTIAL MODE. Incomplete logical volumes will be processed.");
+ } else if (!strcmp(activation_mode, "degraded")) {
+ cmd->degraded_activation = 1;
+ log_debug("DEGRADED MODE. Incomplete RAID LVs will be processed.");
+ } else if (strcmp(activation_mode, "complete")) {
+ log_error("Invalid activation mode given.");
+ return EINVALID_CMD_LINE;
}
if (arg_count(cmd, ignorelockingfailure_ARG) || arg_count(cmd, sysinit_ARG))