mirror of
git://sourceware.org/git/lvm2.git
synced 2025-09-07 09:44:20 +03:00
pvresize: Do not use pv_read (get the PV from orphan VG).
This commit is contained in:
@@ -561,18 +561,6 @@ int pv_resize_single(struct cmd_context *cmd,
|
|||||||
struct volume_group *old_vg = vg;
|
struct volume_group *old_vg = vg;
|
||||||
int vg_needs_pv_write = 0;
|
int vg_needs_pv_write = 0;
|
||||||
|
|
||||||
if (is_orphan_vg(vg_name)) {
|
|
||||||
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE, NULL)) {
|
|
||||||
log_error("Can't get lock for orphans");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(pv = pv_read(cmd, pv_name, 1, 0))) {
|
|
||||||
unlock_vg(cmd, vg_name);
|
|
||||||
log_error("Unable to read PV \"%s\"", pv_name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
vg = vg_read_for_update(cmd, vg_name, NULL, 0);
|
vg = vg_read_for_update(cmd, vg_name, NULL, 0);
|
||||||
|
|
||||||
if (vg_read_error(vg)) {
|
if (vg_read_error(vg)) {
|
||||||
@@ -592,7 +580,6 @@ int pv_resize_single(struct cmd_context *cmd,
|
|||||||
|
|
||||||
if (!archive(vg))
|
if (!archive(vg))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
if (!(pv->fmt->features & FMT_RESIZE_PV)) {
|
if (!(pv->fmt->features & FMT_RESIZE_PV)) {
|
||||||
log_error("Physical volume %s format does not support resizing.",
|
log_error("Physical volume %s format does not support resizing.",
|
||||||
@@ -650,8 +637,6 @@ out:
|
|||||||
log_error("Use pvcreate and vgcfgrestore "
|
log_error("Use pvcreate and vgcfgrestore "
|
||||||
"to repair from archived metadata.");
|
"to repair from archived metadata.");
|
||||||
unlock_vg(cmd, vg_name);
|
unlock_vg(cmd, vg_name);
|
||||||
if (is_orphan_vg(vg_name))
|
|
||||||
free_pv_fid(pv);
|
|
||||||
if (!old_vg)
|
if (!old_vg)
|
||||||
release_vg(vg);
|
release_vg(vg);
|
||||||
return r;
|
return r;
|
||||||
|
Reference in New Issue
Block a user