Correct controller-0 mgmt mac following bootstrap

The previous commit 319b5602df
did not address the special case where there is a LAG/AE interface
on management network. This commit covers these cases.

Test:
  Bring up a standard system with LAG on management. Verify that
  controller-0 is not in failed state after a force reboot.

Closes-Bug: #1829545
Change-Id: Ia8dd3bda79a59af4cba59686e7bb916c2b86d9bb
Signed-off-by: Tee Ngo <tee.ngo@windriver.com>
This commit is contained in:
Tee Ngo 2019-05-24 12:17:44 -04:00
parent 4cdfe9a8ed
commit 370d591d92
1 changed files with 4 additions and 0 deletions

View File

@ -2374,7 +2374,9 @@ def _create(interface, from_profile=False):
# Get ports
ports = None
ethernet_port_mac = None
uses_if = None
if 'uses' in interface:
uses_if = interface['uses']
if 'ports' in interface:
@ -2411,6 +2413,7 @@ def _create(interface, from_profile=False):
if not from_profile:
# Select appropriate MAC address from lower interface(s)
interface = set_interface_mac(ihost, interface)
ethernet_port_mac = interface['imac']
new_interface = pecan.request.dbapi.iinterface_create(
forihostid,
@ -2502,6 +2505,7 @@ def _create(interface, from_profile=False):
network = pecan.request.dbapi.network_get_by_id(network_id)
if network.type == constants.NETWORK_TYPE_MGMT:
_update_host_mgmt_address(ihost, new_interface.as_dict())
_update_host_mgmt_mac(ihost, ethernet_port_mac)
elif network.type == constants.NETWORK_TYPE_CLUSTER_HOST:
_update_host_cluster_address(ihost,
new_interface.as_dict())