Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
Signed-off-by: kvaps <[email protected]>
  • Loading branch information
kvaps committed Apr 21, 2019
1 parent f3ddcb8 commit 5bfbf41
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion datastore/linstor_un/cp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ linstor_exec_and_log \
"resource-definition create $DST_RES"
LINSTOR_CLEANUP_RD+=" $DST_RES"
linstor_exec_and_log \
"volume-definition create $VOL_CREATE_ARGS $DST_RES ${ORIGINAL_SIZE_K}K"
"volume-definition create $VOL_CREATE_ARGS $DST_RES ${ORIGINAL_SIZE_B}B"
linstor_exec_and_log \
"resource create $RES_CREATE_ARGS --storage-pool $STORAGE_POOL $NODE_LIST $DST_RES"
Expand Down
9 changes: 4 additions & 5 deletions datastore/linstor_un/linstor_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function linstor_get_hosts_for_res {
function linstor_get_diskless_hosts_for_res {
local RES="$1"
$LINSTOR -m resource list -r $RES | \
$JQ -r '.[].resources[].node_name' | \
$JQ -r '.[].resources[] | select(.rsc_flags[] | contains("DISKLESS")) | .node_name' | \
xargs
}

Expand Down Expand Up @@ -166,7 +166,7 @@ function linstor_get_res_for_vmid {
fi

echo "$RD_DATA" | \
$JQ -r ".[].rsc_dfns[].rsc_name | \
$JQ -r ".[].rsc_dfns[].rsc_name |
select(. | test(\"^one-vm-${VMID}-disk-[0-9]+$\"))"
}

Expand Down Expand Up @@ -202,9 +202,8 @@ function linstor_exec_and_log_no_error {
EXEC_LOG_RC=$?

EXEC_LOG_ERR=$(echo "$EXEC_LOG" | \
$JQ -r '.[] | select(.error_report_ids) | \
.message + \
" Error reports: [ " + (.error_report_ids | join(", ")) + " ]"')
$JQ -r '.[] | select(.error_report_ids) |
.message + " Error reports: [ " + (.error_report_ids | join(", ")) + " ]"')

if [ -z "$EXEC_LOG_ERR" ]; then
EXEC_LOG_ERR="$EXEC_LOG"
Expand Down
5 changes: 3 additions & 2 deletions tm/linstor_un/premigrate
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ $TAR -C $DST_PATH_DIRNAME --sparse -cf - $DST_PATH_BASENAME | $SSH $DST_HOST '$T
EOF
)

ssh_exec_and_log "$SRC_HOST" "$TAR_SSH" "Error copying disk directory to target host"
ssh_exec_and_log "$SRC_HOST" "$TAR_SSH" \
"Error copying disk directory to target host"

VM_RESOURCES=$(linstor_get_res_for_vmid "${VMID}")
for DST_RES in $VM_RESOURCES; do

# Attach diskless resource on destination host
DST_RES_HOSTS=$(linstor_get_hosts_for_res "$DST_RES")
if [[ " $DST_RES_HOSTS " =~ " $DST_HOST " ]]; then
if ! [[ " $DST_RES_HOSTS " =~ " $DST_HOST " ]]; then
linstor_exec_and_log \
"resource create -s $DISKLESS_POOL $DST_HOST $DST_RES"
fi
Expand Down

0 comments on commit 5bfbf41

Please sign in to comment.