-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Node List Function With Baremetal and Lease Info #6
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,48 @@ | |
from esi.lib import networks | ||
|
||
|
||
def node_list_full_info(connection): | ||
"""Get a list of nodes with more attributes | ||
|
||
:param connection: An ESI connection | ||
:type connection: :class:`~esi.connection.ESIConnection` | ||
|
||
:returns: A list of dictionaries containing baremetal and lease information | ||
""" | ||
|
||
esi_nodes = [] | ||
baremetal_nodes = [] | ||
|
||
with concurrent.futures.ThreadPoolExecutor() as executor: | ||
f1 = executor.submit(connection.list_nodes) | ||
f2 = executor.submit(connection.baremetal.nodes, details=True) | ||
esi_nodes = f1.result() | ||
baremetal_nodes = list(f2.result()) | ||
|
||
esi_nodes.sort(key=lambda node: node.name) | ||
baremetal_nodes.sort(key=lambda node: node.name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I admit that this sort of implicit matching makes me nervous, especially because I think Ironic node names don't actually have to be unique. In addition it depends on the two services returning the same list of nodes - which they should do, but if the behavior changes in one then the results will be messed up. |
||
|
||
return [ | ||
{ | ||
'uuid': bm.id, | ||
'name': bm.name, | ||
'maintenance': bm.is_maintenance, | ||
'provision_state': bm.provision_state, | ||
'target_provision_state': bm.target_provision_state, | ||
'power_state': bm.power_state, | ||
'target_power_state': bm.target_power_state, | ||
'properties': bm.properties, | ||
'lease_uuid': e.lease_uuid, | ||
'owner': e.owner, | ||
'lessee': e.lessee, | ||
'resource_class': e.resource_class, | ||
'future_offers': e.future_offers, | ||
'future_leases': e.future_leases, | ||
} | ||
for e, bm in zip(esi_nodes, baremetal_nodes) | ||
] | ||
|
||
|
||
def node_and_port_list(connection, filter_node=None): | ||
"""Get lists baremetal nodes and ports | ||
|
||
|
@@ -61,7 +103,7 @@ def network_list(connection, filter_node=None, filter_network=None): | |
'network_info': [ | ||
{ | ||
'baremetal_port': openstack.baremetal.v1.port.Port, | ||
'network_port': [openstack.network.v2.port.Port] or [], | ||
'network_ports': [openstack.network.v2.port.Port] or [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this effect python-esiclient? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not affect python-esiclient, just a documentation error |
||
'networks': { | ||
'parent': openstack.network.v2.network.Network or None, | ||
'trunk': [openstack.network.v2.network.Network] or [], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd clarify this as "list of nodes with information from Ironic and ESI-Leap"