Eduardo has uploaded a new change for review.
Change subject: Remove StoragePool.createVolume().
......................................................................
Remove StoragePool.createVolume().
Change-Id: I45186ab45d075d764c0a630e6b7a483baef1e45b
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
2 files changed, 7 insertions(+), 55 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/16325/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 5a5b4fb..ef354e0 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1379,8 +1379,6 @@
diskType, volUUID, desc,
srcImgUUID, srcVolUUID))
vars.task.setDefaultException(se.VolumeCreationError(argsStr))
- # Validates that the pool is connected. WHY?
- pool = self.getPool(spUUID)
sdDom = self.validateSdUUID(sdUUID)
misc.validateUUID(imgUUID, 'imgUUID')
misc.validateUUID(volUUID, 'volUUID')
@@ -1399,9 +1397,13 @@
sdDom.validateCreateVolumeParams(volFormat, preallocate, srcVolUUID)
vars.task.getSharedLock(STORAGE, sdUUID)
- self._spmSchedule(spUUID, "createVolume", pool.createVolume, sdUUID,
- imgUUID, size, volFormat, preallocate, diskType,
- volUUID, desc, srcImgUUID, srcVolUUID)
+ imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
+ with rmanager.acquireResource(imageResourcesNamespace, imgUUID,
+ rm.LockType.exclusive):
+ self._spmSchedule(spUUID, "createVolume_%s" % volUUID,
+ sdDom.createVolume, imgUUID, size, volFormat,
+ preallocate, diskType, volUUID, desc,
+ srcImgUUID, srcVolUUID)
@public
def deleteVolume(self, sdUUID, spUUID, imgUUID, volumes, postZero=False,
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 9b154f4..4a9fa05 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -49,7 +49,6 @@
from resourceFactories import IMAGE_NAMESPACE
from storageConstants import STORAGE
import resourceManager as rm
-import volume
import mount
from domainMonitor import DomainMonitor
@@ -1897,55 +1896,6 @@
rm.LockType.exclusive):
image.Image(self.poolPath).merge(
sdUUID, vmUUID, imgUUID, ancestor, successor, postZero)
-
- def createVolume(self, sdUUID, imgUUID, size, volFormat, preallocate,
- diskType, volUUID=None, desc="",
- srcImgUUID=volume.BLANK_UUID,
- srcVolUUID=volume.BLANK_UUID):
- """
- Creates a new volume.
-
- .. note::
- If the *imgUUID* is **identical** to the *srcImgUUID* the new
- volume will be logically considered a snapshot of the old volume.
- If the *imgUUID* is **different** from the *srcImgUUID* the old
- volume will be logically considered as a template of the new
- volume.
-
- :param sdUUID: The UUID of the storage domain that contains the volume.
- :type sdUUID: UUID
- :param imgUUID: The UUID of the image that the new volume will have.
- :type imgUUID: UUID
- :param size: The size of the new volume in bytes.
- :type size: int
- :param volFormat: The format of the new volume.
- :type volFormat: some enum ?!
- :param preallocate: Should the volume be preallocated.
- :type preallocate: bool
- :param diskType: The disk type of the new volume.
- :type diskType: :class:`API.Image.DiskTypes`
- :param volUUID: The UUID of the new volume that will be created.
- :type volUUID: UUID
- :param desc: A human readable description of the new volume.
- :param srcImgUUID: The UUID of the image that resides on the volume
- that will be the base of the new volume.
- :type srcImgUUID: UUID
- :param srcVolUUID: The UUID of the volume that will be the base of the
- new volume.
- :type srcVolUUID: UUID
-
- :returns: a dict with the UUID of the new volume.
- :rtype: dict
- """
- imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
-
- with rmanager.acquireResource(imageResourcesNamespace, imgUUID,
- rm.LockType.exclusive):
- uuid = sdCache.produce(sdUUID).createVolume(
- imgUUID=imgUUID, size=size, volFormat=volFormat,
- preallocate=preallocate, diskType=diskType, volUUID=volUUID,
- desc=desc, srcImgUUID=srcImgUUID, srcVolUUID=srcVolUUID)
- return dict(uuid=uuid)
def deleteVolume(self, sdUUID, imgUUID, volumes, postZero, force):
"""
--
To view, visit
http://gerrit.ovirt.org/16325
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I45186ab45d075d764c0a630e6b7a483baef1e45b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>