Skip to content

Mess with aux properties #36

@kvaps

Description

@kvaps

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 #32 (comment) @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions