Hello Dan Kenigsberg, Francesco Romani, Martin Polednik, Milan Zamazal,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/54949

to review the following change.

Change subject: virt: migration: initialize SourceThread._destServer on __init__
......................................................................

virt: migration: initialize SourceThread._destServer on __init__

Introducing data members during runtime is a bad practice. In this case,
it caused a noisy log distraction when the destination host name could
not be resolved.

This patch initializes _destServer to None, and makes sure it has a
valid value before using it.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1299886
Change-Id: Ie773d7eadbacd1eac6e0929d5f264a5c2d4f6a57
Signed-off-by: Dan Kenigsberg <dan...@redhat.com>
Reviewed-on: https://gerrit.ovirt.org/52897
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani <from...@redhat.com>
Reviewed-by: Milan Zamazal <mzama...@redhat.com>
Reviewed-by: Martin Polednik <mpoled...@redhat.com>
---
M vdsm/virt/migration.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/54949/1

diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 63fd1b5..f6a0d58 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -104,6 +104,7 @@
         self._preparingMigrationEvt = True
         self._migrationCanceledEvt = False
         self._monitorThread = None
+        self._destServer = None
 
     @property
     def hibernating(self):
@@ -206,7 +207,7 @@
         if not response.is_error(self.status):
             self.status = response.error('migrateErr')
         self.log.error(message)
-        if not self.hibernating:
+        if not self.hibernating and self._destServer is not None:
             try:
                 self._destServer.destroy(self._vm.id)
             except Exception:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie773d7eadbacd1eac6e0929d5f264a5c2d4f6a57
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Martin Polednik <mpoled...@redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzama...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to