Merge "Adding dev_type field to VIFHostDevice"
This commit is contained in:
commit
aeadc2ea63
@ -70,3 +70,18 @@ class VIFVHostUserModeField(fields.BaseEnumField):
|
||||
|
||||
class ListOfIPAddressField(fields.AutoTypedField):
|
||||
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'
|
||||
|
||||
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
|
||||
'dev_address': osv_fields.PCIAddressField(),
|
||||
|
||||
|
@ -78,9 +78,10 @@ class TestVIFS(base.TestCase):
|
||||
mode=objects.fields.VIFVHostUserMode.CLIENT)
|
||||
|
||||
def test_vif_host_dev_plain(self):
|
||||
self._test_vif(objects.vif.VIFHostDevice,
|
||||
dev_address="0002:24:12.3",
|
||||
vlan=8)
|
||||
self._test_vif(
|
||||
objects.vif.VIFHostDevice,
|
||||
dev_type=objects.fields.VIFVIFHostDeviceDevType.ETHERNET,
|
||||
dev_address="0002:24:12.3", vlan=8)
|
||||
|
||||
def test_vif_host_dev_vepa_qbh(self):
|
||||
prof = objects.vif.VIFPortProfile8021Qbh(
|
||||
|
Loading…
x
Reference in New Issue
Block a user