summaryrefslogtreecommitdiff
path: root/tools/lvmcmdline.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lvmcmdline.c')
-rw-r--r--tools/lvmcmdline.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index d87a8f053..eab1405e8 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -17,6 +17,7 @@
#include "lvm2cmdline.h"
#include "lib/label/label.h"
+#include "lib/device/device_id.h"
#include "lvm-version.h"
#include "lib/locking/lvmlockd.h"
@@ -2420,7 +2421,7 @@ static int _get_current_settings(struct cmd_context *cmd)
/*
* enable_hints is set to 1 if any commands are using hints.
- * use_hints is set to 1 if this command doesn't use the hints.
+ * use_hints is set to 0 if this command doesn't use the hints.
* enable_hints=1 and use_hints=0 means that this command won't
* use the hints, but it may invalidate the hints that are used
* by other commands.
@@ -2436,6 +2437,10 @@ static int _get_current_settings(struct cmd_context *cmd)
else
cmd->use_hints = 0;
+ /* The hints file is associated with the default/system devices file. */
+ if (arg_is_set(cmd, devicesfile_ARG))
+ cmd->use_hints = 0;
+
if ((hint_mode = find_config_tree_str(cmd, devices_hints_CFG, NULL))) {
if (!strcmp(hint_mode, "none"))
cmd->enable_hints = 0;
@@ -2477,6 +2482,19 @@ static int _get_current_settings(struct cmd_context *cmd)
cmd->record_historical_lvs = find_config_tree_bool(cmd, metadata_record_lvs_history_CFG, NULL) ?
(arg_is_set(cmd, nohistory_ARG) ? 0 : 1) : 0;
+ if (arg_is_set(cmd, devicesfile_ARG)) {
+ const char *devices_file = arg_str_value(cmd, devicesfile_ARG, NULL);
+ if (devices_file && !strlen(devices_file)) {
+ cmd->devicesfile = "";
+ } else if (!devices_file || !validate_name(devices_file)) {
+ log_error("Invalid devices file name.");
+ return EINVALID_CMD_LINE;
+ } else if (!(cmd->devicesfile = dm_pool_strdup(cmd->libmem, devices_file))) {
+ log_error("Failed to copy devices file name.");
+ return EINVALID_CMD_LINE;
+ }
+ }
+
/*
* This is set to zero by process_each which wants to print errors
* itself rather than having them printed in vg_read.