Change in vdsm[master]: LiveMerge: Remove old merge APIs

alitke at redhat.com alitke at redhat.com
Wed Apr 9 17:35:10 UTC 2014


Adam Litke has uploaded a new change for review.

Change subject: LiveMerge: Remove old merge APIs
......................................................................

LiveMerge: Remove old merge APIs

The old merge and mergeStatus APIs were never adopted and in order to
make way for the new live merge feature let's remove this dead code
first.

Change-Id: I33c4d01e17cf5d2362df25f0ab104a42a485e14f
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/clientIF.py
M vdsm/vm.py
M vdsm_api/vdsmapi-schema.json
5 files changed, 0 insertions(+), 216 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/32/26632/1

diff --git a/vdsm/API.py b/vdsm/API.py
index ae959ef..375a3e5 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -685,18 +685,6 @@
                 self._getHibernationPaths(snapMemVolHandle)
         return v.snapshot(snapDrives, memoryParams)
 
-    def merge(self, mergeDrives):
-        v = self._cif.vmContainer.get(self._UUID)
-        if not v:
-            return errCode['noVM']
-        return v.merge(mergeDrives)
-
-    def mergeStatus(self):
-        v = self._cif.vmContainer.get(self._UUID)
-        if not v:
-            return errCode['noVM']
-        return v.mergeStatus()
-
     def setBalloonTarget(self, target):
         v = self._cif.vmContainer.get(self._UUID)
         if not v:
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 259c262..7ccfe01 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -358,14 +358,6 @@
         vm = API.VM(vmId)
         return vm.snapshot(snapDrives, snapMemVolHandle)
 
-    def vmMerge(self, vmId, mergeDrives):
-        vm = API.VM(vmId)
-        return vm.merge(mergeDrives)
-
-    def vmMergeStatus(self, vmId):
-        vm = API.VM(vmId)
-        return vm.mergeStatus()
-
     def vmSetBalloonTarget(self, vmId, target):
         vm = API.VM(vmId)
         return vm.setBalloonTarget(target)
@@ -878,8 +870,6 @@
                 (self.vmPause, 'pause'),
                 (self.vmCont, 'cont'),
                 (self.vmSnapshot, 'snapshot'),
-                (self.vmMerge, 'merge'),
-                (self.vmMergeStatus, 'mergeStatus'),
                 (self.vmSetBalloonTarget, 'setBalloonTarget'),
                 (self.vmReset, 'reset'),
                 (self.vmShutdown, 'shutdown'),
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index f8fe499..88ed30c 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -561,9 +561,6 @@
                     v.onConnect(remoteAddr['node'])
                 elif phase == libvirt.VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT:
                     v.onDisconnect()
-            elif eventid == libvirt.VIR_DOMAIN_EVENT_ID_BLOCK_JOB:
-                path, type, status = args[:-1]
-                v._onBlockJobEvent(path, type, status)
             elif eventid == libvirt.VIR_DOMAIN_EVENT_ID_WATCHDOG:
                 action, = args[:-1]
                 v._onWatchdogEvent(action)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 6e3fbeb..c6d455f 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -423,17 +423,6 @@
                 'Up', 'WaitForLaunch')
 
 
-class MERGESTATUS:
-    NOT_STARTED = "Not Started"
-    IN_PROGRESS = "In Progress"
-    FAILED = "Failed"
-    COMPLETED = "Completed"
-    UNKNOWN = "Unknown"
-    DRIVE_NOT_FOUND = "Drive Not Found"
-    BASE_NOT_FOUND = "Base Not Found"
-    DRIVE_NOT_SUPPORTED = "Drive Not Supported"
-
-
 class DRIVE_SHARED_TYPE:
     NONE = "none"
     EXCLUSIVE = "exclusive"
@@ -3190,8 +3179,6 @@
             self._dom = NotifyingVirDomain(
                 self._connection.lookupByUUIDString(self.id),
                 self._timeoutExperienced)
-            # Reinitialize the merge statuses
-            self._checkMerge()
         elif 'restoreState' in self.conf:
             fromSnapshot = self.conf.get('restoreFromSnapshot', False)
             srcDomXML = self.conf.pop('_srcDomXML')
@@ -4083,110 +4070,6 @@
         return {'status': doneCode, 'quiesce':
                 (snapFlags & libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE
                     == libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE)}
-
-    def _runMerge(self):
-        for mergeStatus in self.conf.get('liveMerge', []):
-            if mergeStatus['status'] != MERGESTATUS.NOT_STARTED:
-                continue
-
-            try:
-                self._dom.blockRebase(mergeStatus['path'],
-                                      mergeStatus['basePath'], 0, 0)
-            except Exception:
-                mergeStatus['status'] = MERGESTATUS.FAILED
-                self.log.error("Live merge failed for %s",
-                               mergeStatus['path'], exc_info=True)
-            else:
-                mergeStatus['status'] = MERGESTATUS.IN_PROGRESS
-
-        self.saveState()
-
-    def _checkMerge(self):
-        for mergeStatus in self.conf.get('liveMerge', []):
-            if mergeStatus['status'] != MERGESTATUS.IN_PROGRESS:
-                continue
-
-            try:
-                jobInfo = self._dom.blockJobInfo(mergeStatus['path'], 0)
-            except Exception:
-                jobInfo = None
-
-            if not jobInfo:
-                mergeStatus['status'] = MERGESTATUS.UNKNOWN
-
-        self.saveState()
-
-    def merge(self, mergeDrives):
-        """Live merge command"""
-
-        # Check if there is a merge still in progress
-        for mergeStatus in self.conf.get('liveMerge', []):
-            if mergeStatus['status'] == MERGESTATUS.IN_PROGRESS:
-                return errCode['mergeErr']
-
-        self.conf['liveMerge'] = []
-
-        # Preparing the merge statuses
-        for drive in mergeDrives:
-            try:
-                mergeDrive = self._findDriveByUUIDs(drive)
-            except LookupError:
-                mergeDrive = None
-
-            mergeStatus = drive.copy()
-            mergeStatus['status'] = MERGESTATUS.NOT_STARTED
-
-            if not mergeDrive or not hasattr(mergeDrive, 'volumeChain'):
-                mergeStatus['status'] = MERGESTATUS.DRIVE_NOT_FOUND
-            elif mergeDrive.hasVolumeLeases or mergeDrive.transientDisk:
-                mergeStatus['status'] = MERGESTATUS.DRIVE_NOT_SUPPORTED
-            else:
-                for volume in mergeDrive.volumeChain:
-                    # qemu-kvm looks up for the backing file path looking at
-                    # the value sotred in the qcow2 header, therefore here
-                    # we can't use the absolute path provided by prepareImage
-                    if volume['volumeID'] == drive['baseVolumeID']:
-                        mergeStatus['basePath'] = "../%s/%s" % (
-                            volume['imageID'], volume['volumeID'])
-                        break
-                else:
-                    mergeStatus['status'] = MERGESTATUS.BASE_NOT_FOUND
-
-                mergeStatus['path'] = mergeDrive.path
-                mergeStatus['disk'] = mergeDrive.name
-
-            self.conf['liveMerge'].append(mergeStatus)
-
-        self.saveState()
-        self._runMerge()
-
-        return {'status': doneCode}
-
-    def mergeStatus(self):
-        def _filterInternalInfo(mergeStatus):
-            return dict((k, v) for k, v in mergeStatus.iteritems()
-                        if k not in ("path", "basePath"))
-
-        mergeStatus = [_filterInternalInfo(x)
-                       for x in self.conf.get('liveMerge', [])]
-
-        return {'status': doneCode, 'mergeStatus': mergeStatus}
-
-    def _onBlockJobEvent(self, path, type, status):
-        for mergeStatus in self.conf.get('liveMerge', []):
-            if mergeStatus['path'] == path:
-                break
-        else:
-            self.log.error("Live merge completed for an unexpected "
-                           "path: %s", path)
-            return
-
-        if status == libvirt.VIR_DOMAIN_BLOCK_JOB_COMPLETED:
-            mergeStatus['status'] = MERGESTATUS.COMPLETED
-        else:
-            mergeStatus['status'] = MERGESTATUS.FAILED
-
-        self.saveState()
 
     def _setDiskReplica(self, srcDrive, dstDisk):
         """
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 6f99734..9c7f9d8 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -6345,80 +6345,6 @@
           '*snapMemory': 'str'}}
 
 ##
-# @VM.merge:
-#
-# Merge VM disk snapshots.
-#
-# @vmID:         The UUID of the VM
-#
-# @mergeDrives:  A list of drives on which to perform merge operations.  Each
-#                entry must have @baseVolumeID set to indicate the new desired
-#                base volume.
-#
-# Since: 4.10.0
-##
-{'command': {'class': 'VM', 'name': 'merge'},
- 'data': {'vmID': 'UUID', 'mergeDrives': ['VmDiskDevice']}}
-
-##
-# @MergeStatusCode:
-#
-# An enumeration of possible merge statuses.
-#
-# @Not Started:      The merge operation has not yet started
-#
-# @In Progress:      The operation is ongoing
-#
-# @Failed:           The merge operation failed
-#
-# @Completed:        The merge operation is finished
-#
-# @Unknown:          The status cannot be determined
-#
-# @Drive Not Found:  The specified drive could not be found
-#
-# @Base Not Found:   The indicated base volume is not in the volume chain
-#
-# Since: 4.10.0
-##
-{'enum': 'MergeStatusCode',
- 'data': ['Not Started', 'In Progress', 'Failed', 'Completed', 'Unknown',
-          'Drive Not Found', 'Base Not Found']}
-
-##
-# @MergeStatus:
-#
-# Status of a merge operation on a single disk.
-#
-# @disk:    The name of the disk
-#
-# @status:  The current status of the operation
-#
-# Since: 4.10.0
-#
-# Notes:
-# XXX: This structure actually contains all of the VMDiskDevice info as well and that should be removed
-##
-{'type': 'MergeStatus',
- 'data': {'disk': 'str', 'status': 'MergeStatusCode'}}
-
-##
-# @VM.mergeStatus:
-#
-# Check the status of an ongoing snapshot merge operation.
-#
-# @vmID:  The UUID of the VM
-#
-# Returns:
-# Status information for each VM disk
-#
-# Since: 4.10.0
-##
-{'command': {'class': 'VM', 'name': 'mergeStatus'},
- 'data': {'vmID': 'UUID'},
- 'returns': ['MergeStatus']}
-
-##
 # @VM.setBalloonTarget:
 #
 # Dynamically change the target amount of physical memory allocated to a guest.


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

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