Adding dev_type field to VIFHostDevice
The dev_type represent the type of the host device. Valid values are ethernet and generic. Ethernet is <interface type='hostdev'> Generic is <hostdev mode='subsystem' type='pci'> The Generic type is usefully for device which is not traditional ethernet NIC device e.g. InfiniBand Change-Id: I3d1b782ba730ab74c627e6b8028150f9e8d15ecd
This commit is contained in:
parent
1ff6526c3d
commit
6a099ff741
|
@ -70,3 +70,18 @@ class VIFVHostUserModeField(fields.BaseEnumField):
|
||||||
|
|
||||||
class ListOfIPAddressField(fields.AutoTypedField):
|
class ListOfIPAddressField(fields.AutoTypedField):
|
||||||
AUTO_TYPE = fields.List(fields.IPAddress())
|
AUTO_TYPE = fields.List(fields.IPAddress())
|
||||||
|
|
||||||
|
|
||||||
|
class VIFVIFHostDeviceDevType(fields.Enum):
|
||||||
|
ETHERNET = 'ethernet'
|
||||||
|
GENERIC = 'generic'
|
||||||
|
|
||||||
|
ALL = (ETHERNET, GENERIC)
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(VIFVIFHostDeviceDevType, self).__init__(
|
||||||
|
valid_values=VIFVIFHostDeviceDevType.ALL)
|
||||||
|
|
||||||
|
|
||||||
|
class VIFVIFHostDeviceDevTypeField(fields.BaseEnumField):
|
||||||
|
AUTO_TYPE = VIFVIFHostDeviceDevType()
|
||||||
|
|
|
@ -132,6 +132,13 @@ class VIFHostDevice(VIFBase):
|
||||||
VERSION = '1.0'
|
VERSION = '1.0'
|
||||||
|
|
||||||
fields = {
|
fields = {
|
||||||
|
|
||||||
|
# The type of the host device.
|
||||||
|
# Valid values are ethernet and generic.
|
||||||
|
# Ethernet is <interface type='hostdev'>
|
||||||
|
# Generic is <hostdev mode='subsystem' type='pci'>
|
||||||
|
'dev_type': osv_fields.VIFVIFHostDeviceDevTypeField(),
|
||||||
|
|
||||||
# The PCI address of the host device
|
# The PCI address of the host device
|
||||||
'dev_address': osv_fields.PCIAddressField(),
|
'dev_address': osv_fields.PCIAddressField(),
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,10 @@ class TestVIFS(base.TestCase):
|
||||||
mode=objects.fields.VIFVHostUserMode.CLIENT)
|
mode=objects.fields.VIFVHostUserMode.CLIENT)
|
||||||
|
|
||||||
def test_vif_host_dev_plain(self):
|
def test_vif_host_dev_plain(self):
|
||||||
self._test_vif(objects.vif.VIFHostDevice,
|
self._test_vif(
|
||||||
dev_address="0002:24:12.3",
|
objects.vif.VIFHostDevice,
|
||||||
vlan=8)
|
dev_type=objects.fields.VIFVIFHostDeviceDevType.ETHERNET,
|
||||||
|
dev_address="0002:24:12.3", vlan=8)
|
||||||
|
|
||||||
def test_vif_host_dev_vepa_qbh(self):
|
def test_vif_host_dev_vepa_qbh(self):
|
||||||
prof = objects.vif.VIFPortProfile8021Qbh(
|
prof = objects.vif.VIFPortProfile8021Qbh(
|
||||||
|
|
Loading…
Reference in New Issue