exit 1 #Not actually a script.
VG=xenvg
-DISK=/dev/sdb
-HALFSIZETiB=2.04
+DISK=/dev/mapper/36090a028407d6e2b2589a45cdb971489
+HALFSIZETiB=5.23
TMPDM=tmpfoo
TMPDEV=/dev/mapper/$TMPDM
TMPDM2=tmpbar
# - dmsetup create a device in the latter half
dmstart=$(python -c "print int(($HALFSIZETiB + 0.01) * 1024 * 1024 * 1024 * 2)")
-dmlen=$(python -c "print int(($HALFSIZETiB - 0.02) * 1024 * 1024 * 1024 * 2)")
-#foreach host:
+dmlen=$(python -c "print int(($HALFSIZETiB - 0.03) * 1024 * 1024 * 1024 * 2)")
+#Foreach host:
dmsetup create $TMPDM --table "0 $dmlen linear $DISK $dmstart"
#done
vgextend $VG $TMPDEV
# - pvmove all the LVs to the temporary PV
-# (something like
-# for lv in $(LVs for running VMs on this host); do
-# #some lvchange -a commands
-# pvmove -n $lv <oldpv> <newpv>
-# #possibly more lvchange -a to restore old state
-# done)
movelv () {
echo pvmoving $1...
lvchange -an $1
pvmove -i 10 -n $1 $2
+ lvchange -ay $1
}
-#touch /etc/invirt/nocreate
#FOREACH host:
-#machines=$(invirt-listvms | perl -lne 'print if s/^([^ ]*):.*/$1/')
-#lvs=$(echo $machines | perl -lpe "s|^|$VG/d_|; s|$|_hda|")
for lv in $(lvs -o lv_name --noheadings $VG); do
movelv $VG/$lv $DISK
done