midclt call disk.update payload arguments syntax

gefidalgo

Cadet
Joined
Jan 3, 2019
Messages
9
Does anyone know how to properly pass a payload for disk.update call? i am trying to enable smart on a 60 drive DAS in bulk (intead of activating it by gui going through every disk in the interface)

I read documentation on <http://my server/api/docs/>, but when i try passing the payload I either get error "middlewared.schema.Error: [disk_update] A dict was expected" or "TypeError: update() missing 1 required positional argument: 'data'". i am trying to ("togglesmart": true) on da1 for example.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
It's a little non-obvious, but it's midclt call disk.update <disk identifier> '{ "togglesmart": true }'. However, <disk identifier> isn't the name da1, for example, but the "identifier" field corresponding to da1 from the output of midclt call disk.query | jq, and will be a string consisting of "{serial_lunid}" + the disk serial number + "_" + the disk lunid fields from the disk.query call.

So for your batch job, first run midclt call disk.query | jq | grep identifier, and extract out all the strings beginning with "{serial_lunid}". For each of these, run midclt call disk.update $identifier '{ "togglesmart": true }'.
 
Top