initial commit of scripts
[invirt/scripts/mass-pvmove-vms.git] / move-it.sh
1 #!/bin/bash
2
3 set -e
4 set -x
5 #filename=$1
6 #exec 3<$filename
7 tempfile=`mktemp`
8 exec 3<"$1"
9 ssh -k root@xh8.mit.edu 'pvdisplay -m /dev/mapper/22*' > $tempfile
10 while read -u 3 machine; do 
11     echo $machine
12     disk=/dev/xenvg/d_${machine}_hda
13     if grep -q $disk $tempfile; then
14         host=`ssh -k root@xvm.mit.edu remctl xvm-remote control $machine listhost`
15         if [ -n $host ]; then       
16             scp do-move.sh root@$host:/tmp/
17             ssh root@$host chmod +x /tmp/do-move.sh
18             ssh root@$host /tmp/do-move.sh $machine
19             sleep 10
20         fi
21     fi
22 done
23