Implement Redfish power-state retrieval and reset control#112
Conversation
|
Would you mind adding a few lines on how to use the command? I'm not sure I'm trying the examples with [allend@re-head magellan]$ ./magellan power x3000c0s0b0n0 -l
{"level":"info","time":"2025-07-28T13:23:03-06:00","message":"parsing default inventory file from 'collect': "}
{"level":"error","error":"open : no such file or directory","time":"2025-07-28T13:23:03-06:00","message":"failed to read collected inventory from "}
{"level":"error","error":"open : no such file or directory","time":"2025-07-28T13:23:03-06:00","message":"failed to parse inventory file "}I can see that the |
|
That's the correct syntax, but as the error logs show, it's trying to parse a nonexistent inventory file. That needs to be generated by |
0080c9c to
18d00f3
Compare
|
Can you rebase with the latest changes to main? |
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
This avoids making the user guess, or (heaven forbid) manually curl their BMCs, to determine which Redfish reset types are available. Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Shouldn't we be using Viper to get these, rather than assigning directly to variables from Cobra `StringVar` flags? Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
The new BMC_Index field is output by the crawler, and read by the power tool. Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
The config system here seems very half-baked; should ask someone more familiar with how this is set up. It definitely feels like we're not using Viper properly, though. Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Normally, we'd expect a ComputerSystem to live at e.g. `/redfish/v1/Systems/1`, but that `1` is allowed to be a non-integer value. We now support that. Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
There's still a small hard-coded assumption of xname formatting present, but at least the naming doesn't imply that only xnames are allowed. Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
….yaml Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
c2fcb16 to
ca5d77a
Compare
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Signed-off-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
This PR adds a new
powersubcommand, which has three functions:-lflag)-r <ResetType>flag)At the moment, this relies on the YAML output from the
collectsubcommand, but doesn't actually need most of the information — it just needs to be able to look up a node's BMC IP and its index within the BMC's Systems list, given an xname (or other ID). In the future, this could probably be accomplished via an SMD query, retaining SMD as the single source of truth.Also, a
bmc_indexfield is added to theInventoryDetailstruct used bycollect. This is used bypower, and is also sent to SMD (though it should be ignored by the latter).