linstor-client icon indicating copy to clipboard operation
linstor-client copied to clipboard

Mess with aux properties

Open kvaps opened this issue 5 years ago • 1 comments

Hi, there is bit mess with aux properties, eg:

linstor n sp --aux foo bar # sets foo property, but 
linstor n sp --aux foo=bar # removes one
linstor n sp Aux/foo bar # doing the same like
linstor n sp --aux foo bar

# but only first variant is allowed for query
linstor n l --prop Aux/foo

# however node list shows 'Aux properties' column with Aux/ prefix: 
linstor n l --show-aux-props
+------------------------------------------------------------------------------+
| Node  | NodeType  | Addresses               | AuxProps              | State  |
|==============================================================================|
| m1c4  | SATELLITE | 10.28.36.164:3367 (SSL) | Aux/side=a            | Online |
|       |           |                         | Aux/moonshot=1        |        |
|       |           |                         | Aux/opennebula-1=true |        |
|------------------------------------------------------------------------------|
...
linstor rg m test3 --replicas-on-same foo bar #specifies two keys
linstor rg l -r test3 # also shows 'Aux/' prefix
+-------------------------------------------------------------------------------+
| ResourceGroup | SelectFilter                           | VlmNrs | Description |
|===============================================================================|
| test3         | PlaceCount: 2                          |        |             |
|               | ReplicasOnSame: ['Aux/foo', 'Aux/bar'] |        |             |
+-------------------------------------------------------------------------------+
# but
linstor rg m test3 --replicas-on-same aaa=ddd # specifies key value
linstor rg l -r test3
+------------------------------------------------------------------------+
| ResourceGroup | SelectFilter                    | VlmNrs | Description |
|========================================================================|
| test3         | PlaceCount: 2                   |        |             |
|               | ReplicasOnSame: ['Aux/aaa=ddd'] |        |             |
+------------------------------------------------------------------------+
linstor rg m test3 --replicas-on-same # will not delete the property
linstor rg l -r test3
+------------------------------------------------------------------------+
| ResourceGroup | SelectFilter                    | VlmNrs | Description |
|========================================================================|
| test3         | PlaceCount: 2                   |        |             |
|               | ReplicasOnSame: ['Aux/aaa=ddd'] |        |             |
+------------------------------------------------------------------------+

# but does
linstor rg m test3 --replicas-on-same=
linstor rg l -r test3
+------------------------------------------------------+
| ResourceGroup | SelectFilter  | VlmNrs | Description |
|======================================================|
| test3         | PlaceCount: 2 |        |             |
+------------------------------------------------------+

Also I'm not sure if python args allows to modify help message, but I think to specifying positional arguments in first place is most preferred than keys, since keys might have multiple words inside, eg:

usage: linstor resource-group modify name [-h] [-d DESCRIPTION]
                                     [--storage-pool STORAGE_POOL]
                                     [--place-count REPLICA_COUNT]
                                     [--do-not-place-with [RESOURCE_NAME [RESOURCE_NAME ...]]]
                                     [--do-not-place-with-regex [RESOURCE_REGEX]]
                                     [--replicas-on-same [REPLICAS_ON_SAME [REPLICAS_ON_SAME ...]]]
                                     [--replicas-on-different [REPLICAS_ON_DIFFERENT [REPLICAS_ON_DIFFERENT ...]]]
                                     [--diskless-on-remaining [DISKLESS_ON_REMAINING]]
                                     [-l LAYER_LIST] [-p PROVIDERS]

In https://github.com/LINBIT/linstor-client/issues/32#issuecomment-610930902 @rp- said :

Just note, the errors from the first comment (even while they are still broken otherwise) are because of how the python parser works, you would have to set the opional argument at the end, like: linstor rg m test --place-count 2 --replicas-on-same room --replicas-on-different rack

I think this is valid for any other commands, eg linstor r c

kvaps avatar May 11 '20 17:05 kvaps

Just short node the help command is not valid anymore:

usage: linstor resource create [-h] [--diskless] [--node-id NODE_ID] [--async]
                               [--nvme-initiator] [--drbd-diskless]
                               [--storage-pool [STORAGE_POOL [STORAGE_POOL ...]]]
                               [--auto-place REPLICA_COUNT]
                               [--do-not-place-with [RESOURCE_NAME [RESOURCE_NAME ...]]]
                               [--do-not-place-with-regex [RESOURCE_REGEX]]
                               [--replicas-on-same [REPLICAS_ON_SAME [REPLICAS_ON_SAME ...]]]
                               [--replicas-on-different [REPLICAS_ON_DIFFERENT [REPLICAS_ON_DIFFERENT ...]]]
                               [--diskless-on-remaining [DISKLESS_ON_REMAINING]]
                               [-l LAYER_LIST] [-p PROVIDERS]
                               [node_name [node_name ...]]
                               resource_definition_name

eg try to run on v1.1.1:

linstor resource create -s DfltDisklessStorPool m1c7 one-vm-563-disk-0

now this is only valid case

linstor resource create m1c7 one-vm-563-disk-0 -s DfltDisklessStorPool

kvaps avatar May 20 '20 15:05 kvaps