Skip to content

Instantly share code, notes, and snippets.

@jimrollenhagen
Created January 18, 2016 16:29
def _make_rescue_port(self, ironic_node, mac_address=None):
"""Make and return a dict suitable to create a neutron rescue port.
ironic_node -- node dict from ironic api
"""
port_info = utils.get_port_info(ironic_node)
data = {
"port": {
"commit": True,
"switch:hardware_id": ironic_node['uuid'],
"switch:ports": [{
"name": "eth0",
"port": port_info["port0"],
"switch_id": port_info["cab0"]
},
{
"name": "eth1",
"port": port_info["port1"],
"switch_id": port_info["cab1"]
}],
"network_id": RESCUE_UUID,
"tenant_id": "xxx"
}
}
if mac_address:
data["port"]["mac_address"] = mac_address
return data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment