Blame SOURCES/virt-manager-Reset-Guest.domain-to-None-on-domain-creation-error.patch

184e0d
From 4cc1a1cbb7c5871f3c2135b1521c368762d0a7c6 Mon Sep 17 00:00:00 2001
184e0d
From: Pavel Hrdina <phrdina@redhat.com>
184e0d
Date: Thu, 13 Apr 2017 11:18:46 +0200
184e0d
Subject: Reset Guest.domain to None on domain creation error
184e0d
184e0d
From: Christophe Fergeau <cfergeau@redhat.com>
184e0d
184e0d
When an error occurs when the VM creation wizard tries to start the VM,
184e0d
it's then not possible to press again the "Finish" button to try again
184e0d
to start it, as this errors out with:
184e0d
184e0d
Traceback (most recent call last):
184e0d
  File "/home/teuf/redhat/virt/virt-manager/virtManager/asyncjob.py", line 88, in cb_wrapper
184e0d
    callback(asyncjob, *args, **kwargs)
184e0d
  File "/home/teuf/redhat/virt/virt-manager/virtManager/create.py", line 2341, in _do_async_install
184e0d
    guest.start_install(meter=meter)
184e0d
  File "/home/teuf/redhat/virt/virt-manager/virtinst/guest.py", line 457, in start_install
184e0d
    raise RuntimeError(_("Domain has already been started!"))
184e0d
RuntimeError: Domain has already been started!
184e0d
184e0d
This is caused by code introduced in commit fc6778 which does not reset
184e0d
self.domain to None when an exception is caught.
184e0d
184e0d
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
184e0d
(cherry picked from commit 2099a1946e22b62d31b954dc3e7b813404c2d019)
184e0d
184e0d
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441902
184e0d
184e0d
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
184e0d
---
184e0d
 virtinst/guest.py | 1 +
184e0d
 1 file changed, 1 insertion(+)
184e0d
184e0d
diff --git a/virtinst/guest.py b/virtinst/guest.py
184e0d
index 0c63434a..19e21b5d 100644
184e0d
--- a/virtinst/guest.py
184e0d
+++ b/virtinst/guest.py
184e0d
@@ -410,6 +410,7 @@ class Guest(XMLBuilder):
184e0d
                     exc_info = sys.exc_info()
184e0d
                     try:
184e0d
                         self.domain.undefine()
184e0d
+                        self.domain = None
184e0d
                     except:
184e0d
                         pass
184e0d
                     raise exc_info[0], exc_info[1], exc_info[2]
184e0d
-- 
184e0d
2.13.0
184e0d