Data interface creation failing due to existing PCI interface

This commit prevents the data interface creation from failing due to
an issue involving a previously created PCI interface.

The function set_defaults() within interface.py was setting the
interface networktype to 'data' if it was originally set to None. Then,
a check was made later to see if the provider network being used in the
newly created data interface was being used by another data interface.
Even though the already created interface's ifclass was set to
'pci-passthrough', the networktype was set to 'data' and this was
causing the data interface creation to fail since the provider network
being assigned to the data interface was already being used by the PCI
interface.

Now, the function set_defaults() sets the networktype properly and the
semantic check for the provider network now checks the ifclass rather
than the networktype.

Closes-Bug: 1795717

Change-Id: I79cbe67fec92552e06189c3592b7a63d17f4c909
Signed-off-by: Patrick Bonnell <patrick.bonnell@windriver.com>
This commit is contained in:
Patrick Bonnell 2018-10-03 13:19:33 -04:00
parent 41b0a21603
commit be0ea9d20c
1 changed files with 4 additions and 3 deletions

View File

@ -794,6 +794,8 @@ def _set_defaults(interface):
)
networks.append(str(network.id))
interface['networks'] = networks
elif interface['ifclass'] in NEUTRON_NETWORK_TYPES:
interface['networktype'] = interface['ifclass']
family_defaults = [constants.NETWORK_TYPE_MGMT,
constants.NETWORK_TYPE_OAM,
@ -1492,10 +1494,9 @@ def _check_interface_data(op, interface, ihost, existing_interface):
for i in interface_list:
if i.id == this_interface_id:
continue
if not i.networktype or not i.providernetworks:
if not i.ifclass or not i.providernetworks:
continue
networktype_l = [network.strip() for network in i.networktype.split(",")]
if constants.NETWORK_TYPE_DATA not in networktype_l:
if constants.NETWORK_TYPE_DATA != i.ifclass:
continue
other_providernetworks = i.providernetworks.split(',')
if pn in other_providernetworks: