Change in vdsm[master]: vm: report exit reason for migration failed

fromani at redhat.com fromani at redhat.com
Thu Feb 27 13:51:17 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: vm: report exit reason for migration failed
......................................................................

vm: report exit reason for migration failed

this patch add reporting for an explicit exit
reason when migration fails, instead of
generic error.

Change-Id: Iab6cb810138e751f8fde784c5f6e0fdaf0f51fa2
Bug-Url: https://bugzilla.redhat.com/697277
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/vm.py
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/64/25164/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index ed8fd08..9d40c95 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -2335,11 +2335,18 @@
             self.recovering = False
             self.saveState()
         except Exception as e:
+            if hasattr(e, 'vm_exit_reason'):
+                exitReason = e.vm_exit_reason
+                exitMessage = ''
+            else:
+                exitReason = vmexitreason.GENERIC_ERROR
+                exitMessage = str(e)
+
             if self.recovering:
                 self.log.info("Skipping errors on recovery", exc_info=True)
             else:
                 self.log.error("The vm start process failed", exc_info=True)
-                self.setDownStatus(ERROR, vmexitreason.GENERIC_ERROR, str(e))
+                self.setDownStatus(ERROR, exitReason, exitMessage)
 
     def _incomingMigrationPending(self):
         return 'migrationDest' in self.conf or 'restoreState' in self.conf
@@ -3755,9 +3762,11 @@
                     state = self._dom.state(0)
                     if state[0] == libvirt.VIR_DOMAIN_PAUSED:
                         if state[1] == libvirt.VIR_DOMAIN_PAUSED_MIGRATION:
-                            raise MigrationError("Migration Error - Timed out "
+                            exc = MigrationError("Migration Error - Timed out "
                                                  "(did not receive success "
                                                  "event)")
+                            exc.vm_exit_reason = vmexitreason.MIGRATION_FAILED
+                            raise exc
                     self.log.debug("NOTE: incomingMigrationFinished event has "
                                    "not been set and wait timed out after %d "
                                    "seconds. Current VM state: %d, reason %d. "
@@ -3771,6 +3780,7 @@
                                   (e.args[0] if len(e.args) else
                                    'Migration Error'))
                         e.args = (newMsg,) + e.args[1:]
+                    e.vm_exit_reason = vmexitreason.MIGRATION_FAILED
                 raise
 
             self._domDependentInit()


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

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