Merge "SR-IOV: Improve the vnic type check in the neutron api"

This commit is contained in:
Jenkins 2015-11-25 20:11:19 +00:00 committed by Gerrit Code Review
commit 3c67982f7c
2 changed files with 4 additions and 2 deletions

View File

@ -87,6 +87,8 @@ VNIC_TYPE_NORMAL = 'normal'
VNIC_TYPE_DIRECT = 'direct'
VNIC_TYPE_MACVTAP = 'macvtap'
VNIC_TYPES_SRIOV = (VNIC_TYPE_DIRECT, VNIC_TYPE_MACVTAP)
# Constants for the 'vif_model' values
VIF_MODEL_VIRTIO = 'virtio'
VIF_MODEL_NE2K_PCI = 'ne2k_pci'

View File

@ -1043,7 +1043,7 @@ class API(base_api.NetworkAPI):
fields=['binding:vnic_type', 'network_id'])
vnic_type = port.get('binding:vnic_type',
network_model.VNIC_TYPE_NORMAL)
if vnic_type != network_model.VNIC_TYPE_NORMAL:
if vnic_type in network_model.VNIC_TYPES_SRIOV:
net_id = port['network_id']
net = neutron.show_network(net_id,
fields='provider:physical_network').get('network')
@ -1069,7 +1069,7 @@ class API(base_api.NetworkAPI):
vnic_type, phynet_name = self._get_port_vnic_info(
context, neutron, request_net.port_id)
pci_request_id = None
if vnic_type != network_model.VNIC_TYPE_NORMAL:
if vnic_type in network_model.VNIC_TYPES_SRIOV:
request = objects.InstancePCIRequest(
count=1,
spec=[{pci_request.PCI_NET_TAG: phynet_name}],