Vinzenz Feenstra has uploaded a new change for review. Change subject: vdsm: Simplify device map initialization ......................................................................
vdsm: Simplify device map initialization Change-Id: I36b89a0aec6fc1311aba2b9213ee4dc705f43e7e Signed-off-by: Vinzenz Feenstra <[email protected]> --- M vdsm/vm/devices/__init__.py M vdsm/vm/vm.py 2 files changed, 17 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/10867/1 diff --git a/vdsm/vm/devices/__init__.py b/vdsm/vm/devices/__init__.py index d32030b..6b0ed50 100644 --- a/vdsm/vm/devices/__init__.py +++ b/vdsm/vm/devices/__init__.py @@ -35,6 +35,20 @@ SMARTCARD_DEVICES = 'smartcard' +def initDeviceMap(): + return { + DISK_DEVICES: [], + NIC_DEVICES: [], + SOUND_DEVICES: [], + VIDEO_DEVICES: [], + CONTROLLER_DEVICES: [], + GENERAL_DEVICES: [], + BALLOON_DEVICES: [], + REDIR_DEVICES: [], + WATCHDOG_DEVICES: [], + CONSOLE_DEVICES: [], + SMARTCARD_DEVICES: []} + __all__ = [ "DISK_DEVICES", "NIC_DEVICES", diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py index 5f769b5..0302615 100644 --- a/vdsm/vm/vm.py +++ b/vdsm/vm/vm.py @@ -48,7 +48,7 @@ REDIR_DEVICES, WATCHDOG_DEVICES, SMARTCARD_DEVICES, CONSOLE_DEVICES from devices import Drive, NetworkInterfaceDevice, SoundDevice,\ VideoDevice, ControllerDevice, GeneralDevice, BalloonDevice,\ - WatchdogDevice, RedirDevice, ConsoleDevice, SmartCardDevice + WatchdogDevice, RedirDevice, ConsoleDevice, SmartCardDevice, initDeviceMap from vdsm import constants, utils, libvirtconnection from vdsm.config import config import guestIF @@ -156,12 +156,7 @@ self.stopDisksStatsCollection() self._vmCreationEvent = threading.Event() self._pathsPreparedEvent = threading.Event() - self._devices = {DISK_DEVICES: [], NIC_DEVICES: [], - SOUND_DEVICES: [], VIDEO_DEVICES: [], - CONTROLLER_DEVICES: [], GENERAL_DEVICES: [], - BALLOON_DEVICES: [], REDIR_DEVICES: [], - WATCHDOG_DEVICES: [], CONSOLE_DEVICES: [], - SMARTCARD_DEVICES: []} + self._devices = initDeviceMap() def _get_lastStatus(self): PAUSED_STATES = ('Powering down', 'RebootInProgress', 'Up') @@ -240,12 +235,7 @@ return removables def getConfDevices(self): - devices = {DISK_DEVICES: [], NIC_DEVICES: [], - SOUND_DEVICES: [], VIDEO_DEVICES: [], - CONTROLLER_DEVICES: [], GENERAL_DEVICES: [], - BALLOON_DEVICES: [], REDIR_DEVICES: [], - WATCHDOG_DEVICES: [], CONSOLE_DEVICES: [], - SMARTCARD_DEVICES: []} + devices = initDeviceMap() for dev in self.conf.get('devices'): try: devices[dev['type']].append(dev) -- To view, visit http://gerrit.ovirt.org/10867 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I36b89a0aec6fc1311aba2b9213ee4dc705f43e7e Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Vinzenz Feenstra <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
