Merge "Allow fencing config generation before deployment."

This commit is contained in:
Zuul 2018-05-07 11:37:57 +00:00 committed by Gerrit Code Review
commit 14276a66fc
2 changed files with 9 additions and 4 deletions

View File

@ -377,12 +377,12 @@ class GenerateFencingParametersAction(base.TripleOAction):
# If the MAC isn't in the hostmap, this node hasn't been
# provisioned, so no fencing parameters are necessary
if mac_addr not in hostmap:
if hostmap and mac_addr not in hostmap:
continue
# Build up fencing parameters based on which Ironic driver this
# node is using
if node["pm_type"] == "pxe_ssh":
if hostmap and node["pm_type"] == "pxe_ssh":
# Ironic fencing driver
node_data["agent"] = "fence_ironic"
params["auth_url"] = self.os_auth["auth_url"]
@ -401,7 +401,9 @@ class GenerateFencingParametersAction(base.TripleOAction):
params["ipaddr"] = node["pm_addr"]
params["passwd"] = node["pm_password"]
params["login"] = node["pm_user"]
params["pcmk_host_list"] = hostmap[mac_addr]["compute_name"]
if hostmap:
params["pcmk_host_list"] = \
hostmap[mac_addr]["compute_name"]
if "pm_port" in node:
params["ipport"] = node["pm_port"]
if self.ipmi_lanplus:

View File

@ -664,7 +664,10 @@ def generate_hostmap(baremetal_client, compute_client):
for port in baremetal_client.port.list(node=bm_node.uuid):
hostmap[port.address] = {"compute_name": node.name,
"baremetal_name": bm_node.name}
return hostmap
if hostmap == {}:
return None
else:
return hostmap
def run_nova_cell_v2_discovery():