Greg Padgett has uploaded a new change for review.

Change subject: agent: don't crash on failed migrateStatus
......................................................................

agent: don't crash on failed migrateStatus

A failed migration would trigger an unexpected failure within the agent.
Instead, catch the failure and process it appropriately.

Change-Id: I9da40599098446e6915a2bd675096d00fa07516d
Bug-Url: https://bugzilla.redhat.com/1026377
Signed-off-by: Greg Padgett <gpadg...@redhat.com>
---
M ovirt_hosted_engine_ha/agent/hosted_engine.py
1 file changed, 23 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-ha 
refs/changes/75/21275/1

diff --git a/ovirt_hosted_engine_ha/agent/hosted_engine.py 
b/ovirt_hosted_engine_ha/agent/hosted_engine.py
index f547315..a3ee6ed 100644
--- a/ovirt_hosted_engine_ha/agent/hosted_engine.py
+++ b/ovirt_hosted_engine_ha/agent/hosted_engine.py
@@ -1111,23 +1111,31 @@
                     = self.MigrationStatus.IN_PROGRESS
 
         else:
-            res = vdsc.run_vds_client_cmd(
-                '0',
-                use_ssl,
-                'migrateStatus',
-                vm_id,
-            )
-            self._log.info("Migration status: %s", res['status']['message'])
-
-            if res['status']['message'].startswith('Migration in progress'):
-                self._rinfo['migration-status'] \
-                    = self.MigrationStatus.IN_PROGRESS
-            elif res['status']['message'].startswith('Migration done'):
-                self._rinfo['migration-status'] \
-                    = self.MigrationStatus.DONE
-            else:
+            try:
+                res = vdsc.run_vds_client_cmd(
+                    '0',
+                    use_ssl,
+                    'migrateStatus',
+                    vm_id,
+                )
+            except:
+                self._log.error("Failed to migrate", exc_info=True)
                 self._rinfo['migration-status'] \
                     = self.MigrationStatus.FAILURE
+            else:
+                self._log.info("Migration status: %s",
+                               res['status']['message'])
+
+                if res['status']['message'] \
+                        .startswith('Migration in progress'):
+                    self._rinfo['migration-status'] \
+                        = self.MigrationStatus.IN_PROGRESS
+                elif res['status']['message'].startswith('Migration done'):
+                    self._rinfo['migration-status'] \
+                        = self.MigrationStatus.DONE
+                else:
+                    self._rinfo['migration-status'] \
+                        = self.MigrationStatus.FAILURE
 
         self._log.debug("Symbolic migration status is %s",
                         self._rinfo['migration-status'])


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9da40599098446e6915a2bd675096d00fa07516d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett <gpadg...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to