diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2011-12-23 14:20:01 +0100 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2011-12-23 14:20:01 +0100 |
commit | 43ad0da773528aae8b34379909c9a5ff5fa1c697 (patch) | |
tree | 96750c44200900a37b37ac0de8dbfb9f1c2b244a /kvm-wrapper.sh | |
parent | f1a0e356b4495cfc295178f508afa22b27f21487 (diff) |
lvchange -a for any vg, not just the main one. made it possible to change time limit depending on VM
Diffstat (limited to 'kvm-wrapper.sh')
-rwxr-xr-x | kvm-wrapper.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kvm-wrapper.sh b/kvm-wrapper.sh index f906307..6600ca1 100755 --- a/kvm-wrapper.sh +++ b/kvm-wrapper.sh @@ -239,14 +239,14 @@ function kvm_nbd_disconnect () function check_activate_lv () { for DISK in $@; do - [[ "$LVM_MANAGE_LV" == "yes" ]] && [[ "$DISK" == "/dev/$LVM_VG_NAME/"* ]] && lvchange -ay "$DISK" || true + [[ "$LVM_MANAGE_LV" == "yes" ]] && [[ "$DISK" == "/dev/"*"/"* ]] && lvchange -ay "$DISK" || true done } function check_deactivate_lv () { for DISK in $@; do - [[ "$LVM_MANAGE_LV" == "yes" ]] && [[ "$DISK" == "/dev/$LVM_VG_NAME/"* ]] && lvchange -an "$DISK" || true + [[ "$LVM_MANAGE_LV" == "yes" ]] && [[ "$DISK" == "/dev/"*"/"* ]] && lvchange -an "$DISK" || true done } @@ -471,16 +471,16 @@ function kvm_stop_vm () test_exist "$PID_FILE" || fail_exit "VM $VM_NAME doesn't seem to be running.\nPID file $PID_FILE not found" # test_socket_rw "$MONITOR_FILE" || fail_exit "Monitor socket $MONITOR_FILE not existing or not writable" - local TIMELIMIT=20 + KVM_WAIT_SHUTDOWN=${KVM_WAIT_SHUTDOWN:-20} # Send monitor command through unix socket - echo "Trying to powerdown the VM $VM_NAME first, might take some time (up to $TIMELIMIT sec)" + echo "Trying to powerdown the VM $VM_NAME first, might take some time (up to $KVM_WAIT_SHUTDOWN sec)" monitor_send_cmd "system_powerdown" echo -n "Waiting ..." # Now wait for it local ELAPSED=0 - ELAPSED=$(wait_test_timelimit $TIMELIMIT "! test_file $PID_FILE") + ELAPSED=$(wait_test_timelimit $KVM_WAIT_SHUTDOWN "! test_file $PID_FILE") local PROPER=$? echo " elapsed time : $ELAPSED sec" @@ -915,7 +915,7 @@ case "$1" in ;; migrate) if [[ $# -eq 3 ]]; then - ! test_exist "$PID_FILE" && fail_exit "Error : $VM_NAME doesn't seem to be running." + ! 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!" |