Merge "libvirt: add supported vif types for virtuozzo virt_type"

This commit is contained in:
Jenkins 2016-11-03 22:40:12 +00:00 committed by Gerrit Code Review
commit 23343c1b41
3 changed files with 32 additions and 11 deletions

View File

@ -641,18 +641,31 @@ class LibvirtVifTestCase(test.NoDBTestCase):
xml = self._get_instance_xml(d, self.vif_bridge) xml = self._get_instance_xml(d, self.vif_bridge)
self._assertModel(xml, network_model.VIF_MODEL_VIRTIO) self._assertModel(xml, network_model.VIF_MODEL_VIRTIO)
def test_model_kvm_qemu_custom(self): def test_model_parallels(self):
for virt in ('kvm', 'qemu'): self.flags(use_virtio_for_bridges=True,
virt_type='parallels',
group='libvirt')
d = vif.LibvirtGenericVIFDriver()
xml = self._get_instance_xml(d, self.vif_bridge)
self._assertModel(xml, network_model.VIF_MODEL_VIRTIO)
def test_model_kvm_qemu_parallels_custom(self):
for virt in ('kvm', 'qemu', 'parallels'):
self.flags(use_virtio_for_bridges=True, self.flags(use_virtio_for_bridges=True,
virt_type=virt, virt_type=virt,
group='libvirt') group='libvirt')
d = vif.LibvirtGenericVIFDriver() d = vif.LibvirtGenericVIFDriver()
supported = (network_model.VIF_MODEL_NE2K_PCI, if virt == 'parallels':
network_model.VIF_MODEL_PCNET, supported = (network_model.VIF_MODEL_RTL8139,
network_model.VIF_MODEL_RTL8139, network_model.VIF_MODEL_E1000)
network_model.VIF_MODEL_E1000, else:
network_model.VIF_MODEL_SPAPR_VLAN) supported = (network_model.VIF_MODEL_NE2K_PCI,
network_model.VIF_MODEL_PCNET,
network_model.VIF_MODEL_RTL8139,
network_model.VIF_MODEL_E1000,
network_model.VIF_MODEL_SPAPR_VLAN)
for model in supported: for model in supported:
image_meta = objects.ImageMeta.from_dict( image_meta = objects.ImageMeta.from_dict(
{'properties': {'hw_vif_model': model}}) {'properties': {'hw_vif_model': model}})

View File

@ -68,6 +68,9 @@ def is_vif_model_valid_for_virt(virt_type, vif_model):
network_model.VIF_MODEL_E1000], network_model.VIF_MODEL_E1000],
'lxc': [], 'lxc': [],
'uml': [], 'uml': [],
'parallels': [network_model.VIF_MODEL_VIRTIO,
network_model.VIF_MODEL_RTL8139,
network_model.VIF_MODEL_E1000],
} }
if vif_model is None: if vif_model is None:
@ -107,10 +110,10 @@ class LibvirtGenericVIFDriver(object):
if image_meta: if image_meta:
model = osinfo.HardwareProperties(image_meta).network_model model = osinfo.HardwareProperties(image_meta).network_model
# Else if the virt type is KVM/QEMU, use virtio according # Else if the virt type is KVM/QEMU/VZ(Parallels), then use virtio
# to the global config parameter # according to the global config parameter
if (model is None and if (model is None and
virt_type in ('kvm', 'qemu') and virt_type in ('kvm', 'qemu', 'parallels') and
CONF.libvirt.use_virtio_for_bridges): CONF.libvirt.use_virtio_for_bridges):
model = network_model.VIF_MODEL_VIRTIO model = network_model.VIF_MODEL_VIRTIO
@ -124,7 +127,7 @@ class LibvirtGenericVIFDriver(object):
model): model):
raise exception.UnsupportedHardware(model=model, raise exception.UnsupportedHardware(model=model,
virt=virt_type) virt=virt_type)
if (virt_type == 'kvm' and if (virt_type in ('kvm', 'parallels') and
model == network_model.VIF_MODEL_VIRTIO): model == network_model.VIF_MODEL_VIRTIO):
vhost_drv, vhost_queues = self._get_virtio_mq_settings(image_meta, vhost_drv, vhost_queues = self._get_virtio_mq_settings(image_meta,
inst_type) inst_type)

View File

@ -0,0 +1,5 @@
---
features:
- A list of valid vif models is extended for
Virtuozzo hypervisor (virt_type=parallels) with
VIRTIO, RTL8139 and E1000 models.