main - vgchange -aay: improve unexpected command variations
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=024ce50f06feff2dae53dce83398911bef071a6e Commit: 024ce50f06feff2dae53dce83398911bef071a6e Parent: 14b68ea313865041433e18bac92a6dfcf6128b15 Author: David Teigland <[email protected]> AuthorDate: Mon Nov 8 11:30:25 2021 -0600 Committer: David Teigland <[email protected]> CommitterDate: Mon Nov 8 15:19:25 2021 -0600
vgchange -aay: improve unexpected command variations
For completeness and consistency, adjust the behavior for some variations of:
vgchange -aay --autoactivation event [vgname]
The current standard use is with a VG name arg, and the command is only called when all pvs_online files exist. This is the optimal case, in which only pvs_online devs are read. This remains the same.
Clean up behaviors for some other unexpected uses of the command:
. With no VG name arg, the command activates any VGs
that are complete according to pvs_online. If no pvs_online files exist, it does nothing.
. If a VG name is used but no PVs online files exist for
the VG, or the PVs online files are incomplete, then consider there could be a problem with the pvs_online files, and fall back to a full label scan prior to attempting the activation.
--- lib/device/dev-cache.c | 2 +- lib/device/online.c | 6 ++ lib/label/label.c | 48 +++++++++++----- lib/label/label.h | 4 +- test/shell/vgchange-pvs-online.sh | 112 +++++++++++++++++++++++++++++++------- tools/vgchange.c | 47 ++++++++++++++-- 6 files changed, 178 insertions(+), 41 deletions(-)
lib/device/dev-cache.c +1 -1
@@ -2164,7 +2164,7 @@ static char *_get_devname_from_devno(struct cmd_context *cmd, dev_t devno) }if (devname[0 ]) { -log_debug ("Found %s for %d:%d from sys" , devname, major, minor); +log_debug ("Found %s for %d:%d from sys dm" , devname, major, minor);return _strdup (devname); }return NULL ;
lib/device/online.c +6 -0
@@ -134,8 +134,12 @@ int get_pvs_online(struct dm_list *pvs_online, const char *vgname)dm_list_add (pvs_online, &po->list); } +if (closedir (dir))log_sys_debug ("closedir" ,PVS_ONLINE_DIR ); + +log_debug ("PVs online found %d for %s" ,dm_list_size (pvs_online), vgname ?:"all" ); +return 1 ; }
@@ -355,6 +359,8 @@ int get_pvs_lookup(struct dm_list *pvs_online, const char *vgname)dm_list_add (pvs_online, &po->list); } +log_debug ("PVs online lookup found %d for %s" ,dm_list_size (pvs_online), vgname); +fclose (fp);return 1 ;
lib/label/label.c +33 -15
84 lines not on this page · raw message
lib/label/label.h +3 -1
@@ -118,7 +118,9 @@ int label_scan_open_excl(struct device *dev);int label_scan_open_rw (struct device *dev);int label_scan_reopen_rw (struct device *dev);int label_read_pvid (struct device *dev,int *has_pvid); -int label_scan_vg_online (struct cmd_context *cmd,const char *vgname); +int label_scan_vg_online (struct cmd_context *cmd,const char *vgname, +int *found_none,int *found_all,int *found_incomplete); +int label_scan_for_pvid (struct cmd_context *cmd,char *pvid,struct device **dev_out);
test/shell/vgchange-pvs-online.sh +93 -19
154 lines not on this page · raw message
tools/vgchange.c +42 -5
63 lines not on this page · raw message