Fix ironic interface get issue

Get ironic interface from interface_network db since the previous api
iinterface_get_by_network was removed.

Closes-Bug: 1840031

Change-Id: Iecb3e29a656168b391eba145a410e0445e48f1da
Signed-off-by: Mingyuan Qi <mingyuan.qi@intel.com>
This commit is contained in:
Mingyuan Qi 2019-08-15 16:15:44 +08:00
parent c0ce04ba16
commit 6ce738bf26
1 changed files with 5 additions and 8 deletions

View File

@ -108,14 +108,11 @@ class IronicHelm(openstack.OpenstackBaseHelm):
if self.dbapi is None:
return ironic_port
# find the first interface with ironic network type
networks = self.dbapi.networks_get_by_type(
constants.NETWORK_TYPE_IRONIC)
for network in networks:
interface = self.dbapi.iinterface_get_by_network(network.name)
if interface:
# get first interface as ironic port
ironic_port = self._get_interface_port_name(interface[0])
if ironic_port:
interfaces = self.dbapi.iinterface_get_all()
for iface in interfaces:
for net_type in iface.networktypelist:
if net_type == constants.NETWORK_TYPE_IRONIC:
ironic_port = self._get_interface_port_name(iface)
break
return ironic_port