File virtman-fix-domain-already-running-error.patch of Package virt-manager.10064

References: bsc#1057078, bsc#1078305
Noticed when 'Import existing disk image' is selected in the virt-manager
installation wizard.

Index: virt-manager-1.4.1/virtManager/create.py
===================================================================
--- virt-manager-1.4.1.orig/virtManager/create.py
+++ virt-manager-1.4.1/virtManager/create.py
@@ -2374,7 +2374,11 @@ class vmmCreate(vmmGObjectUI):
         foundvm = None
         while count < 100:
             for vm in self.conn.list_vms():
-                if vm.get_uuid() == guest.uuid:
+                # The assumption is that if uuid's match, the VM has had time to
+                # come up from the start_install call above. If the VM is still
+                # coming up but is still marked as 'shutoff' a second attempt is
+                # made below to start the vm causing an 'already running' error.
+                if not vm.is_shutoff() and vm.get_uuid() == guest.uuid:
                     foundvm = vm
             if foundvm:
                 break
openSUSE Build Service is sponsored by