Francesco Romani has uploaded a new change for review.
Change subject: migration: avoid stacktrace on known errors
......................................................................
migration: avoid stacktrace on known errors
In migration code, if VM.migrationCreate() fails on destination host,
we raise RuntimeError to abort the normal flow.
However, in the recovery flow, we inconditionally log the stacktrace
of the exception we catched.
This is good for troubleshooiting, but it is a little pointless in
this specific use case: we know already and precisely what failed.
This patch adds a special-purpose exception for this specific, yet
important, failure scenario, and avoids the stacktrace only when
catching this exception.
Change-Id: Ib35cf08a305018912991a47d0de645395a177e9e
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/migration.py
1 file changed, 12 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/43063/1
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index b8e155f..7ea8753 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -52,6 +52,12 @@
VIR_MIGRATE_PARAM_GRAPHICS_URI = 'graphics_uri'
+class MigrationDestinationSetupError(RuntimeError):
+ """
+ Failed to create migration destination VM.
+ """
+
+
class SourceThread(threading.Thread):
"""
A thread that takes care of migration on the source vdsm.
@@ -295,6 +301,9 @@
if '_migrationParams' in self._vm.conf:
del self._vm.conf['_migrationParams']
SourceThread._ongoingMigrations.release()
+ except MigrationDestinationSetupError as e:
+ self._recover(str(e))
+ # we know what happened, no need to dump hollow stack trace
except Exception as e:
self._recover(str(e))
self.log.exception("Failed to migrate")
@@ -326,8 +335,9 @@
if result['status']['code']:
self.status = result
- raise RuntimeError('migration destination error: ' +
- result['status']['message'])
+ raise MigrationDestinationSetupError(
+ 'migration destination error: ' +
+ result['status']['message'])
if config.getboolean('vars', 'ssl'):
transport = 'tls'
else:
--
To view, visit
https://gerrit.ovirt.org/43063
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib35cf08a305018912991a47d0de645395a177e9e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>