Skip to content
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

list disks by node #29

Open
ghost opened this issue May 8, 2018 · 2 comments
Open

list disks by node #29

ghost opened this issue May 8, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented May 8, 2018

Feature request
the command:

sfcli -n <connection> list drive list

should have a '--node <node_id>' option to list all drives belonging to a node.
Use case when removing a node from the cluster, all its drives need to be removed first and listing this way would help.

@scaleoutsean
Copy link
Contributor

A similar enhancement request was accepted for PS here:

solidfire/PowerShell#36

@scaleoutsean
Copy link
Contributor

It's not going to happen soon, it seems, so here are some ideas:

  • CLI: store output in JSON file and then do some massaging to extract the fields you want. Example with jq:
$ sfcli -m 192.168.1.34 -u admin -p admin drive list | jq '.drives | .[] | {id: .drive_id, slot: .slot, node: .node_id}' 

Output:

{
  "id": 1,
  "slot": 1,
  "node": 1
}
{
  "id": 2,
  "slot": 2,
  "node": 1
}
{
  "id": 3,
  "slot": 3,
  "node": 1
}
{
  "id": 4,
  "slot": 4,
  "node": 1
}
  • Simplify further and use SolidFire Python SDK to get this info easily. You can still call sfcli from Python if the rest of your script is written in SolidFire CLI:
node_list = sfe.list_active_nodes().to_json()['nodes']
drive_list = sfe.list_drives().to_json()['drives']
for node in node_list:
    for drive in drive_list:
        if drive['nodeID'] == node['nodeID']:
            print("Drive", drive['driveID'], "is in chassis slot", drive['chassisSlot'], "of node", node['nodeID'])

Output:

Drive 1 is in chassis slot 1 of node 1
Drive 2 is in chassis slot 2 of node 1
Drive 3 is in chassis slot 3 of node 1
Drive 4 is in chassis slot 4 of node 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant