Change in vdsm[master]: BZ#855924 fix VM config dictionary

peet at redhat.com peet at redhat.com
Mon Oct 22 17:11:03 UTC 2012


Peter V. Saveliev has posted comments on this change.

Change subject: BZ#855924 fix VM config dictionary
......................................................................


Patch Set 5: Verified

(3 inline comments)

....................................................
File vdsm/vm.py
Line 213:         Remove from the VM config drives list "cdrom" and "floppy"
Line 214:         items and set them up as full paths
Line 215:         """
Line 216:         # care only about "drives" list
Line 217:         if 'drives' in self._vm.conf:
do not use list creation
Line 218:             remove_drives = []
Line 219:             for drive in self._vm.conf['drives']:
Line 220:                 if drive['device'] in ('cdrom', 'floppy'):
Line 221:                     self._vm.conf[drive['device']] = drive['path']


Line 214:         items and set them up as full paths
Line 215:         """
Line 216:         # care only about "drives" list
Line 217:         if 'drives' in self._vm.conf:
Line 218:             remove_drives = []
use new list only for removal drives — assuming it will be rarely than usual cases
Line 219:             for drive in self._vm.conf['drives']:
Line 220:                 if drive['device'] in ('cdrom', 'floppy'):
Line 221:                     self._vm.conf[drive['device']] = drive['path']
Line 222:                     remove_drives.append(drive)


Line 216:         # care only about "drives" list
Line 217:         if 'drives' in self._vm.conf:
Line 218:             remove_drives = []
Line 219:             for drive in self._vm.conf['drives']:
Line 220:                 if drive['device'] in ('cdrom', 'floppy'):
`in (X, Y)` is not significantly slower than `X or Y`, but seems more readable
Line 221:                     self._vm.conf[drive['device']] = drive['path']
Line 222:                     remove_drives.append(drive)
Line 223:             for drive in remove_drives:
Line 224:                 self._vm.conf['drives'].pop(


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I33e957f8daac4266d9e19cc008cf830bd395fffe
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Gal Hammer <ghammer at redhat.com>
Gerrit-Reviewer: Igor Lvovsky <ilvovsky at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek at redhat.com>
Gerrit-Reviewer: Peter V. Saveliev <peet at redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>


More information about the vdsm-patches mailing list