Peter V. Saveliev has uploaded a new change for review. Change subject: BZ#855924 fix VM config dictionary ......................................................................
BZ#855924 fix VM config dictionary Fix vm.conf dictionary when migrating from 3.1 to 3.0. The issue is that 3.0 defines cdrom and floppy as dedicated dictionary keys, while 3.1 places them among other devices. So we're to discover target VDSM version and change vm.conf to comply the 3.0 format. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=855924 Signed-off-by: Peter V. Saveliev <[email protected]> Change-Id: I33e957f8daac4266d9e19cc008cf830bd3959521 --- M vdsm/vm.py 1 file changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/8378/1 diff --git a/vdsm/vm.py b/vdsm/vm.py index 742e9fd..350bc66 100644 --- a/vdsm/vm.py +++ b/vdsm/vm.py @@ -90,6 +90,7 @@ self.log = vm.log self._vm = vm self._dst = dst + self._dst_version = "" self._mode = mode self._method = method self._dstparams = dstparams @@ -126,6 +127,8 @@ self.log.debug('Destination server is: ' + serverAddress) try: self.log.debug('Initiating connection with destination') + self._dst_version = str(max( + self.destServer.getVdsCapabilities()['info']['supportedRHEVMs'])) status = self.destServer.getVmStats(self._vm.id) if not status['status']['code']: self.log.error("Machine already exists on the destination") @@ -219,6 +222,20 @@ MigrationSourceThread._ongoingMigrations.acquire() try: self.log.debug("migration semaphore acquired") + # patch VM config for targets < 3.1 + if self._dst_version < '3.1': + for i in ('cdrom', 'floppy'): + try: + # add cdrom and floppy as paths + self._vm.conf[i] = [x['path'] for x in \ + self._vm.conf['devices'] if x['device'] == i][0] + # remove them from 'devices' list + [self._vm.conf['devices'].pop( + self._vm.conf['devices'].index(z)) \ + for z in [x for x in \ + self._vm.conf['devices'] if x['device'] == i]] + except: + pass if not mstate: self._vm.conf['_migrationParams'] = {'dst': self._dst, 'mode': self._mode, 'method': self._method, -- To view, visit http://gerrit.ovirt.org/8378 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I33e957f8daac4266d9e19cc008cf830bd3959521 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Peter V. Saveliev <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
