Change in vdsm[ovirt-3.3]: vm: consider 'action' when handling I/O errors

fromani at redhat.com fromani at redhat.com
Wed Apr 23 14:43:17 UTC 2014


Hello Dan Kenigsberg,

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

    http://gerrit.ovirt.org/27016

to review the following change.

Change subject: vm: consider 'action' when handling I/O errors
......................................................................

vm: consider 'action' when handling I/O errors

When VDSM receives an I/O error event from libvirt,
it does not consider the value of the 'action' callback
field, and thus considers the guest CPU stopped.

This is true in the default configuration, which translates
to the disk write error policy 'stop', but not necessarily
true if the said policy is 'enospace'.

In this case the reported state of the CPU goes out of sync.

Since the error policy may be changed through an hook,
the safest thing to do is actually check the 'action'
value as reported by libvirt in the IOError callback.

This patch adds this check, and additional logging in
the case the guest CPU is reported running after I/O
errors.

Change-Id: I9299399c3e5bef7e6e3111aa35e3483827ad57da
Bug-Url: https://bugzilla.redhat.com/1090079
Signed-off-by: Francesco Romani <fromani at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/25157
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Tested-by: Dan Kenigsberg <danken at redhat.com>
---
M vdsm/clientIF.py
M vdsm/vm.py
2 files changed, 17 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/27016/1

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index d08ef9d..7f37659 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -575,7 +575,7 @@
                 v._rtcUpdate(utcoffset)
             elif eventid == libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON:
                 srcPath, devAlias, action, reason = args[:-1]
-                v._onAbnormalStop(devAlias, reason)
+                v._onIOError(devAlias, reason, action)
             elif eventid == libvirt.VIR_DOMAIN_EVENT_ID_GRAPHICS:
                 phase, localAddr, remoteAddr, authScheme, subject = args[:-1]
                 v.log.debug('graphics event phase '
diff --git a/vdsm/vm.py b/vdsm/vm.py
index debc874..ee00d8a 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -4314,20 +4314,28 @@
         graphics.setAttribute('connected', 'keep')
         self._dom.updateDeviceFlags(graphics.toxml(), 0)
 
-    def _onAbnormalStop(self, blockDevAlias, err):
+    def _onIOError(self, blockDevAlias, err, action):
         """
         Called back by IO_ERROR_REASON event
 
         :param err: one of "eperm", "eio", "enospc" or "eother"
         Note the different API from that of Vm._onAbnormalStop
         """
-        self.log.info('abnormal vm stop device %s error %s',
-                      blockDevAlias, err)
-        self.conf['pauseCode'] = err.upper()
-        self._guestCpuRunning = False
-        if err.upper() == 'ENOSPC':
-            if not self.extendDrivesIfNeeded():
-                self.log.info("No VM drives were extended")
+        if action == libvirt.VIR_DOMAIN_EVENT_IO_ERROR_PAUSE:
+            self.log.info('abnormal vm stop device %s error %s',
+                          blockDevAlias, err)
+            self.conf['pauseCode'] = err.upper()
+            self._guestCpuRunning = False
+            if err.upper() == 'ENOSPC':
+                if not self.extendDrivesIfNeeded():
+                    self.log.info("No VM drives were extended")
+        elif action == libvirt.VIR_DOMAIN_EVENT_IO_ERROR_REPORT:
+            self.log.info('I/O error %s device %s reported to guest OS',
+                          err, blockDevAlias)
+        else:
+            # we do not support and do not expect other values
+            self.log.warning('unexpected action %i on device %s error %s',
+                             action, blockDevAlias, err)
 
     def _acpiShutdown(self):
         self._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9299399c3e5bef7e6e3111aa35e3483827ad57da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list