Change in vdsm[master]: lvm: Check if device in VG before extend

frolland at redhat.com frolland at redhat.com
Wed Sep 9 14:26:59 UTC 2015


Hello Fred Rolland,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/45946

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.

Change-Id: Ifec2503094d6a0ecdd32e5e62f9c01a1469145f3
Backport-To: 3.6
Bug-Url: https://bugzilla.redhat.com/1261531
Signed-off-by: Fred Rolland <frolland at redhat.com>
---
M vdsm/storage/lvm.py
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/45946/1

diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 0394ce9..b56b92e 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -983,6 +983,12 @@
     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("These PVs already belong to VG %s", 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/45946
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifec2503094d6a0ecdd32e5e62f9c01a1469145f3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Freddy Rolland <frolland at redhat.com>
Gerrit-Reviewer: Fred Rolland <frolland at redhat.com>


More information about the vdsm-patches mailing list