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 for compatibility with targets < 3.1.
The issue was that 3.0 defines cdrom and floppy as dedicated
dictionary keys, while 3.1 places them among other drives.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=855924
Signed-off-by: Peter V. Saveliev <[email protected]>
Change-Id: I33e957f8daac4266d9e19cc008cf830bd395fffe
---
M vdsm/vm.py
1 file changed, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/8627/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index de67420..bc082b6 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -218,6 +218,20 @@
             MigrationSourceThread._ongoingMigrations.acquire()
             try:
                 self.log.debug("migration semaphore acquired")
+                # patch VM config for targets < 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['drives'] if x['device'] == i][0]
+                        # remove them from 'drives' list
+                        [self._vm.conf['drives'].pop(
+                            self._vm.conf['drives'].index(z)) \
+                            for z in [x for x in \
+                            self._vm.conf['drives'] if x['device'] == i]]
+                    # if we have no cdrom or floppy, just continue
+                    except IndexError:
+                        pass
                 if not mstate:
                     self._vm.conf['_migrationParams'] = {'dst': self._dst,
                                 'mode': self._mode, 'method': self._method,


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

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

Reply via email to