Additional fields in enquiry API
Add the boot IP, power mgmt IP and power state of a node to the enquiry API payload Change-Id: Ie89d3f29ba2a88d3dafe99b251ebc4422c300450
This commit is contained in:
parent
fe527999aa
commit
1998b16d5a
@ -37,10 +37,10 @@ def node_list(ctx, output='table'):
|
||||
if output == 'table':
|
||||
pt = PrettyTable()
|
||||
|
||||
pt.field_names = ['Node Name', 'Status', 'CPUs', 'Memory', 'PXE MAC']
|
||||
pt.field_names = ['Node Name', 'Status', 'CPUs', 'Memory', 'PXE MAC', 'Mgmt IP', 'IPMI IP', 'Power State']
|
||||
|
||||
for n in nodelist:
|
||||
pt.add_row([n['hostname'], n['status_name'], n['cpu_count'], n['memory'], n['boot_mac']])
|
||||
pt.add_row([n['hostname'], n['status_name'], n['cpu_count'], n['memory'], n['boot_mac'], n['boot_ip'], n['power_address'], n['power_state']])
|
||||
|
||||
click.echo(pt)
|
||||
elif output == 'json':
|
||||
|
@ -38,7 +38,8 @@ class NodesResource(BaseResource):
|
||||
|
||||
node_view = list()
|
||||
for m in machine_list:
|
||||
node_view.append(dict(hostname=m.hostname, memory=m.memory, cpu_count=m.cpu_count, status_name=m.status_name, boot_mac=m.boot_mac))
|
||||
m.get_power_params()
|
||||
node_view.append(dict(hostname=m.hostname, memory=m.memory, cpu_count=m.cpu_count, status_name=m.status_name, boot_mac=m.boot_mac, power_state=m.power_state, power_address=m.power_parameters.get('power_address'), boot_ip=m.boot_ip))
|
||||
|
||||
resp.body = json.dumps(node_view)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
@ -38,6 +38,7 @@ class Machine(model_base.ResourceBase):
|
||||
'tag_names',
|
||||
'status_name',
|
||||
'boot_mac',
|
||||
'boot_ip',
|
||||
'owner_data',
|
||||
'block_devices',
|
||||
'volume_groups',
|
||||
@ -334,6 +335,7 @@ class Machine(model_base.ResourceBase):
|
||||
if isinstance(obj_dict['boot_interface'], dict):
|
||||
refined_dict['boot_mac'] = obj_dict['boot_interface'][
|
||||
'mac_address']
|
||||
refined_dict['boot_ip'] = obj_dict['boot_interface']['links'][0]['ip_address']
|
||||
|
||||
i = cls(api_client, **refined_dict)
|
||||
return i
|
||||
|
@ -99,7 +99,6 @@ class KeystoneClient(object):
|
||||
:param auth_info: Authentication info to use for building a token if a ``ks_sess`` is not specified
|
||||
:returns: The url string of the endpoint
|
||||
:rtype: str
|
||||
:raises AppError: if the endpoint cannot be resolved
|
||||
"""
|
||||
if ks_sess is None:
|
||||
ks_sess = KeystoneClient.get_ks_session(**auth_info)
|
||||
|
Loading…
Reference in New Issue
Block a user