Duplicate os-vif datapath offload metadata
This patch duplicates the datapath offload metadata for the openvswitch and agilio_ovs os-vif plugins. The aim is to transition to the composed interface rather than the inherited class, while still providing overlap for at least one release cycle. Change-Id: I1cb58292896642e557e8257c42b2713aed06fc37 Depends-On: I401ee6370dad68e62bc2d089e786a840d91d0267 Signed-off-by: Jan Gutter <jan.gutter@netronome.com> blueprint: generic-os-vif-offloads
This commit is contained in:
parent
4d32b45c15
commit
ecfdec5a6e
|
@ -278,16 +278,26 @@ def _nova_to_osvif_vif_bridge(vif):
|
|||
|
||||
# VIF_TYPE_OVS = 'ovs'
|
||||
def _nova_to_osvif_vif_ovs(vif):
|
||||
vif_name = _get_vif_name(vif)
|
||||
vnic_type = vif.get('vnic_type', model.VNIC_TYPE_NORMAL)
|
||||
profile = objects.vif.VIFPortProfileOpenVSwitch(
|
||||
interface_id=vif.get('ovs_interfaceid') or vif['id'],
|
||||
datapath_type=vif['details'].get(
|
||||
model.VIF_DETAILS_OVS_DATAPATH_TYPE))
|
||||
if vnic_type == model.VNIC_TYPE_DIRECT:
|
||||
datapath_offload = objects.vif.DatapathOffloadRepresentor(
|
||||
representor_name=vif_name,
|
||||
representor_address=vif["profile"]["pci_slot"]
|
||||
)
|
||||
# NOTE(jangutter): in accordance with the generic-os-vif-offloads spec,
|
||||
# the datapath offload info is duplicated in both interfaces for Stein.
|
||||
# The port profile should be transitioned to
|
||||
# VIFPortProfileOpenVSwitch during Train.
|
||||
profile = objects.vif.VIFPortProfileOVSRepresentor(
|
||||
interface_id=vif.get('ovs_interfaceid') or vif['id'],
|
||||
representor_name=_get_vif_name(vif),
|
||||
representor_address=vif["profile"]['pci_slot'])
|
||||
representor_name=vif_name,
|
||||
representor_address=vif["profile"]['pci_slot'],
|
||||
datapath_offload=datapath_offload)
|
||||
obj = _get_vif_instance(
|
||||
vif,
|
||||
objects.vif.VIFHostDevice,
|
||||
|
@ -303,7 +313,7 @@ def _nova_to_osvif_vif_ovs(vif):
|
|||
objects.vif.VIFBridge,
|
||||
port_profile=profile,
|
||||
plugin="ovs",
|
||||
vif_name=_get_vif_name(vif),
|
||||
vif_name=vif_name,
|
||||
bridge_name=_get_hybrid_bridge_name(vif))
|
||||
else:
|
||||
obj = _get_vif_instance(
|
||||
|
@ -311,7 +321,7 @@ def _nova_to_osvif_vif_ovs(vif):
|
|||
objects.vif.VIFOpenVSwitch,
|
||||
port_profile=profile,
|
||||
plugin="ovs",
|
||||
vif_name=_get_vif_name(vif))
|
||||
vif_name=vif_name)
|
||||
if vif["network"]["bridge"] is not None:
|
||||
obj.bridge_name = vif["network"]["bridge"]
|
||||
return obj
|
||||
|
@ -331,10 +341,19 @@ def _nova_to_osvif_vif_agilio_ovs(vif):
|
|||
# VIF.port_profile.representor_address is used by the os-vif plugin's
|
||||
# plug/unplug, this should be the same as VIF.dev_address in the
|
||||
# VNIC_TYPE_DIRECT case.
|
||||
datapath_offload = objects.vif.DatapathOffloadRepresentor(
|
||||
representor_name=vif_name,
|
||||
representor_address=vif["profile"]["pci_slot"]
|
||||
)
|
||||
# NOTE(jangutter): in accordance with the generic-os-vif-offloads spec,
|
||||
# the datapath offload info is duplicated in both interfaces for Stein.
|
||||
# The port profile should be transitioned to
|
||||
# VIFPortProfileOpenVSwitch during Train.
|
||||
profile = objects.vif.VIFPortProfileOVSRepresentor(
|
||||
interface_id=vif.get('ovs_interfaceid') or vif['id'],
|
||||
representor_name=vif_name,
|
||||
representor_address=vif["profile"]["pci_slot"])
|
||||
representor_address=vif["profile"]["pci_slot"],
|
||||
datapath_offload=datapath_offload)
|
||||
if vnic_type == model.VNIC_TYPE_DIRECT:
|
||||
# VIF.dev_address is used by the hypervisor to plug the instance into
|
||||
# the PCI device.
|
||||
|
@ -428,17 +447,18 @@ def _nova_to_osvif_vif_ivs(vif):
|
|||
|
||||
# VIF_TYPE_VROUTER = 'vrouter'
|
||||
def _nova_to_osvif_vif_vrouter(vif):
|
||||
vif_name = _get_vif_name(vif)
|
||||
vnic_type = vif.get('vnic_type', model.VNIC_TYPE_NORMAL)
|
||||
if vnic_type == model.VNIC_TYPE_NORMAL:
|
||||
obj = _get_vif_instance(
|
||||
vif,
|
||||
objects.vif.VIFGeneric,
|
||||
plugin="vrouter",
|
||||
vif_name=_get_vif_name(vif)
|
||||
vif_name=vif_name
|
||||
)
|
||||
elif vnic_type == model.VNIC_TYPE_DIRECT:
|
||||
datapath_offload = objects.vif.DatapathOffloadRepresentor(
|
||||
representor_name=_get_vif_name(vif),
|
||||
representor_name=vif_name,
|
||||
representor_address=vif["profile"]["pci_slot"]
|
||||
)
|
||||
profile = objects.vif.VIFPortProfileBase(
|
||||
|
@ -454,7 +474,7 @@ def _nova_to_osvif_vif_vrouter(vif):
|
|||
)
|
||||
elif vnic_type == model.VNIC_TYPE_VIRTIO_FORWARDER:
|
||||
datapath_offload = objects.vif.DatapathOffloadRepresentor(
|
||||
representor_name=_get_vif_name(vif),
|
||||
representor_name=vif_name,
|
||||
representor_address=vif["profile"]["pci_slot"]
|
||||
)
|
||||
profile = objects.vif.VIFPortProfileBase(
|
||||
|
@ -465,7 +485,7 @@ def _nova_to_osvif_vif_vrouter(vif):
|
|||
objects.vif.VIFVHostUser,
|
||||
port_profile=profile,
|
||||
plugin="vrouter",
|
||||
vif_name=_get_vif_name(vif)
|
||||
vif_name=vif_name
|
||||
)
|
||||
_set_vhostuser_settings(vif, obj)
|
||||
else:
|
||||
|
|
|
@ -541,7 +541,10 @@ class OSVIFUtilTestCase(test.NoDBTestCase):
|
|||
port_profile=osv_objects.vif.VIFPortProfileOVSRepresentor(
|
||||
interface_id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
representor_name="nicdc065497-3c",
|
||||
representor_address="0000:08:08.5"),
|
||||
representor_address="0000:08:08.5",
|
||||
datapath_offload=osv_objects.vif.DatapathOffloadRepresentor(
|
||||
representor_name="nicdc065497-3c",
|
||||
representor_address="0000:08:08.5")),
|
||||
preserve_on_delete=False,
|
||||
vif_name="nicdc065497-3c",
|
||||
network=osv_objects.network.Network(
|
||||
|
@ -584,7 +587,10 @@ class OSVIFUtilTestCase(test.NoDBTestCase):
|
|||
port_profile=osv_objects.vif.VIFPortProfileOVSRepresentor(
|
||||
interface_id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
representor_address="0000:08:08.5",
|
||||
representor_name="nicdc065497-3c",),
|
||||
representor_name="nicdc065497-3c",
|
||||
datapath_offload=osv_objects.vif.DatapathOffloadRepresentor(
|
||||
representor_name="nicdc065497-3c",
|
||||
representor_address="0000:08:08.5")),
|
||||
preserve_on_delete=False,
|
||||
vif_name="nicdc065497-3c",
|
||||
path='/fake/socket',
|
||||
|
@ -701,7 +707,10 @@ class OSVIFUtilTestCase(test.NoDBTestCase):
|
|||
port_profile=osv_objects.vif.VIFPortProfileOVSRepresentor(
|
||||
interface_id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
representor_name="nicdc065497-3c",
|
||||
representor_address="0000:0a:00.1"),
|
||||
representor_address="0000:0a:00.1",
|
||||
datapath_offload=osv_objects.vif.DatapathOffloadRepresentor(
|
||||
representor_name="nicdc065497-3c",
|
||||
representor_address="0000:0a:00.1")),
|
||||
has_traffic_filtering=False,
|
||||
preserve_on_delete=False,
|
||||
network=osv_objects.network.Network(
|
||||
|
|
Loading…
Reference in New Issue