Change in vdsm[master]: upgrade: skip volume lease for faulty metadata offsets

fsimonce at redhat.com fsimonce at redhat.com
Fri Nov 30 16:37:14 UTC 2012


Federico Simoncelli has uploaded a new change for review.

Change subject: upgrade: skip volume lease for faulty metadata offsets
......................................................................

upgrade: skip volume lease for faulty metadata offsets

This check has been added to overcome bz882276 (during the domain
upgrade). Few vdsm releases (4.9 prior 496c0c3) generated metadata
offsets higher than 2048 - 100 - 1 that would not permit sanlock
to store the volume resource in the leases LV.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=882276
Change-Id: Ic84108d4fbe0dfee9fe1d57c802f99dd937cd8ec
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/storage/imageRepository/formatConverter.py
1 file changed, 23 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/9600/1

diff --git a/vdsm/storage/imageRepository/formatConverter.py b/vdsm/storage/imageRepository/formatConverter.py
index cd32a62..a0edaab 100644
--- a/vdsm/storage/imageRepository/formatConverter.py
+++ b/vdsm/storage/imageRepository/formatConverter.py
@@ -18,7 +18,9 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
+import errno
 import logging
+import sanlock
 
 from vdsm import qemuImg
 
@@ -27,6 +29,10 @@
 from storage import image
 from storage import safelease
 from storage import volume
+from storage import blockVolume
+
+
+BLKVOL_MAX_OFFSET = sd.LEASES_SIZE - blockVolume.RESERVED_LEASES - 1
 
 
 def __convertDomainMetadataToTags(domain, targetVersion):
@@ -153,7 +159,23 @@
 
             log.debug("Creating the volume lease for %s", volUUID)
             metaId = vol.getMetadataId()
-            vol.newVolumeLease(metaId, domain.sdUUID, volUUID)
+
+            try:
+                vol.newVolumeLease(metaId, domain.sdUUID, volUUID)
+            except sanlock.SanlockException, e:
+                metaOffset = (vol.getMetaOffset()
+                                if hasattr(vol, "getMetaOffset") else 0
+                # This check has been added to overcome BZ#882276 (during
+                # the domain upgrade). Few vdsm releases (4.9 prior 496c0c3)
+                # generated metadata offsets higher than 2048 - 100 - 1 that
+                # would not permit sanlock to store the volume resource in
+                # the leases LV.
+                if e.errno == errno.ENOSPC and metaOffset > BLKVOL_MAX_OFFSET:
+                    log.error("The volume lease for %s has not been "
+                              "initialized due bz882276, metadata offset "
+                              "too high: %s", volUUID, metaOffset)
+                else:
+                    raise
 
             # If this volume is used as a template let's update the other
             # volume's permissions and share the volume lease (at the moment


--
To view, visit http://gerrit.ovirt.org/9600
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic84108d4fbe0dfee9fe1d57c802f99dd937cd8ec
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>


More information about the vdsm-patches mailing list