Change in vdsm[master]: vm: properly implement readPauseCode

fromani at redhat.com fromani at redhat.com
Tue Jan 20 09:21:22 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: vm: properly implement readPauseCode
......................................................................

vm: properly implement readPauseCode

VDSM needs to know if a VM was paused for disk space
exhausted, in order to properly extend the disk(s) before
to (re)start it again.

Since the move to libvirt, this code was not implemented.
However, a couple of libvirt APIs which somehow are gone
unnoticed so far, make it possible to implement it.

This patch rebuilds readPauseCode on top of these APIs.
Currently, readPauseCode reports two (made-up) codes:

NOERR - if everything was fine
ENOSPC - if one or more disks was filled

This is because those are the only error conditions the rest
of VDSM code cares about.

Change-Id: Ie2f200e2856669bb7dbcc904898f326b939b1ddd
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 10 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/37118/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index bee1098..b38f105 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2137,7 +2137,7 @@
         self._logGuestCpuStatus('domain initialization')
         if self.lastStatus not in (vmstatus.MIGRATION_DESTINATION,
                                    vmstatus.RESTORING_STATE):
-            self._initTimePauseCode = self._readPauseCode(0)
+            self._initTimePauseCode = self._readPauseCode()
         if not self.recovering and self._initTimePauseCode:
             self.conf['pauseCode'] = self._initTimePauseCode
             if self._initTimePauseCode == 'ENOSPC':
@@ -2969,18 +2969,15 @@
 
         return {'status': doneCode, 'vmList': self.status()}
 
-    def _readPauseCode(self, timeout):
-        # libvirt does not not export yet the I/O error reason code.
-        # we need a way to
-        # 1. detect ENOSPC when connected to a VM.
-        # 2. detect a VM was paused to ENOSPC when reconnecting after
-        #    a VDSM restart.
-        # upstream libvirt unfortunately lacks both features, because
-        # in turn QEMU doesn't yet export the information thorugh the
-        # QMP interface.
-        # libvirt: https://bugzilla.redhat.com/show_bug.cgi?id=1067414
-        # qemu: https://bugs.launchpad.net/qemu/+bug/1284090
-        self.log.debug('_readPauseCode unsupported by libvirt vm')
+    def _readPauseCode(self):
+        state, reason = self._dom.state(0)
+        if (state == libvirt.VIR_DOMAIN_PAUSED and
+           reason == libvirt.VIR_DOMAIN_PAUSED_IOERROR):
+            diskErrors = self._dom.diskErrors()
+            for device, error in diskErrors.iteritems():
+                if error == libvirt.VIR_DOMAIN_DISK_ERROR_NO_SPACE:
+                    self._log.warning('device %s out of space', device)
+                    return 'ENOSPC'
         return 'NOERR'
 
     def _timeoutExperienced(self, timeout):


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

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