Merge "Catch exception if servers are in error state with no bm_node attached" into stable/train
This commit is contained in:
commit
da384ef498
|
@ -19,6 +19,7 @@ import re
|
||||||
from oslo_utils import netutils
|
from oslo_utils import netutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from ironicclient import exceptions as ironicexceptions
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
from tripleo_common import exception
|
from tripleo_common import exception
|
||||||
from tripleo_common.utils import glance
|
from tripleo_common.utils import glance
|
||||||
|
@ -708,10 +709,16 @@ def generate_hostmap(baremetal_client, compute_client):
|
||||||
"""Create a map between Compute nodes and Baremetal nodes"""
|
"""Create a map between Compute nodes and Baremetal nodes"""
|
||||||
hostmap = {}
|
hostmap = {}
|
||||||
for node in compute_client.servers.list():
|
for node in compute_client.servers.list():
|
||||||
bm_node = baremetal_client.node.get_by_instance_uuid(node.id)
|
try:
|
||||||
for port in baremetal_client.port.list(node=bm_node.uuid):
|
bm_node = baremetal_client.node.get_by_instance_uuid(node.id)
|
||||||
hostmap[port.address] = {"compute_name": node.name,
|
for port in baremetal_client.port.list(node=bm_node.uuid):
|
||||||
"baremetal_name": bm_node.name}
|
hostmap[port.address] = {"compute_name": node.name,
|
||||||
|
"baremetal_name": bm_node.name}
|
||||||
|
except ironicexceptions.NotFound:
|
||||||
|
LOG.warning('Baremetal node for server %s not found - skipping it',
|
||||||
|
node.id)
|
||||||
|
pass
|
||||||
|
|
||||||
if hostmap == {}:
|
if hostmap == {}:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue