summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2011-09-17 17:02:54 +0200
committerDominique Martinet <asmadeus@codewreck.org>2011-09-17 17:38:27 +0200
commit619e4f4f20e03be8c3de62be185a44dd1b9dc67d (patch)
tree9c2ac4dc91d8deb5d6a53baaee256b5d0a483e20
parente0fd9eb13e1c0937370adb15d3d0e67caca7d005 (diff)
added check to fail cleanly on impossible migrate
-rwxr-xr-xkvm-wrapper.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/kvm-wrapper.sh b/kvm-wrapper.sh
index af6e6cf..fbfeb7d 100755
--- a/kvm-wrapper.sh
+++ b/kvm-wrapper.sh
@@ -180,6 +180,7 @@ get_cluster_host ()
run_remote ()
{
HOST="`get_cluster_host $1`"
+ [[ -z "$HOST" ]] && fail_exit "Error: Unknown host $1!"
shift
require_exec ssh
SSH_OPTS=${SSH_OPTS:-"-t"}
@@ -613,7 +614,7 @@ function kvm_create_descriptor ()
VM_NAME="$1"
VM_DESCRIPTOR="$VM_DIR/$VM_NAME-vm"
- test_file "$VM_DESCRIPTOR" && fail_exit "Error : $VM_NAME exists already ($VM_DESCRIPTOR found)"
+ test_file "$VM_DESCRIPTOR" && fail_exit "Error : $VM_NAME already exists ($VM_DESCRIPTOR found)"
touch "$VM_DESCRIPTOR"
echo "# VM $VM_NAME file descriptor" >> "$VM_DESCRIPTOR"
@@ -910,6 +911,8 @@ case "$1" in
if [[ $# -eq 3 ]]; then
! test_file "$PID_FILE" && fail_exit "Error : $VM_NAME doesn't seem to be running."
! test_socket_rw "$MONITOR_FILE" && fail_exit "Error : could not open monitor socket $MONITOR_FILE."
+ [[ "$KVM_CLUSTER_NODE" == "$3" ]] && fail_exit "Error: $2 already runs on $3!"
+ [[ -z "`get_cluster_host $3`" ]] && fail_exit "Error: Unknown host $3!"
desc_update_setting "KVM_CLUSTER_NODE" "$3"
PORT=$((RANDOM%1000+4000))
"$SCRIPT_PATH" receive-migrate-screen "$2" $PORT