Change in vdsm[master]: StorageDomainManifest: Move validateCreateVolumeParams

alitke at redhat.com alitke at redhat.com
Mon Jul 13 19:45:54 UTC 2015


Adam Litke has uploaded a new change for review.

Change subject: StorageDomainManifest: Move validateCreateVolumeParams
......................................................................

StorageDomainManifest: Move validateCreateVolumeParams

Change-Id: Ib971bd6a2edf278445f6fbb9274e6272220f989f
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/sd.py
2 files changed, 25 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/43550/1

diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 63760bb..9604250 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -777,6 +777,14 @@
         occupiedSlots.sort(key=itemgetter(0))
         return occupiedSlots
 
+    def validateCreateVolumeParams(self, volFormat, srcVolUUID,
+                                   preallocate=None):
+        super(BlockStorageDomainManifest, self).validateCreateVolumeParams(
+            volFormat, srcVolUUID, preallocate=preallocate)
+        # Sparse-Raw not supported for block volumes
+        if preallocate == volume.SPARSE_VOL and volFormat == volume.RAW_FORMAT:
+            raise se.IncorrectFormat(volume.type2name(volFormat))
+
 
 class BlockStorageDomain(sd.StorageDomain):
     manifestClass = BlockStorageDomainManifest
@@ -953,14 +961,6 @@
 
     def getVAllocSize(self, imgUUID, volUUID):
         return self._manifest.getVSize(imgUUID, volUUID)
-
-    def validateCreateVolumeParams(self, volFormat, srcVolUUID,
-                                   preallocate=None):
-        super(BlockStorageDomain, self).validateCreateVolumeParams(
-            volFormat, srcVolUUID, preallocate=preallocate)
-        # Sparse-Raw not supported for block volumes
-        if preallocate == volume.SPARSE_VOL and volFormat == volume.RAW_FORMAT:
-            raise se.IncorrectFormat(volume.type2name(volFormat))
 
     @classmethod
     def getMetaDataMapping(cls, vgName, oldMapping={}):
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index dc2c6a1..a9930cb 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -436,6 +436,21 @@
     def refresh(self):
         pass
 
+    def validateCreateVolumeParams(self, volFormat, srcVolUUID,
+                                   preallocate=None):
+        """
+        Validate create volume parameters
+        """
+        if volFormat not in volume.VOL_FORMAT:
+            raise se.IncorrectFormat(volFormat)
+
+        # Volumes with a parent must be cow
+        if srcVolUUID != volume.BLANK_UUID and volFormat != volume.COW_FORMAT:
+            raise se.IncorrectFormat(volume.type2name(volFormat))
+
+        if preallocate is not None and preallocate not in volume.VOL_TYPE:
+            raise se.IncorrectType(preallocate)
+
 
 class StorageDomain(object):
     log = logging.getLogger("Storage.StorageDomain")
@@ -562,18 +577,8 @@
 
     def validateCreateVolumeParams(self, volFormat, srcVolUUID,
                                    preallocate=None):
-        """
-        Validate create volume parameters
-        """
-        if volFormat not in volume.VOL_FORMAT:
-            raise se.IncorrectFormat(volFormat)
-
-        # Volumes with a parent must be cow
-        if srcVolUUID != volume.BLANK_UUID and volFormat != volume.COW_FORMAT:
-            raise se.IncorrectFormat(volume.type2name(volFormat))
-
-        if preallocate is not None and preallocate not in volume.VOL_TYPE:
-            raise se.IncorrectType(preallocate)
+        return self._manifest.validateCreateVolumeParams(volFormat, srcVolUUID,
+                                                         preallocate)
 
     def createVolume(self, imgUUID, size, volFormat, preallocate, diskType,
                      volUUID, desc, srcImgUUID, srcVolUUID):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib971bd6a2edf278445f6fbb9274e6272220f989f
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