Skip to content

Commit

Permalink
Support multiple storage pools
Browse files Browse the repository at this point in the history
  • Loading branch information
kvaps committed May 20, 2020
1 parent a3e1d0e commit 1d356a9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Why not simply use the [official Linstor driver](https://github.com/OpenNebula/a
This add-on is compatible with:

* OpenNebula 5.6+
* Linstor server 1.2.0+
* Linstor client 1.0.4+
* Linstor server 1.7.0+
* Linstor client 1.1.1+

## OpenNebula Installation

Expand Down Expand Up @@ -138,7 +138,7 @@ To use your Linstor cluster with the OpenNebula, you need to define a System and
| `CHECKPOINT_REPLICA_COUNT` | Number of replicas for save checkpoint file for suspend and offline migration process. | NO |
| `DO_NOT_PLACE_WITH` | Space separated resources list to avid placing replicas on same place with them. | NO |
| `DO_NOT_PLACE_WITH_REGEX` | Regular expression to avoid placing replicas on same place with targeted resources. | NO |
| `STORAGE_POOL` | Storage pool name to place replicas. | **YES** <sup>2</sup> |
| `STORAGE_POOL` | Space separated storage pool names to place replicas. | **YES** <sup>2</sup> |
| `DISKLESS_POOL` | Diskless pool to place diskless replicas. Default: `DfltDisklessStorPool`. | NO |
| `PREFER_NODE` | `yes` - try to place and copy the data on the node that will afterwards be used by the VM | NO |
| `ENCRYPTION` | `yes` - will enable encryption during volume creation. | NO |
Expand Down
2 changes: 1 addition & 1 deletion datastore/linstor_un/linstor_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ function linstor_attach_diskless {
local RES_HOSTS="$(linstor_get_hosts_for_res $RES)"
if ! [[ " $RES_HOSTS " =~ " $HOST " ]]; then
linstor_exec_and_log \
"resource create -s $DISKLESS_POOL $HOST $RES"
"resource create $HOST $RES -s $DISKLESS_POOL"
EXEC_RC=0
fi

Expand Down
4 changes: 2 additions & 2 deletions datastore/linstor_un/monitor
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if [ -z "$STORAGE_POOL" ]; then
exit -1
fi
STORAGE_POOL=$($LINSTOR -m --output-version v0 resource-group list -r "$RESOURCE_GROUP" \
| $JQ -r ".[][].select_filter.storage_pool")
| $JQ -r '.[][].select_filter.storage_pool_list // [] | join(" ")')
if [ -z "$STORAGE_POOL" ]; then
error_message "Resource group missing 'StoragePool' attribute."
exit -1
Expand All @@ -80,7 +80,7 @@ fi
# ------------ Compute datastore usage -------------

MONITOR_SCRIPT=$(cat <<EOF
$LINSTOR -m --output-version v0 storage-pool list -s "$STORAGE_POOL"
$LINSTOR -m --output-version v0 storage-pool list -s $STORAGE_POOL
EOF
)

Expand Down
4 changes: 2 additions & 2 deletions tm/linstor_un/clone
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ if [ "$CLONE_MODE" = "copy" ]; then
"volume-definition create $DST_RES ${SIZE}M $VOL_CREATE_ARGS"
if [ "${PREFER_NODE,,}" = "yes" ]; then
STORAGE_POOL=${STORAGE_POOL:-$($LINSTOR -m --output-version v0 resource-group list -r "$RESOURCE_GROUP" \
| $JQ -r ".[][].select_filter.storage_pool")}
| $JQ -r '.[][].select_filter.storage_pool_list // [] | join(" ")')}
if [ -z "$STORAGE_POOL" ]; then
error_message "Resource group missing 'StoragePool' attribute."
exit -1
fi
NODE_HAS_STORAGE_POOL=$($LINSTOR -m --output-version v0 storage-pool list --node "$DST_HOST" --storage-pool "$STORAGE_POOL" \
NODE_HAS_STORAGE_POOL=$($LINSTOR -m --output-version v0 storage-pool list --node "$DST_HOST" --storage-pool $STORAGE_POOL \
| $JQ -r ".[].stor_pools[] | .free_space.free_capacity / 1024 > ${SIZE}" )
if [ "$NODE_HAS_STORAGE_POOL" = "true" ]; then
linstor_exec_and_log \
Expand Down
4 changes: 2 additions & 2 deletions tm/linstor_un/mkimage
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ linstor_exec_and_log \

if [ "${PREFER_NODE,,}" = "yes" ]; then
STORAGE_POOL=${STORAGE_POOL:-$($LINSTOR -m --output-version v0 resource-group list -r "$RESOURCE_GROUP" \
| $JQ -r ".[][].select_filter.storage_pool")}
| $JQ -r '.[][].select_filter.storage_pool_list // [] | join(" ")')}
if [ -z "$STORAGE_POOL" ]; then
error_message "Resource group missing 'StoragePool' attribute."
exit -1
fi
NODE_HAS_STORAGE_POOL=$($LINSTOR -m --output-version v0 storage-pool list --node "$DST_HOST" --storage-pool "$STORAGE_POOL" \
NODE_HAS_STORAGE_POOL=$($LINSTOR -m --output-version v0 storage-pool list --node "$DST_HOST" --storage-pool $STORAGE_POOL \
| $JQ -r ".[].stor_pools[] | .free_space.free_capacity / 1024 > ${SIZE}" )
if [ "$NODE_HAS_STORAGE_POOL" = "true" ]; then
linstor_exec_and_log \
Expand Down
4 changes: 2 additions & 2 deletions tm/linstor_un/monitor
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if [ -z "$STORAGE_POOL" ]; then
exit -1
fi
STORAGE_POOL=$($LINSTOR -m --output-version v0 resource-group list -r "$RESOURCE_GROUP" \
| $JQ -r ".[][].select_filter.storage_pool")
| $JQ -r '.[][].select_filter.storage_pool_list // [] | join(" ")')
if [ -z "$STORAGE_POOL" ]; then
error_message "Resource group missing 'StoragePool' attribute."
exit -1
Expand All @@ -80,7 +80,7 @@ fi
# ------------ Compute datastore usage -------------

MONITOR_SCRIPT=$(cat <<EOF
$LINSTOR -m --output-version v0 storage-pool list -s "$STORAGE_POOL"
$LINSTOR -m --output-version v0 storage-pool list -s $STORAGE_POOL
EOF
)

Expand Down

0 comments on commit 1d356a9

Please sign in to comment.