Federico Simoncelli has uploaded a new change for review.

Change subject: vm: refresh all volumes after migration
......................................................................

vm: refresh all volumes after migration

After the vm live migration is completed the volumes must be refreshed
to comply with a possible volume extension happened after the migration
started.

Change-Id: Ibe0bd784e68f162b7902bb6ae50ff183d9f8fa8a
Signed-off-by: Federico Simoncelli <[email protected]>
---
M vdsm/libvirtvm.py
M vdsm/vm.py
2 files changed, 32 insertions(+), 7 deletions(-)


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

diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 9f865de..729a288 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -1634,6 +1634,23 @@
         else:
             self._monitorResponse = 0
 
+    def refreshAllDrives(self):
+        volInfoList = []
+
+        for device in self._devices[vm.DISK_DEVICES][:]:
+            if not device.blockDev or not hasattr(device, 'domainID'):
+                continue
+
+            volInfoList.append({
+                'domainID': device.domainID,
+                'poolID': device.poolID,
+                'imageID': device.imageID,
+                'volumeID': device.volumeID,
+            })
+
+        if volInfoList:
+            self.refreshVolumes(volInfoList)
+
     def _waitForIncomingMigrationFinish(self):
         if 'restoreState' in self.conf:
             self.cont()
@@ -1667,8 +1684,11 @@
             del self.conf['guestIPs']
         if 'username' in self.conf:
             del self.conf['username']
+
         self.saveState()
-        self.log.debug("End of migration")
+
+        self.log.debug("Migration ended, refreshing all the drive volumes")
+        self.refreshAllDrives()
 
     def _underlyingCont(self):
         hooks.before_vm_cont(self._dom.XMLDesc(0), self.conf)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 5ea2859..a3c6839 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -742,16 +742,21 @@
         else:
             self.__extendDriveVolume(vmDrive, newSize)
 
-    def __refreshDriveVolume(self, volInfo):
+    def refreshVolumes(self, volInfoList):
         """ Stop vm before refreshing LV. """
-
         self._guestCpuLock.acquire()
         try:
             wasRunning = self._guestCpuRunning
+
             if wasRunning:
                 self.pause(guestCpuLocked=True)
-            self.cif.irs.refreshVolume(volInfo['domainID'],
-                volInfo['poolID'], volInfo['imageID'], volInfo['volumeID'])
+
+            for volInfo in volInfoList:
+                self.cif.irs.refreshVolume(
+                        volInfo['domainID'], volInfo['poolID'],
+                        volInfo['imageID'], volInfo['volumeID']
+                )
+
             if wasRunning:
                 self.cont(guestCpuLocked=True)
         finally:
@@ -759,7 +764,7 @@
 
     def __afterReplicaExtend(self, volInfo):
         self.log.debug("Refreshing replica volume: %s", volInfo)
-        self.__refreshDriveVolume(volInfo)
+        self.refreshVolumes((volInfo,))
 
         vmDrive = self._findDriveByName(volInfo['name'])
 
@@ -778,7 +783,7 @@
 
     def __afterDriveExtend(self, volInfo):
         self.log.debug("Refreshing drive volume: %s", volInfo)
-        self.__refreshDriveVolume(volInfo)
+        self.refreshVolumes((volInfo,))
 
         vmDrive = self._findDriveByName(volInfo['name'])
         res = self.cif.irs.getVolumeSize(vmDrive.domainID, vmDrive.poolID,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe0bd784e68f162b7902bb6ae50ff183d9f8fa8a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to