Change in vdsm[master]: periodic: ignore known-benign libvirt errors

fromani at redhat.com fromani at redhat.com
Fri Jan 29 15:38:48 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: periodic: ignore known-benign libvirt errors
......................................................................

periodic: ignore known-benign libvirt errors

perioric sampling threads and migration thread are
(and need to be) asynchronous with each other.
This leaves the door open for errors like

libvirtError: Domain not found: no domain with matching uuid
'7ebb5925-e76f-4d2f-a148-7671c313fe84' (v2)

Which are harmless but spam the logs.
We don't want to hide real errors, but we want to
avoid this noise, so this patch makes periodic Operation
ignore some of these errors, the ones which are easier
to detect.

Change-Id: Ifb5618f44870bdca97fa479734514a3c8d81c7d7
Bug-Url: https://bugzilla.redhat.com/1299480
Backport-To: 3.6
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M tests/periodicTests.py
M vdsm/virt/periodic.py
2 files changed, 42 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/52884/1

diff --git a/tests/periodicTests.py b/tests/periodicTests.py
index 78ce30c..fdd26af 100644
--- a/tests/periodicTests.py
+++ b/tests/periodicTests.py
@@ -22,11 +22,14 @@
 import threading
 import time
 
+import libvirt
+
 from vdsm import executor
 from vdsm import schedule
 from vdsm.utils import monotonic_time
 
 from virt import periodic
+from virt import vmstatus
 
 from testlib import expandPermutations, permutations
 from testlib import VdsmTestCase as TestCaseBase
@@ -233,6 +236,27 @@
                     vm_id, vm_id)
 
 
+class NumaInfoMonitorTests(TestCaseBase):
+
+    def setUp(self):
+        self.vm_id = _fake_vm_id(0)
+        self.vm = _FakeVM(self.vm_id, self.vm_id)
+        def fail(*args):
+            raise fake.Error(libvirt.VIR_ERR_NO_DOMAIN)
+        self.vm.updateNumaInfo = fail
+        self.op = periodic.NumaInfoMonitor(self.vm)
+
+    def test_swallow_exceptions_migrating(self):
+        self.vm.migrating = True
+        self.vm.lastStatus = vmstatus.UP
+        self.assertNotRaises(self.op)
+
+    def test_swallow_exceptions_migrated(self):
+        self.vm.migrating = False
+        self.vm.lastStatus = vmstatus.DOWN
+        self.assertNotRaises(self.op)
+
+
 def _fake_vm_id(i):
     return 'VM-%03i' % i
 
@@ -290,3 +314,11 @@
     def __init__(self, vmId, vmName):
         self.id = vmId
         self.name = vmName
+        self.migrating = False
+        self.lastStatus = vmstatus.UP
+
+    def isMigrating(self):
+        return self.migrating
+
+    def updateNumaInfo(self):
+        pass
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index 31d5269..58fda25 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -25,6 +25,8 @@
 import logging
 import threading
 
+import libvirt
+
 from vdsm import executor
 from vdsm import libvirtconnection
 from vdsm.config import config
@@ -32,6 +34,7 @@
 from . import hoststats
 from . import sampling
 from . import virdomain
+from . import vmstatus
 
 
 # just a made up number. Maybe should be equal to number of cores?
@@ -281,6 +284,7 @@
         return self._vm.isDomainReadyForCommands()
 
     def __call__(self):
+        migrating = self._vm.isMigrating()
         try:
             self._execute()
         except virdomain.NotConnectedError:
@@ -289,6 +293,12 @@
             # both cases: let's reduce the log spam.
             self._vm.log.warning('could not run on %s: domain not connected',
                                  self._vm.id)
+        except libvirt.libvirtError as e:
+            if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
+                # known benign cases: migration in progress or completed
+                if migrating or self._vm.lastStatus == vmstatus.DOWN:
+                    return
+            raise
 
     def _execute(self):
         raise NotImplementedError


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

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