summaryrefslogtreecommitdiffstats
path: root/kvm-wrapper.sh
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2014-02-19 17:43:57 +0100
committerDominique Martinet <asmadeus@codewreck.org>2015-07-02 18:26:37 +0200
commitd44e741817745a700c036cded2826605d3909957 (patch)
treef1e925afda425c8042146d3001911826cdd338d8 /kvm-wrapper.sh
parent3c93ca66769ffb711a23fcfe60622d42e4ea0e5e (diff)
failsaves: create disallows VM names starting by -, migrate disallows moving VMs with pci-assign
Diffstat (limited to 'kvm-wrapper.sh')
-rwxr-xr-xkvm-wrapper.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/kvm-wrapper.sh b/kvm-wrapper.sh
index f8c0c50..51ba179 100755
--- a/kvm-wrapper.sh
+++ b/kvm-wrapper.sh
@@ -853,6 +853,8 @@ function kvm_migrate_vm ()
! test_socket_rw "$MONITOR_FILE" && fail_exit "Error: could not open monitor socket $MONITOR_FILE."
[[ "$KVM_CLUSTER_NODE" == "$REMOTE_NODE" ]] && fail_exit "Error: $VM_NAME already runs on $REMOTE_NODE!"
[[ -z "`get_cluster_host $REMOTE_NODE`" ]] && fail_exit "Error: Unknown host $REMOTE_NODE!"
+
+ [[ -n "${KVM_PCIASSIGN_DOMAIN[@]}" ]] && fail_exit "Cannot migrate vm with pci passthrough!"
# Update VM configuration with new node
desc_update_setting "KVM_CLUSTER_NODE" "$REMOTE_NODE"
@@ -955,10 +957,16 @@ function kvm_build_vm ()
;;
esac
done
- if [[ ! "$#" -eq 1 ]]; then print_help "create"; exit 1; fi
+ if [[ ! "$#" -eq 1 ]]; then print_help "create"; return 1; fi
VM_NAME="$1"
+ if [[ "$VM_NAME" == -* ]]; then
+ echo "VM name $VM_NAME starts with a dash, you probably didn't want that"
+ print_help "create"
+ return 1
+ fi
+
test_file "$AUTOCONF_SCRIPT" || fail_exit "Couldn't read autoconfiguration script $AUTOCONF_SCRIPT\n"
kvm_create_descriptor "$VM_NAME"