Francesco Romani has uploaded a new change for review.

Change subject: vm: leave VM responsive when sampling ends
......................................................................

vm: leave VM responsive when sampling ends

There is a known and (usually) benign
race between the sampling thread and the libvirt
event handler.

In extremely unlucky and unlikely cases, it may
happen that the Vm is leaved marked as unresponsive
by this race.

This has been observed while reproducing bz#1142776.
This patch adds more protection to this case by marking
the Vm as responsive when sampling thread ends.

Change-Id: I2ee3205da94152bfd39197dae6c06d00c06e1d58
Related-To: https://bugzilla.redhat.com/1142776
Signed-off-by: Francesco Romani <[email protected]>
---
M vdsm/virt/sampling.py
M vdsm/virt/vm.py
2 files changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/35902/1

diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index eac4873..e6f0204 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -461,6 +461,7 @@
                 self._log.debug("Stats thread failed", exc_info=True)
 
         self._log.debug("Stats thread finished")
+        self._onShutdown(self)
 
     def handleStatsException(self, ex):
         """
@@ -497,6 +498,12 @@
             self._stopEvent.wait(waitInterval)
             intervalAccum = (intervalAccum + waitInterval) % maxInterval
 
+    def _onShutdown(self):
+        """
+        cleanup handler invoked when the stats thread is about to end
+        """
+        pass
+
 
 class HostStatsThread(threading.Thread):
     """
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index dd23db4..7c6bd40 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -590,6 +590,10 @@
 
         return True
 
+    def _onShutdown(self):
+        # ensure the VM is not stuck on unresponsive state
+        self._vm._monitorResponse = 0
+
 
 def _calcDiskRate(vmDrive, sInfo, eInfo, sampleInterval):
     return {


-- 
To view, visit http://gerrit.ovirt.org/35902
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ee3205da94152bfd39197dae6c06d00c06e1d58
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to