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 fsimonce@redhat.com --- 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 fsimonce@redhat.com
Ayal Baron has posted comments on this change.
Change subject: vm: refresh all volumes after migration ......................................................................
Patch Set 1: Looks good to me, but someone else must approve
-- To view, visit http://gerrit.ovirt.org/8518 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ibe0bd784e68f162b7902bb6ae50ff183d9f8fa8a Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Daniel P. Berrange berrange@redhat.com
Ayal Baron has posted comments on this change.
Change subject: vm: refresh all volumes after migration ......................................................................
Patch Set 1: (1 inline comment)
.................................................... File vdsm/libvirtvm.py Line 1637: def refreshAllDrives(self): Line 1638: volInfoList = [] Line 1639: Line 1640: for device in self._devices[vm.DISK_DEVICES][:]: Line 1641: if not device.blockDev or not hasattr(device, 'domainID'): since this test is repeated in several places, please consider refactoring it into a method (other places are possibly currently missing the domainID check even though they should check for it) Line 1642: continue Line 1643: Line 1644: volInfoList.append({ Line 1645: 'domainID': device.domainID,
-- To view, visit http://gerrit.ovirt.org/8518 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ibe0bd784e68f162b7902bb6ae50ff183d9f8fa8a Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Daniel P. Berrange berrange@redhat.com
Itamar Heim has posted comments on this change.
Change subject: vm: refresh all volumes after migration ......................................................................
Patch Set 1:
ping
Itamar Heim has abandoned this change.
Change subject: vm: refresh all volumes after migration ......................................................................
Abandoned
abandoning - old. no reply. not touched for a while. please restore if relevant
vdsm-patches@lists.fedorahosted.org