--- a/kvmtool.sh Wed Jan 11 14:08:28 2012 +0100
+++ b/kvmtool.sh Tue Sep 06 16:07:27 2016 +0200
@@ -6,11 +6,12 @@
ME=${0##*/}
NODE=$(uname -n)
KVMTAB=/etc/kvmtab
-KVM_OPTS_BUILTIN='-drive file=/dev/drbd$ID,cache=none,aio=native,if=virtio,index=0,boot=on
- -boot c
+KVM_OPTS_BUILTIN='-drive file=/dev/drbd$ID,cache=none,aio=native,if=virtio,index=0
+ -boot order=c
-m 512
-net nic,macaddr=$MAC,model=virtio
- -net tap,ifname=tap$ID,script=no'
+ -net tap,ifname=tap$ID,script=no
+ -k de'
function die() { echo $0: "$@" >&2; exit 1; }
@@ -66,6 +67,8 @@
echo system_powerdown | nc 0 $MONITOR
ip link set tap$ID down
brctl delif br0 tap$ID
+ # 'device is held open by someone' :(
+ sleep 1
echo "switch drbd$ID into secondary role"
drbdadm secondary drbd$ID
;;
@@ -106,13 +109,13 @@
done
-# When called as "kvmtool", just try to start
-# all the vm's we find in /etc/kvmtab, except, there
-# are more parameters on the command line
+# "kvmtool start" or "kvmtool start all" will try to start
+# all the vm's we find in /etc/kvmtab; if called "kvmtool start <vm>" it
+# will try to start the the vm called 'vm'
if [[ "$ME" == *$ME ]]; then
cmd="$1"; shift
- if test $# = 0; then
+ if test $# = 0 || ( test $# = 1 && test $1 = 'all' ); then
vms=$(egrep "^[[:alnum:]_-]+[[:space:]]+$NODE\b" $KVMTAB | tr -s '\t ' ' ' | cut -f1 -d' ')
else
vms="$@"
@@ -143,9 +146,10 @@
=head1 DESCRIPTION
This small tool helps to start the virtual machines known in F</etc/kvmtab>.
-If just called as C<kvmtool start> it starts all machines that should run on the
-current host. If called as C<kvmtool start xxx>, it tries to start machine C<xxx>, but
-this may fail, if the F<kvmtab> lists this machine for another host.
+If just called as C<kvmtool start> or C<kvmtool start all> it starts all
+machines that should run on the current host. If called as C<kvmtool start
+xxx>, it tries to start machine C<xxx>, but this may fail, if the F<kvmtab>
+lists this machine for another host.
=head1 OPTIONS