mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-24 17:57:48 +03:00
Add implicit pvcreate support to vgcreate and vgextend.
Adds implicit pvcreate support when calling vgcreate or vgextend with device paths that are not yet PVs. This changes the behavior of vgcreate and vgextend from failing with an error message to implicitly pvcreating.
This commit is contained in:
parent
f900ba63fa
commit
2e201936e4
@ -757,7 +757,9 @@ xx(vgcreate,
|
||||
"\tVolumeGroupName PhysicalVolume [PhysicalVolume...]\n",
|
||||
|
||||
addtag_ARG, alloc_ARG, autobackup_ARG, clustered_ARG, maxlogicalvolumes_ARG,
|
||||
maxphysicalvolumes_ARG, metadatatype_ARG, physicalextentsize_ARG, test_ARG)
|
||||
maxphysicalvolumes_ARG, metadatatype_ARG, physicalextentsize_ARG, test_ARG,
|
||||
force_ARG, yes_ARG, zero_ARG, labelsector_ARG, metadatasize_ARG,
|
||||
metadatacopies_ARG, dataalignment_ARG, dataalignmentoffset_ARG)
|
||||
|
||||
xx(vgdisplay,
|
||||
"Display volume group information",
|
||||
@ -820,7 +822,10 @@ xx(vgextend,
|
||||
"\t[--version]" "\n"
|
||||
"\tVolumeGroupName PhysicalDevicePath [PhysicalDevicePath...]\n",
|
||||
|
||||
autobackup_ARG, test_ARG)
|
||||
autobackup_ARG, test_ARG,
|
||||
force_ARG, yes_ARG, zero_ARG, labelsector_ARG, metadatatype_ARG,
|
||||
metadatasize_ARG, metadatacopies_ARG, dataalignment_ARG,
|
||||
dataalignmentoffset_ARG)
|
||||
|
||||
xx(vgimport,
|
||||
"Register exported volume group with system",
|
||||
|
@ -23,6 +23,7 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
|
||||
const char *tag;
|
||||
const char *clustered_message = "";
|
||||
char *vg_name;
|
||||
struct pvcreate_params pp;
|
||||
|
||||
if (!argc) {
|
||||
log_error("Please provide volume group name and "
|
||||
@ -34,8 +35,8 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
if (argc == 0) {
|
||||
log_error("Please enter physical volume name(s)");
|
||||
fill_default_pvcreate_params(&pp);
|
||||
if (!pvcreate_validate_params(cmd, argc, argv, &pp)) {
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
|
||||
}
|
||||
|
||||
/* attach the pv's */
|
||||
if (!vg_extend(vg, argc, argv, NULL))
|
||||
if (!vg_extend(vg, argc, argv, &pp))
|
||||
goto_bad;
|
||||
|
||||
if (vp_new.max_lv != vg->max_lv)
|
||||
|
@ -20,6 +20,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
|
||||
char *vg_name;
|
||||
struct volume_group *vg = NULL;
|
||||
int r = ECMD_FAILED;
|
||||
struct pvcreate_params pp;
|
||||
|
||||
if (!argc) {
|
||||
log_error("Please enter volume group name and "
|
||||
@ -31,8 +32,8 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
if (argc == 0) {
|
||||
log_error("Please enter physical volume(s)");
|
||||
fill_default_pvcreate_params(&pp);
|
||||
if (!pvcreate_validate_params(cmd, argc, argv, &pp)) {
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
@ -54,7 +55,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
|
||||
goto_bad;
|
||||
|
||||
/* extend vg */
|
||||
if (!vg_extend(vg, argc, argv, NULL))
|
||||
if (!vg_extend(vg, argc, argv, &pp))
|
||||
goto_bad;
|
||||
|
||||
/* ret > 0 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user