Browse Source

Merge "Catch exception if servers are in error state with no bm_node attached" into stable/train

changes/78/739578/2
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
da384ef498
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      tripleo_common/utils/nodes.py

+ 11
- 4
tripleo_common/utils/nodes.py View File

@@ -19,6 +19,7 @@ import re
from oslo_utils import netutils
import six

from ironicclient import exceptions as ironicexceptions
from oslo_concurrency import processutils
from tripleo_common import exception
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"""
hostmap = {}
for node in compute_client.servers.list():
bm_node = baremetal_client.node.get_by_instance_uuid(node.id)
for port in baremetal_client.port.list(node=bm_node.uuid):
hostmap[port.address] = {"compute_name": node.name,
"baremetal_name": bm_node.name}
try:
bm_node = baremetal_client.node.get_by_instance_uuid(node.id)
for port in baremetal_client.port.list(node=bm_node.uuid):
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 == {}:
return None
else:


Loading…
Cancel
Save