LINBIT / linstor-server

High Performance Software-Defined Block Storage for container, cloud and virtualisation. Fully integrated with Docker, Kubernetes, Openstack, Proxmox etc.
https://docs.linbit.com/docs/linstor-guide/
GNU General Public License v3.0
984 stars 76 forks source link

unable to set drbd placement policy #400

Closed alarmix closed 7 months ago

alarmix commented 7 months ago

we have 4 nodes in 2 datacenters I've created an Aux property for each node, the value is the DC the node is located in. Like this:

+-------------------------------+
| Key              | Value      |
|===============================|
| Aux/nodeLocation | VH         |
| CurStltConnName  | default    |
| NodeUname        | pxnode-vh2 |
+-------------------------------+

Then, I try to create placement restriction to avoid replicas in the same DC and get the following error:

root@pxnode-dp1:~# linstor rg modify --replicas-on-different Aux/nodeLocation ngssd
usage: linstor resource-group modify [-h] [-d DESCRIPTION]
                                     [--peer-slots PEER_SLOTS]
                                     [--storage-pool [STORAGE_POOL [STORAGE_POOL ...]]]
                                     [--diskless-storage-pool [DISKLESS_STORAGE_POOL [DISKLESS_STORAGE_POOL ...]]]
                                     [--place-count REPLICA_COUNT]
                                     [--do-not-place-with [RESOURCE_NAME [RESOURCE_NAME ...]]]
                                     [--do-not-place-with-regex [RESOURCE_REGEX]]
                                     [--replicas-on-same [AUX_PROPERTY [AUX_PROPERTY ...]]]
                                     [--replicas-on-different [AUX_PROPERTY [AUX_PROPERTY ...]]]
                                     [--diskless-on-remaining [DISKLESS_ON_REMAINING]]
                                     [-l LAYER_LIST] [--providers PROVIDERS]
                                     name
linstor resource-group modify: error: too few arguments

What is/are the missing argument/s ?

ghernadi commented 7 months ago

This is an issue with the argparse library we are using to parse the arguments.
Your command gets parsed such that Aux/nodeLocation as well as ngssd being part of the --replicas-on-different list of options, and argparse is therefore complaining about the missing resource-group name.

So to make this command work, just ignore the order what argparse tells you for the order of the arguments and use linstor rg modify $rg_name --replicas-on-different $arg1, i.e.:

linstor rg modify ngssd --replicas-on-different Aux/nodeLocation