Hello Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/48414

to review the following change.

Change subject: virt: periodic: reduce NotConnectedError noise
......................................................................

virt: periodic: reduce NotConnectedError noise

The periodic operations have known races on
VM startup and on VM shutdown.

These races are because periodic are asynchronous with
respect to the VM startup/shutdown, and they are benign
because operations will just be always retried again in
the next periodic cycle.

This is particularly visible on loaded servers and/or
slowly-responsive libvirt.

Backport-To: 3.6
Change-Id: I920e3b0b0e80e0a66ad199607068424986933d3a
Signed-off-by: Francesco Romani <from...@redhat.com>
Reviewed-on: https://gerrit.ovirt.org/44813
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <dan...@redhat.com>
---
M tests/periodicTests.py
M vdsm/virt/periodic.py
2 files changed, 20 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/48414/1

diff --git a/tests/periodicTests.py b/tests/periodicTests.py
index 62a602f..21a0e4c 100644
--- a/tests/periodicTests.py
+++ b/tests/periodicTests.py
@@ -253,7 +253,7 @@
             raise ValueError('runnable failed')
         return True
 
-    def __call__(self):
+    def _execute(self):
         _Visitor.VMS[self._vm.id] += 1
 
 
@@ -267,7 +267,7 @@
     def runnable(self):
         return True
 
-    def __call__(self):
+    def _execute(self):
         pass
 
 
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index 73f447e..dc4049a 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -32,6 +32,7 @@
 from vdsm.utils import monotonic_time
 
 from . import sampling
+from . import virdomain
 
 
 # just a made up number. Maybe should be equal to number of cores?
@@ -270,6 +271,19 @@
     def runnable(self):
         return self._vm.isDomainReadyForCommands()
 
+    def __call__(self):
+        try:
+            self._execute()
+        except virdomain.NotConnectedError:
+            # race on startup:  no worries, let's retry again next cycle.
+            # race on shutdown: next cycle won't pick up this VM.
+            # both cases: let's reduce the log spam.
+            self._vm.log.warning('could not run on %s: domain not connected',
+                                 self._vm.id)
+
+    def _execute(self):
+        raise NotImplementedError
+
 
 class UpdateVolumes(_RunnableOnVm):
 
@@ -278,7 +292,7 @@
         # Avoid queries from storage during recovery process
         return self._vm.isDisksStatsCollectionEnabled()
 
-    def __call__(self):
+    def _execute(self):
         for drive in self._vm.getDiskDevices():
             # TODO: If this block (it is actually possible?)
             # we must make sure we don't overwrite good data
@@ -298,7 +312,7 @@
         # (inspected libvirt sources v1.2.17)
         return True
 
-    def __call__(self):
+    def _execute(self):
         self._vm.updateNumaInfo()
 
 
@@ -313,7 +327,7 @@
         # monitor (most often true).
         return self._vm.hasVmJobs
 
-    def __call__(self):
+    def _execute(self):
         self._vm.updateVmJobs()
 
 
@@ -324,5 +338,5 @@
         # Avoid queries from storage during recovery process
         return self._vm.isDisksStatsCollectionEnabled()
 
-    def __call__(self):
+    def _execute(self):
         self._vm.extendDrivesIfNeeded()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I920e3b0b0e80e0a66ad199607068424986933d3a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to