Change in vdsm[master]: virt: extract destroyVm helper
fromani at redhat.com
fromani at redhat.com
Tue Feb 23 17:12:34 UTC 2016
Francesco Romani has uploaded a new change for review.
Change subject: virt: extract destroyVm helper
......................................................................
virt: extract destroyVm helper
add utility method to encapsulate the retry logic,
previously found in destroyVmGraceful().
No changes in external behaviour.
Change-Id: Id152a7aae3d4f644f34703f7f0b5f98035e4e295
Bug-Url: https://bugzilla.redhat.com/1309884
Backport-To: 3.6
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 11 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/32/53932/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9493110..328cf01 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3832,7 +3832,7 @@
self._incomingMigrationFinished.set()
self.guestAgent.stop()
if self._dom.connected:
- result = self._destroyVmGraceful()
+ result = self._destroyVm()
if response.is_error(result):
return result
@@ -3856,7 +3856,14 @@
return response.success()
+ def _destroyVm(self):
+ res, retry = self._destroyVmGraceful()
+ if retry:
+ res = self._destroyVmForceful()
+ return res
+
def _destroyVmGraceful(self):
+ retry = False
try:
self._dom.destroyFlags(libvirt.VIR_DOMAIN_DESTROY_GRACEFUL)
except libvirt.libvirtError as e:
@@ -3870,9 +3877,9 @@
"Failed to destroy VM '%s' gracefully (error=%i)",
self.id, e.get_error_code())
if e.get_error_code() == libvirt.VIR_ERR_OPERATION_FAILED:
- return self._destroyVmForceful()
- return response.error('destroyErr')
- return response.success()
+ retry = True
+ return response.error('destroyErr'), retry
+ return response.success(), retry
def _destroyVmForceful(self):
try:
--
To view, visit https://gerrit.ovirt.org/53932
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id152a7aae3d4f644f34703f7f0b5f98035e4e295
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
More information about the vdsm-patches
mailing list