Change in vdsm[master]: janitorial: use the response module in migration

fromani at redhat.com fromani at redhat.com
Fri Mar 6 09:26:31 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: janitorial: use the response module in migration
......................................................................

janitorial: use the response module in migration

This patch makes migration.py use the response module.

Change-Id: Iec4642a1f0e0544e8d78cba6865425e14f63eea5
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/migration.py
1 file changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/38446/1

diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 6afa9d4..a4fe63a 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -25,11 +25,12 @@
 
 import hooks
 import kaxmlrpclib
+from vdsm import response
 from vdsm import utils
 from vdsm import vdscli
 from vdsm.compat import pickle
 from vdsm.config import config
-from vdsm.define import NORMAL, errCode, Mbytes
+from vdsm.define import NORMAL, Mbytes
 
 from . import vmexitreason
 from . import vmstatus
@@ -123,10 +124,10 @@
             status = self.destServer.getVmStats(self._vm.id)
             if not status['status']['code']:
                 self.log.error("Machine already exists on the destination")
-                self.status = errCode['exist']
+                self.status = response.error('exist')
         except Exception:
             self.log.exception("Error initiating connection")
-            self.status = errCode['noConPeer']
+            self.status = response.error('noConPeer')
 
     def _setupRemoteMachineParams(self):
         self._machineParams.update(self._vm.status())
@@ -174,7 +175,7 @@
 
     def _recover(self, message):
         if not self.status['status']['code']:
-            self.status = errCode['migrateErr']
+            self.status = response.error('migrateErr')
         self.log.error(message)
         if not self.hibernating:
             try:
@@ -264,9 +265,8 @@
                 self._finishSuccessfully()
             except libvirt.libvirtError as e:
                 if e.get_error_code() == libvirt.VIR_ERR_OPERATION_ABORTED:
-                    self.status['status']['code'] = \
-                        errCode['migCancelErr']['status']['code']
-                    self.status['status']['message'] = 'Migration canceled'
+                    self.status = response.error('migCancelErr',
+                                                 message='Migration canceled')
                 raise
             finally:
                 if '_migrationParams' in self._vm.conf:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec4642a1f0e0544e8d78cba6865425e14f63eea5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list