initial commit of scripts
[invirt/scripts/mass-pvmove-vms.git] / do-move.sh
diff --git a/do-move.sh b/do-move.sh
new file mode 100755 (executable)
index 0000000..04c1920
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+set -e
+set -x
+
+machine=$1
+ip=`getent hosts $machine.xvm.mit.edu | cut -f1 -d' '`
+disk=/dev/xenvg/d_${machine}_hda
+xm save d_$machine $machine.state
+if dmsetup info xenvg-pvmove0 >/dev/null 2>&1; then
+    dmsetup remove xenvg-pvmove0
+fi
+lvchange -an $disk
+lvchange -aey $disk
+time pvmove -v -d -n $disk /dev/mapper/22* /dev/mapper/3600*
+lvchange -aen $disk
+lvchange -ay $disk
+xm restore $machine.state
+arpspoof -i $(invirt-getconf xen.iface) -t 18.181.0.1 $ip &
+sleep 10
+kill -9 `pidof arpspoof`
+rm $machine.state