Change in vdsm[master]: storage: Split setParent volume operations

alitke at redhat.com alitke at redhat.com
Tue May 20 20:38:21 UTC 2014


Adam Litke has uploaded a new change for review.

Change subject: storage: Split setParent volume operations
......................................................................

storage: Split setParent volume operations

For efficiency on block domains we store a volume's parent UUID in two
places: as an LV tag on the Volume LV itself, and in the metadata LV of
the block domain.  For file domains the parent UUID is stored only in
the volume's metadata file.  This works fine now but when we introduce
live merge we will have a problem.  On block domains the LV tag can only
be updated by the SPM and the metadata LV can be updated by the HSM
host.  On file domains, the metadata file can only be updated by the HSM
host.  When a live merge completes we will need to update the volume
chain as soon as possible to match what qemu is actually using.  In
order to do this from the HSM host (where the live merge completes) we
need to split setParent into two parts.

setParentMeta can always be called by the HSM host that is running the
VM and by an SPM if the volume is not in use.

setParentTag must only be called by the SPM.

A common implementation of setParent is added to the Volume base class
and will ensure compatibility with all existing callers of setParent.

In the live merge case, we will call setParentMeta when the merge
completes and will call setParentTag from the deleteVolume SPM verb
where we actually remove the merged volume.

Change-Id: I679a04fddce7257eb87532986ec9ef2d11b23139
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M vdsm/storage/blockVolume.py
M vdsm/storage/fileVolume.py
M vdsm/storage/volume.py
3 files changed, 29 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/27949/1

diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index d6c5c7e..dfbbddd 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -470,14 +470,20 @@
         """
         return self.getVolumeTag(TAG_PREFIX_IMAGE)
 
-    def setParent(self, puuid):
+    def setParentMeta(self, puuid):
         """
-        Set parent volume UUID
+        Set parent volume UUID in Volume metadata.  This operation can be done
+        by an HSM while it is using the volume and by an SPM when no one is
+        using the volume.
+        """
+        self.setMetaParam(volume.PUUID, puuid)
+
+    def setParentTag(self, puuid):
+        """
+        Set parent volume UUID in Volume tags.  Since this operation modifies
+        LV metadata it may only be performed by an SPM.
         """
         self.changeVolumeTag(TAG_PREFIX_PARENT, puuid)
-        # FIXME In next version we should remove PUUID, as it is saved on lvm
-        # tags
-        self.setMetaParam(volume.PUUID, puuid)
 
     def setImage(self, imgUUID):
         """
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index d4924d3..419e205 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -416,12 +416,20 @@
         """
         return self.getMetaParam(volume.IMAGE)
 
-    def setParent(self, puuid):
+    def setParentMeta(self, puuid):
         """
-        Set parent volume UUID
+        Set parent volume UUID in Volume metadata.  This operation can be done
+        by an HSM while it is using the volume and by an SPM when no one is
+        using the volume.
         """
         self.setMetaParam(volume.PUUID, puuid)
 
+    def setParentTag(self, puuid):
+        """
+        For file volumes we do not use any LV tags
+        """
+        pass
+
     def setImage(self, imgUUID):
         """
         Set image UUID
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 282226b..5260613 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -891,6 +891,14 @@
                                                               puuid)
         return None
 
+    def setParent(self, puuid):
+        """
+        Set the parent volume UUID.  This information can be stored in multiple
+        places depending on the underlying volume type.
+        """
+        self.setParentTag(puuid)
+        self.setParentMeta(puuid)
+
     def getVolumePath(self):
         """
         Get the path of the volume file/link


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I679a04fddce7257eb87532986ec9ef2d11b23139
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>


More information about the vdsm-patches mailing list