1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

pvcreate: call label scan prior to pvcreate_each_device

and don't call it from inside pvcreate_each_device.
This avoids having to repeat it for users of
pvcreate_each_device (pvcreate/pvremove/vgcreate/vgextend.)
This commit is contained in:
David Teigland 2019-04-30 14:10:27 -05:00
parent 6d0f09f478
commit 366c1ac15b
4 changed files with 10 additions and 11 deletions

View File

@ -145,6 +145,8 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
clear_hint_file(cmd);
lvmcache_label_scan(cmd);
if (!(handle = init_processing_handle(cmd, NULL))) {
log_error("Failed to initialize processing handle.");
return ECMD_FAILED;
@ -152,9 +154,8 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
if (!pvcreate_each_device(cmd, handle, &pp))
ret = ECMD_FAILED;
else {
else
ret = ECMD_PROCESSED;
}
destroy_processing_handle(cmd, handle);
return ret;

View File

@ -45,6 +45,8 @@ int pvremove(struct cmd_context *cmd, int argc, char **argv)
clear_hint_file(cmd);
lvmcache_label_scan(cmd);
/* When forcibly clearing a PV we don't care about a VG lock. */
if (pp.force == DONT_PROMPT_OVERRIDE)
cmd->lockd_vg_disable = 1;

View File

@ -2243,7 +2243,8 @@ int process_each_vg(struct cmd_context *cmd,
* Scan all devices to populate lvmcache with initial
* list of PVs and VGs.
*/
lvmcache_label_scan(cmd);
if (!(read_flags & PROCESS_SKIP_SCAN))
lvmcache_label_scan(cmd);
/*
* A list of all VGs on the system is needed when:
@ -5326,13 +5327,6 @@ int pvcreate_each_device(struct cmd_context *cmd,
dm_list_add(&pp->arg_devices, &pd->list);
}
/*
* Scan before calling process_each_pv so we can set up the PV args
* first. We can then skip the scan that would normally occur at the
* beginning of process_each_pv.
*/
lvmcache_label_scan(cmd);
/*
* Translate arg names into struct device's.
*/

View File

@ -162,6 +162,8 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
clear_hint_file(cmd);
lvmcache_label_scan(cmd);
if (!(handle = init_processing_handle(cmd, NULL))) {
log_error("Failed to initialize processing handle.");
return ECMD_FAILED;
@ -185,7 +187,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
handle->custom_handle = &vp;
ret = process_each_vg(cmd, 0, NULL, vg_name, NULL,
READ_FOR_UPDATE, 0, handle,
READ_FOR_UPDATE | PROCESS_SKIP_SCAN, 0, handle,
restoremissing ? &_vgextend_restoremissing : &_vgextend_single);
destroy_processing_handle(cmd, handle);