System Components¶
InfiniSDK allows inspecting the hardware components in the system, and obtaining various attributes about them.
Nodes¶
system.components.nodes
is a collection of infinisdk.infinibox.components.Node
objects:
>>> print('System has {} nodes'.format(system.components.nodes.count()))
System has 3 nodes
Drives¶
InfiniSDK provides several ways of querying the system’s drive information, system.components.enclosures
and system.components.drives
. The first is intended for traversing the actual topology of the system through the Enclosure
component, while the second is an aggregate of all drives in the system (Drive
objects):
>>> for enclosure in system.components.enclosures:
... for drive in enclosure.get_drives():
... pass # <- do something with drive here
>>> for drive in system.components.drives:
... pass # <- do something with drive here
You can also query drives by their attributes, for instance by state:
>>> from infinisdk import Q
>>> for drive in system.components.drives.find(Q.state != 'ACTIVE'):
... print('Drive', drive, 'is not in ACTIVE!!!')
FC Ports¶
For each Node, you can use the Node.get_fc_ports()
method to obtain the FC ports it contains. Each FC port is returned as a Python dictionary containing its attributes
>>> for node in system.components.nodes:
... for fc_port in node.get_fc_ports():
... if not fc_port.is_link_up():
... print('Port', fc_port.get_field('wwpn'), 'of', node, 'is down!')
Use FcPort.disable()
method to disable an FC port
>>> fc_port.disable()
>>> fc_port.is_enabled()
False
Use FcPort.enable()
method to enable an FC port with a given role
>>> fc_port.enable(role='HARD_PORT')
>>> fc_port.is_enabled()
True
Services¶
Use Node.get_service()
to get a service by its name:
>>> node.get_service('mgmt')
<...:Service id=system:0_rack:1_node:3_service:mgmt>
Or get a specific service type (core/mgmt):
>>> s = node.get_management_service()
>>> s = node.get_core_service()