Change in vdsm[master]: vm: safer handling of conf in restore

fromani at redhat.com fromani at redhat.com
Mon Jan 11 15:17:25 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: vm: safer handling of conf in restore
......................................................................

vm: safer handling of conf in restore

In the restore state (aka dehibernation) path, there
are a few places left on which the code mutates
Vm.conf without the protection of the confLock.
There is no obvious reason to have those mutation
unguarded, so this patch adds the confLock protection.

Change-Id: Ia46be9c779589b8c27395ced7904efb7de8cacc7
Bug-Url: https://bugzilla.redhat.com/1296936
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/51657/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9eda9af..926c66b 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1903,7 +1903,8 @@
             hooks.before_vm_start(self._buildDomainXML(), self.conf)
 
             fromSnapshot = self.conf.get('restoreFromSnapshot', False)
-            srcDomXML = self.conf.pop('_srcDomXML')
+            with self._confLock:
+                srcDomXML = self.conf.pop('_srcDomXML')
             if fromSnapshot:
                 srcDomXML = self._correctDiskVolumes(srcDomXML)
                 srcDomXML = self._correctGraphicsConfiguration(srcDomXML)
@@ -2834,8 +2835,9 @@
     def _completeIncomingMigration(self):
         if 'restoreState' in self.conf:
             self.cont()
-            del self.conf['restoreState']
-            fromSnapshot = self.conf.pop('restoreFromSnapshot', False)
+            with self._confLock:
+                del self.conf['restoreState']
+                fromSnapshot = self.conf.pop('restoreFromSnapshot', False)
             hooks.after_vm_dehibernate(self._dom.XMLDesc(0), self.conf,
                                        {'FROM_SNAPSHOT': fromSnapshot})
             self._syncGuestTime()
@@ -4686,7 +4688,8 @@
         if not self._pathsPreparedEvent.isSet():
             self.log.debug('Timeout while waiting for path preparation')
             return False
-        srcDomXML = self.conf.pop('_srcDomXML').encode('utf-8')
+        with self._confLock:
+            srcDomXML = self.conf.pop('_srcDomXML').encode('utf-8')
         self._updateDevicesDomxmlCache(srcDomXML)
 
         for dev in self._customDevices():


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

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