Change in vdsm[master]: api: remove obsolete volume prepare and teardown

Federico Simoncelli fsimonce at redhat.com
Thu Jun 5 10:42:17 UTC 2014


Federico Simoncelli has uploaded a new change for review.

Change subject: api: remove obsolete volume prepare and teardown
......................................................................

api: remove obsolete volume prepare and teardown

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1092166
Change-Id: Ic101ebc6e62e83b06b268c52e146cf0740fab887
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/storage/hsm.py
M vdsm_api/vdsmapi-schema.json
4 files changed, 0 insertions(+), 142 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/28390/1

diff --git a/vdsm/API.py b/vdsm/API.py
index 8b1032d..c43c1d0 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -766,10 +766,6 @@
         return self._irs.setVolumeSize(self._sdUUID, self._spUUID,
                                        self._imgUUID, self._UUID, newSize)
 
-    def prepare(self, rw):
-        return self._irs.prepareVolume(self._sdUUID, self._spUUID,
-                                       self._imgUUID, self._UUID, rw)
-
     def refresh(self):
         return self._irs.refreshVolume(self._sdUUID, self._spUUID,
                                        self._imgUUID, self._UUID)
@@ -782,10 +778,6 @@
     def setLegality(self, legality):
         return self._irs.setVolumeLegality(self._sdUUID, self._spUUID,
                                            self._imgUUID, self._UUID, legality)
-
-    def tearDown(self):
-        return self._irs.teardownVolume(self._sdUUID, self._spUUID,
-                                        self._imgUUID, self._UUID)
 
 
 class Image(APIBase):
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 87ce86f..08a818d 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -850,10 +850,6 @@
         volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
         return volume.setSize(newSize)
 
-    def volumePrepare(self, sdUUID, spUUID, imgUUID, volUUID, rw=True):
-        volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
-        return volume.prepare(rw)
-
     def volumeRefresh(self, sdUUID, spUUID, imgUUID, volUUID):
         volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
         return volume.refresh()
@@ -866,10 +862,6 @@
     def volumeSetLegality(self, sdUUID, spUUID, imgUUID, volUUID, legality):
         volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
         return volume.setLegality(legality)
-
-    def volumeTearDown(self, sdUUID, spUUID, imgUUID, volUUID):
-        volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
-        return volume.tearDown()
 
     def taskClear(self, taskId):
         task = API.Task(taskId)
@@ -1079,11 +1071,9 @@
                 (self.volumeGetPath, 'getVolumePath'),
                 (self.volumeGetSize, 'getVolumeSize'),
                 (self.volumeSetSize, 'volumeSetSize'),
-                (self.volumePrepare, 'prepareVolume'),
                 (self.volumeRefresh, 'refreshVolume'),
                 (self.volumeSetDescription, 'setVolumeDescription'),
                 (self.volumeSetLegality, 'setVolumeLegality'),
-                (self.volumeTearDown, 'teardownVolume'),
                 (self.tasksGetAllInfo, 'getAllTasksInfo'),
                 (self.tasksGetAllStatuses, 'getAllTasksStatuses'),
                 (self.tasksGetAll, 'getAllTasks'),
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index e874c23..afc5c0a 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -65,7 +65,6 @@
 from threadLocal import vars
 from vdsm import constants
 from storageConstants import STORAGE
-from resourceFactories import IMAGE_NAMESPACE
 import resourceManager as rm
 import devicemapper
 import logUtils
@@ -3127,88 +3126,6 @@
         fails = supervdsm.getProxy().rmAppropriateRules(thiefId)
         if fails:
             self.log.error("Failed to remove the following rules: %s", fails)
-
-    @public
-    def prepareVolume(self, sdUUID, spUUID, imgUUID, volUUID, rw=True,
-                      options=None):
-        """
-        Prepares a volume (used in SAN).
-        Activates LV and rebuilds 'images' subtree.
-
-        .. warning::
-            This method is obsolete and is kept only for testing purposes;
-            use prepareImage instead.
-
-        :param sdUUID: The UUID of the storage domain that owns the volume.
-        :type sdUUID: UUID
-        :param spUUID: The UUID of the storage pool that owns the volume.
-        :type spUUID: UUID
-        :param imgUUID: The UUID of the image contained on the volume.
-        :type imgUUID: UUID
-        :param volUUID: The UUID of the volume you want to prepare.
-        :type volUUID: UUID
-        :param rw: Should the volume be set as RW. ?
-        :type rw: bool
-        :param options: ?
-        """
-        vars.task.getSharedLock(STORAGE, sdUUID)
-        imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
-        lockType = rm.LockType.exclusive if rw else rm.LockType.shared
-        timeout = config.getint('irs', 'prepare_image_timeout') / 1000.0
-
-        imgResource = rmanager.acquireResource(imageResourcesNamespace,
-                                               imgUUID, lockType, timeout)
-        try:
-            vol = sdCache.produce(sdUUID=sdUUID).produceVolume(
-                imgUUID=imgUUID, volUUID=volUUID)
-            # NB We want to be sure that at this point HSM does not use stale
-            # LVM cache info, so we call refresh explicitly. We may want to
-            # remove this refresh later, when we come up with something better.
-            vol.refreshVolume()
-            vol.prepare(rw=rw)
-
-            self._preparedVolumes[sdUUID + volUUID].append(imgResource)
-        except:
-            self.log.error("Prepare volume %s in domain %s failed",
-                           volUUID, sdUUID, exc_info=True)
-            imgResource.release()
-            raise
-
-    @public
-    def teardownVolume(self, sdUUID, spUUID, imgUUID, volUUID, rw=False,
-                       options=None):
-        """
-        Tears down a volume (used in SAN).
-        Deactivates LV.
-
-        .. warning::
-            This method is obsolete and is kept only for testing purposes;
-            use teardownImage instead.
-
-        :param sdUUID: The UUID of the storage domain that owns the volume.
-        :type sdUUID: UUID
-        :param spUUID: The UUID of the storage pool that owns the volume.
-        :type spUUID: UUID
-        :param imgUUID: The UUID of the image contained on the volume.
-        :type imgUUID: UUID
-        :param volUUID: The UUID of the volume you want to teardown.
-        :type volUUID: UUID
-        :param rw: deprecated
-        :param options: ?
-        """
-        vars.task.getSharedLock(STORAGE, sdUUID)
-        try:
-            imgResource = self._preparedVolumes[sdUUID + volUUID].pop()
-        except IndexError:
-            raise se.VolumeWasNotPreparedBeforeTeardown()
-
-        imgResource.release()
-
-        try:
-            volclass = sdCache.produce(sdUUID).getVolumeClass()
-            volclass.teardown(sdUUID=sdUUID, volUUID=volUUID)
-        except Exception:
-            self.log.warn("Problem tearing down volume", exc_info=True)
 
     @public
     def prepareImage(self, sdUUID, spUUID, imgUUID, leafUUID):
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 1d094b8..6457af8 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -7233,28 +7233,6 @@
  'returns': 'VolumeSizeInfo'}
 
 ##
-# @Volume.prepare:
-#
-# Make a Volume accessible.
-#
-# @volumeID:         The UUID of the Volume
-#
-# @storagepoolID:    The Storage Pool associated with the Volume
-#
-# @storagedomainID:  The Storage Domain associated with the Volume
-#
-# @imageID:          The Image associated with the Volume
-#
-# @rw:               If True, the Volume should be made writeable, otherwise
-#                    read-only
-#
-# Since: 4.10.0
-##
-{'command': {'class': 'Volume', 'name': 'prepare'},
- 'data': {'volumeID': 'UUID', 'storagepoolID': 'UUID',
-          'storagedomainID': 'UUID', 'imageID': 'UUID', 'rw': 'bool'}}
-
-##
 # @Volume.refresh:
 #
 # Refresh Volume to synchronize changes made by a remote host.
@@ -7315,25 +7293,6 @@
  'data': {'volumeID': 'UUID', 'storagepoolID': 'UUID',
           'storagedomainID': 'UUID', 'imageID': 'UUID',
           'legality': 'VolumeLegality'}}
-
-##
-# @Volume.tearDown:
-#
-# Deactivate the Volume and release resources.
-#
-# @volumeID:         The UUID of the Volume
-#
-# @storagepoolID:    The Storage Pool associated with the Volume
-#
-# @storagedomainID:  The Storage Domain associated with the Volume
-#
-# @imageID:          The Image associated with the Volume
-#
-# Since: 4.10.0
-##
-{'command': {'class': 'Volume', 'name': 'tearDown'},
- 'data': {'volumeID': 'UUID', 'storagepoolID': 'UUID',
-          'storagedomainID': 'UUID', 'imageID': 'UUID'}}
 
 ##
 # @VM.setNumberOfCpus:


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

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