summaryrefslogtreecommitdiff
path: root/tools/commands.h
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-02-16 14:15:24 -0600
committerDavid Teigland <teigland@redhat.com>2016-02-25 09:14:09 -0600
commit71671778ab0b2ae4f9f014b37372939b00e90e1d (patch)
tree403db711dc2ad5d6a1eb6b08f2db4574c4654887 /tools/commands.h
parentff2267012aea37e08ed1fc2a511f8a0d3f0d145b (diff)
downloadlvm2-71671778ab0b2ae4f9f014b37372939b00e90e1d.tar.gz
toollib: add two phase pv processing code
This is common code for handling PV create/remove that can be shared by pvcreate/vgcreate/vgextend/pvremove. This does not change any commands to use the new code. - Pull out the hidden equivalent of process_each_pv into an actual top level process_each_pv. - Pull the prompts to the top level, and do not run any prompts while locks are held. The orphan lock is reacquired after any prompts are done, and the devices being created are checked for any change made while the lock was not held. Previously, pvcreate_vol() was the shared function for creating a PV for pvcreate, vgcreate, vgextend. Now, it will be toollib function pvcreate_each_device(). pvcreate_vol() was called effectively as a helper, from within vgcreate and vgextend code paths. pvcreate_each_device() will be called at the same level as other process_each functions. One of the main problems with pvcreate_vol() is that it included a hidden equivalent of process_each_pv for each device being created: pvcreate_vol() -> _pvcreate_check() -> find_pv_by_name() -> get_pvs() -> get_pvs_internal() -> _get_pvs() -> get_vgids() -> /* equivalent to process_each_pv */ dm_list_iterate_items(vgids) vg = vg_read_internal() dm_list_iterate_items(&vg->pvs) pvcreate_each_device() reorganizes the code so that each-VG-each-PV loop is done once, and uses the standard process_each_pv function at the top level of the function.
Diffstat (limited to 'tools/commands.h')
-rw-r--r--tools/commands.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/commands.h b/tools/commands.h
index 07485688a..fcd2c240a 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -766,7 +766,7 @@ xx(pvck,
xx(pvcreate,
"Initialize physical volume(s) for use by LVM",
- 0,
+ ENABLE_ALL_DEVS,
"pvcreate\n"
"\t[--norestorefile]\n"
"\t[--restorefile file]\n"
@@ -1119,7 +1119,7 @@ xx(vgconvert,
xx(vgcreate,
"Create a volume group",
- 0,
+ MUST_USE_ALL_ARGS | ENABLE_ALL_DEVS,
"vgcreate\n"
"\t[-A|--autobackup {y|n}]\n"
"\t[--addtag Tag]\n"
@@ -1214,7 +1214,7 @@ xx(vgexport,
xx(vgextend,
"Add physical volumes to a volume group",
- 0,
+ MUST_USE_ALL_ARGS | ENABLE_ALL_DEVS,
"vgextend\n"
"\t[-A|--autobackup y|n]\n"
"\t[--restoremissing]\n"