Ignore:
Timestamp:
May 2, 2009, 6:53:34 PM (16 years ago)
Author:
price
Message:

pv-fixup, lvmanip: last tweaks

This is from the very beginning of April, at the close of the LVM saga.
Somehow I never pushed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/pv-fixup/pv-fixup

    r2272 r2321  
    3636}
    3737
    38 lvsleft () {
    39   lvs -o name,devices xenvg \
    40     | perl -lane "print \$F[0] if (\$F[1] =~ m|$DISK|)"
    41 }
    42 
    4338vmstolvs () {
    4439  perl -pe 's/^/d_/;s/$/_hda/'
     
    5045   | xargs lvs -o size --units=g \
    5146   | perl -lne '$total += $_; END { print $total; }'
     47}
     48
     49lvsleft () {
     50  lvs -o name,devices $VG \
     51    | perl -lane "print \$F[0] if (\$F[1] =~ m|$DISK|)"
    5252}
    5353
     
    108108#  - pvmove all the LVs back
    109109
     110# Doing this part with CLVM again.
     111
     112lvsleft () {
     113  lvs -o name,devices $VG \
     114    | perl -lane "print \$F[0] if (\$F[1] =~ m|$TMPDEV|)"
     115}
     116
     117movelv () {
     118  echo pvmoving $VG/$1...
     119  lvchange -an $VG/$1
     120  pvmove -i 10 -n $VG/$1 $2
     121  lvchange -ay $VG/$1
     122}
     123
     124movestuff () {
     125  date
     126  while read lv; do
     127    echo MOVING: $lv >>/var/log/lvm2.log
     128    movelv $lv $TMPDEV
     129    date
     130  done
     131}
     132
     133moveall () {
     134  date
     135  for lv in $(lvsleft); do
     136    echo MOVING: $lv >>/var/log/lvm2.log
     137    movelv $lv $TMPDEV
     138    date
     139  done
     140}
     141
    110142#FOREACH host:
    111 for lv in $(lvs -o lv_name --noheadings $VG); do
    112   movelv $VG/$lv $TMPDEV
    113 done
     143#set logging in /etc/lvm/lvm.conf
     144while sleep 1; do
     145  echo MARK: $(date) >>/var/log/lvm2.log
     146done &
     147lvsleft | grep -xf <(invirt-listvms | yamlkeys | vmstolvs) \
     148 | movestuff >>/root/lvm/movelv.log 2>&1
     149moveall >>/root/lvm/movelv.log 2>&1
     150while true; do
     151  kinit -k -45
     152  sh -x status.sh 2>&1 | zwrite -c xvm-auto -i pvmove -O auto
     153  sleep 1800
     154done &
    114155#done
     156
     157#suffix=.return-1; mv /var/log/lvm2.log lvm/lvm2.$suffix.log; mv lvm/movelv{,.$suffix}.log
    115158
    116159# hopefully empty:
     
    121164vgreduce $VG $TMPDEV
    122165pvremove $TMPDEV
     166#FOREACH host:
    123167dmsetup remove $TMPDM
     168#done
    124169
    125170#  - pvresize the new PV to use the whole space
Note: See TracChangeset for help on using the changeset viewer.