Change in vdsm[master]: vm: destroy: try harder destroying a Vm

fromani at redhat.com fromani at redhat.com
Fri Feb 19 13:20:33 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: vm: destroy: try harder destroying a Vm
......................................................................

vm: destroy: try harder destroying a Vm

The current Vm code to destroy a Vm starts
nice, using graceful destroy, and hits harder
if the nice way fails.

However, the failure of the first graceful attempt
is only detected when libvirt returns a specific error code.
Indeed, the return code of libvirt changed between RHEL6 and RHEL7.
This looks fragile and looks like unnecessary detail.

Digging into history, I was not able to find the reason why we look
for a specific error code.

This patch just drops the specific error code check.
Now Vdsm always uses the harsh way if the nice way fails.

Change-Id: Ic6519bf45565ffb879781926f437811a9bf5302b
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, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/53747/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index df58d1b..1b40172 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3808,7 +3808,7 @@
             self._incomingMigrationFinished.set()
             self.guestAgent.stop()
             if self._dom.connected:
-                result = self._destroyVmGraceful()
+                result = self._destroyVm()
                 if response.is_error(result):
                     return result
 
@@ -3832,6 +3832,12 @@
 
         return response.success()
 
+    def _destroyVm(self):
+        res = self._destroyVmGraceful()
+        if response.is_error(res):
+            res = self._destroyVmForceful()
+        return res
+
     def _destroyVmGraceful(self):
         try:
             self._dom.destroyFlags(libvirt.VIR_DOMAIN_DESTROY_GRACEFUL)
@@ -3844,8 +3850,6 @@
             else:
                 self.log.warning("Failed to destroy VM '%s' gracefully",
                                  self.conf['vmId'], exc_info=True)
-                if e.get_error_code() == libvirt.VIR_ERR_OPERATION_FAILED:
-                    return self._destroyVmForceful()
                 return response.error('destroyErr')
         return {'status': doneCode}
 


-- 
To view, visit https://gerrit.ovirt.org/53747
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6519bf45565ffb879781926f437811a9bf5302b
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