File 2099a194-reset-guest-domain-to-none-on-domain-creation-error.patch of Package virt-manager

Subject: Reset Guest.domain to None on domain creation error
From: Christophe Fergeau cfergeau@redhat.com Thu Apr 13 11:18:46 2017 +0200
Date: Thu Apr 13 14:24:40 2017 -0400:
Git: 2099a1946e22b62d31b954dc3e7b813404c2d019

When an error occurs when the VM creation wizard tries to start the VM,
it's then not possible to press again the "Finish" button to try again
to start it, as this errors out with:

Traceback (most recent call last):
  File "/home/teuf/redhat/virt/virt-manager/virtManager/asyncjob.py", line 88, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/home/teuf/redhat/virt/virt-manager/virtManager/create.py", line 2341, in _do_async_install
    guest.start_install(meter=meter)
  File "/home/teuf/redhat/virt/virt-manager/virtinst/guest.py", line 457, in start_install
    raise RuntimeError(_("Domain has already been started!"))
RuntimeError: Domain has already been started!

This is caused by code introduced in commit fc6778 which does not reset
self.domain to None when an exception is caught.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>

Index: virt-manager-1.4.1/virtinst/guest.py
===================================================================
--- virt-manager-1.4.1.orig/virtinst/guest.py
+++ virt-manager-1.4.1/virtinst/guest.py
@@ -408,6 +408,7 @@ class Guest(XMLBuilder):
                     exc_info = sys.exc_info()
                     try:
                         self.domain.undefine()
+                        self.domain = None
                     except:
                         pass
                     raise exc_info[0], exc_info[1], exc_info[2]
openSUSE Build Service is sponsored by