Skip to contentSkip to conversation

main - lvmdevices: allow deviceidtype with addpvid

PATCH David Teigland 1 participant 1 message Sep 13, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8935dfee56fe2cfb29152f0af2a4c4c32e62895b
Commit:        8935dfee56fe2cfb29152f0af2a4c4c32e62895b
Parent:        9857b5a3dc7b23295e47e04c5c338d189c3502d5
Author:        David Teigland <[email protected]>
AuthorDate:    Mon Sep 13 14:11:07 2021 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Mon Sep 13 14:11:07 2021 -0500

lvmdevices: allow deviceidtype with addpvid

in addition to using with adddev

---
 tools/command-lines.in | 1 +
 tools/lvmdevices.c     | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
tools/command-lines.in +1 -0
index 73a4c57f9..e63b2bcc3 100644
@@ -1439,6 +1439,7 @@ ID: lvmdevices_edit
 DESC: Remove a device from the devices file.
 
 lvmdevices --addpvid String
+OO: --deviceidtype String
 ID: lvmdevices_edit
 DESC: Find the device with the given PVID and add it to the devices file.
 
tools/lvmdevices.c +3 -2
index 367536d6a..8d9634848 100644
@@ -127,6 +127,7 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
 	struct device_list *devl;
 	struct device *dev;
 	struct dev_use *du, *du2;
+	const char *deviceidtype;
 	int changes = 0;
 
 	dm_list_init(&search_pvids);
@@ -269,7 +270,6 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
 
 	if (arg_is_set(cmd, adddev_ARG)) {
 		const char *devname;
-		const char *deviceidtype;
 
 		if (!(devname = arg_str_value(cmd, adddev_ARG, NULL)))
 			goto_bad;
@@ -366,7 +366,8 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
 			goto bad;
 		}
 		dm_list_iterate_items(devl, &found_devs) {
-			if (!device_id_add(cmd, devl->dev, devl->dev->pvid, NULL, NULL))
+			deviceidtype = arg_str_value(cmd, deviceidtype_ARG, NULL);
+			if (!device_id_add(cmd, devl->dev, devl->dev->pvid, deviceidtype, NULL))
 				goto_bad;
 		}
 		if (!device_ids_write(cmd))