Change in vdsm[ovirt-3.5]: lvm: Check if device in VG before extend
frolland at redhat.com
frolland at redhat.com
Thu Sep 24 07:34:40 UTC 2015
Hello Fred Rolland, Allon Mureinik,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/46651
to review the following change.
Change subject: lvm: Check if device in VG before extend
......................................................................
lvm: Check if device in VG before extend
Before extending a VG, VDSM needs to check that none of
the additional devices are not already part of the VG.
Without this protection, LVM will create a new PV with the
same device. After extending VG, its metadata will updated
with new PV. As a result, the VG will be partial.
pvs output after creating new PV with same device:
# pvs
WARNING: Device for PV 2fDjgH-TeKA-1Vy2-NMMv-GB9n-op0w-g2Nyrd not
found or rejected by a filter.
PV
/dev/mapper/360014054bf6dd7d14fd40c9ac3b5dbe8
unknown device
Change-Id: Ifec2503094d6a0ecdd32e5e62f9c01a1469145f3
Backport-To: 3.6
Bug-Url: https://bugzilla.redhat.com/1265907
Signed-off-by: Fred Rolland <frolland at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/45946
Continuous-Integration: Jenkins CI
Reviewed-by: Allon Mureinik <amureini at redhat.com>
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/storage/lvm.py
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/46651/1
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index aa3c04b..7f2adf1 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -962,6 +962,13 @@
pvs = [_fqpvname(pdev) for pdev in _normalizeargs(devices)]
_checkpvsblksize(pvs, getVGBlockSizes(vgName))
vg = _lvminfo.getVg(vgName)
+
+ member_pvs = set(vg.pv_name).intersection(pvs)
+ if member_pvs:
+ log.error("Cannot extend vg %s: pvs already belong to vg %s",
+ vg.name, member_pvs)
+ raise se.VolumeGroupExtendError(vgName, pvs)
+
# Format extension PVs as all the other already in the VG
_initpvs(pvs, int(vg.vg_mda_size) / 2 ** 20, force)
--
To view, visit https://gerrit.ovirt.org/46651
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifec2503094d6a0ecdd32e5e62f9c01a1469145f3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Freddy Rolland <frolland at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Fred Rolland <frolland at redhat.com>
More information about the vdsm-patches
mailing list