Adam Litke has uploaded a new change for review.

Change subject: lvm: Do not rely on return code when handling extendLV errors
......................................................................

lvm: Do not rely on return code when handling extendLV errors

LVM has changed the return code used when attempting to extend an LV to the
same size from 3 to 5.  Since we cannot rely on a stable error code we can
match against the error message instead.  Another way to do this is to check
the LV size after errors and ignore any failures so long as the LV has the
newly requested size.  In this case, I think it's better to match the message
than assume we can ignore lvm errors.

Change-Id: I89e52b1078a7fdc65adf5e1091d3618231bec92f
Signed-off-by: Adam Litke <ali...@redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1363734
---
M vdsm/storage/lvm.py
1 file changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/61917/1

diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 3d3c31a..6bee6b3 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -1158,13 +1158,15 @@
     if rc == 0:
         _lvminfo._invalidatevgs(vgName)
         _lvminfo._invalidatelvs(vgName, lvName)
+    else:
+        # We want to ignore resize errors when size == the existing size
+        r = 'New size \(\d+ extents\) matches existing size \(\d+ extents\)'
+        if re.search(r, '\n'.join(err)):
+            log.debug("New size (in extents) matches existing size "
+                      "(in extents).")
+            return
 
-    elif rc == 3:
-        # In LVM we trust. Hope that 3 is only for this.
-        log.debug("New size (in extents) matches existing size (in extents).")
-    elif rc != 0:
-        # get the free extents size
-        # YaRC
+        # In the case where the VG is out of space raise VolumeGroupSizeError
         vg = getVG(vgName)
         free_size = int(vg.extent_size) * int(vg.free_count)  # in B
         if free_size < int(size) * constants.MEGAB:


-- 
To view, visit https://gerrit.ovirt.org/61917
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89e52b1078a7fdc65adf5e1091d3618231bec92f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <ali...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to