Martin Polednik has uploaded a new change for review. Change subject: vmdevices: factor out default disk interfaces to storage ......................................................................
vmdevices: factor out default disk interfaces to storage One step in an ongoing effort to isolate device functionality. Change-Id: I34a478202224284cb7ba5c5ec28ab0d75a2b0e4b Signed-off-by: Martin Polednik <mpoled...@redhat.com> --- M vdsm/virt/vm.py M vdsm/virt/vmdevices/storage.py 2 files changed, 12 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/40127/1 diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index 331cfcd..8dabd9b 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -662,12 +662,6 @@ def _makeChannelPath(self, deviceName): return constants.P_LIBVIRT_VMCHANNELS + self.id + '.' + deviceName - def _getDefaultDiskInterface(self): - DEFAULT_DISK_INTERFACES = {caps.Architecture.X86_64: 'ide', - caps.Architecture.PPC64: 'scsi', - caps.Architecture.PPC64LE: 'scsi'} - return DEFAULT_DISK_INTERFACES[self.arch] - def __init__(self, cif, params, recover=False): """ Initialize a new VM instance. @@ -824,7 +818,7 @@ removables = [{ 'type': hwclass.DISK, 'device': 'cdrom', - 'iface': self._getDefaultDiskInterface(), + 'iface': vmdevices.storage.DEFAULT_INTERFACE_FOR_ARCH[self.arch], 'path': self.conf.get('cdrom', ''), 'index': 2, 'truesize': 0}] @@ -1035,7 +1029,9 @@ # FIXME: For BC we have now two identical keys: iface = if # Till the day that conf will not returned as a status anymore. drv['iface'] = drv.get('iface') or \ - drv.get('if', self._getDefaultDiskInterface()) + drv.get( + 'if', + vmdevices.storage.DEFAULT_INTERFACE_FOR_ARCH[self.arch]) return confDrives @@ -4409,7 +4405,8 @@ knownDev = True # Add unknown disk device to vm's conf if not knownDev: - archIface = self._getDefaultDiskInterface() + archIface = vmdevices.storage.\ + DEFAULT_INTERFACE_FOR_ARCH[self.arch] iface = archIface if address['type'] == 'drive' else 'pci' diskDev = {'type': hwclass.DISK, 'device': devType, 'iface': iface, 'path': devPath, 'name': name, diff --git a/vdsm/virt/vmdevices/storage.py b/vdsm/virt/vmdevices/storage.py index 82642d3..19531d8 100644 --- a/vdsm/virt/vmdevices/storage.py +++ b/vdsm/virt/vmdevices/storage.py @@ -18,6 +18,8 @@ # Refer to the README and COPYING files for full details of the license # +import caps + from vdsm.config import config from vdsm import constants from vdsm import utils @@ -26,6 +28,10 @@ from .core import Base +DEFAULT_INTERFACE_FOR_ARCH = {caps.Architecture.X86_64: 'ide', + caps.Architecture.PPC64: 'scsi', + caps.Architecture.PPC64LE: 'scsi'} + class DRIVE_SHARED_TYPE: NONE = "none" -- To view, visit https://gerrit.ovirt.org/40127 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I34a478202224284cb7ba5c5ec28ab0d75a2b0e4b Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Polednik <mpoled...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches