[virt-tools-list] [PATCH] virt-manager: fix exception when create virtuozzo container
Mikhail Feoktistov
mfeoktistov at virtuozzo.com
Wed Oct 5 16:01:37 UTC 2016
In _do_async_install we have a race.
We create domain in guest.start_install() and
it begins to start. Then we check vm.is_shutoff()
but domain doesn't have "running" state.
It's still starting.
Then we try to start it by vm.startup() and
we get an exception from libvirt.
This patch change this logic.
Do not raise exception in the following cases:
We stop domain which is already stopped
We start domain which is already started
The same logic is in Nova project in Openstack
---
virtManager/domain.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/virtManager/domain.py b/virtManager/domain.py
index a707f25..c18395f 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -1372,7 +1372,11 @@ class vmmDomain(vmmLibvirtObject):
@vmmLibvirtObject.lifecycle_action
def shutdown(self):
self._install_abort = True
- self._backend.shutdown()
+ try:
+ self._backend.shutdown()
+ except libvirt.libvirtError, e:
+ if e.get_error_code() != libvirt.VIR_ERR_OPERATION_INVALID:
+ raise
@vmmLibvirtObject.lifecycle_action
def reboot(self):
@@ -1401,7 +1405,11 @@ class vmmDomain(vmmLibvirtObject):
for error in pre_startup_ret:
raise RuntimeError(error)
- self._backend.create()
+ try:
+ self._backend.create()
+ except libvirt.libvirtError, e:
+ if e.get_error_code() != libvirt.VIR_ERR_OPERATION_INVALID:
+ raise
@vmmLibvirtObject.lifecycle_action
def suspend(self):
--
2.5.5
More information about the virt-tools-list
mailing list