Add nics information to ironic inventory
Addition of information in the form required by the playbooks and modules to potentially permit bulk actions involving network MAC addresses, which ideally would involve configuraiton drives or potentially deleting nodes in a particular state, if the user were to so choose to write a playbook to do so. Change-Id: Icb12d985998a81ee4956db7b076aa1911909da0a
This commit is contained in:
parent
00bea38f02
commit
aeff750bf9
@ -314,15 +314,25 @@ def _process_shade(groups, hostvars):
|
|||||||
else:
|
else:
|
||||||
name = machine['name']
|
name = machine['name']
|
||||||
new_machine = {}
|
new_machine = {}
|
||||||
# TODO(TheJulia): At some point we need to retrieve the list of
|
|
||||||
# mac addresses from the ports and provide that information in the
|
|
||||||
# inventory output.
|
|
||||||
for key, value in six.iteritems(machine):
|
for key, value in six.iteritems(machine):
|
||||||
# NOTE(TheJulia): We don't want to pass infomrational links
|
# NOTE(TheJulia): We don't want to pass infomrational links
|
||||||
# nor do we want to pass links about the ports since they
|
# nor do we want to pass links about the ports since they
|
||||||
# are API endpoint URLs.
|
# are API endpoint URLs.
|
||||||
if key not in ['links', 'ports']:
|
if key not in ['links', 'ports']:
|
||||||
new_machine[key] = value
|
new_machine[key] = value
|
||||||
|
|
||||||
|
# NOTE(TheJulia): Collect network information, enumerate through
|
||||||
|
# and extract important values, presently MAC address. Once done,
|
||||||
|
# return the network information to the inventory.
|
||||||
|
nics = cloud.list_nics_for_machine(machine['uuid'])
|
||||||
|
new_nics = []
|
||||||
|
new_nic = {}
|
||||||
|
for nic in nics:
|
||||||
|
if 'address' in nic:
|
||||||
|
new_nic['mac'] = nic['address']
|
||||||
|
new_nics.append(new_nic)
|
||||||
|
new_machine['nics'] = new_nics
|
||||||
|
|
||||||
new_machine['addressing_mode'] = "dhcp"
|
new_machine['addressing_mode'] = "dhcp"
|
||||||
groups['baremetal']['hosts'].append(name)
|
groups['baremetal']['hosts'].append(name)
|
||||||
hostvars.update({name: new_machine})
|
hostvars.update({name: new_machine})
|
||||||
|
Loading…
Reference in New Issue
Block a user