From: Dobrica Pavlinusic Date: Wed, 29 Jan 2014 00:13:48 +0000 (+0000) Subject: tweaks after migration of narada X-Git-Url: http://git.rot13.org/?p=sysadmin-cookbook;a=commitdiff_plain;h=84b440eaccaa426dfe0a251ee60b9d139049dd01 tweaks after migration of narada git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@312 191e9f34-6774-4a6d-acfc-7664dacd4a2a --- diff --git a/recepies/ganeti/migrate-lxc/0-host.sh b/recepies/ganeti/migrate-lxc/0-host.sh index 8ea2745..878d7e2 100644 --- a/recepies/ganeti/migrate-lxc/0-host.sh +++ b/recepies/ganeti/migrate-lxc/0-host.sh @@ -1,5 +1,6 @@ -export host_fqdn=rt.knjiznica.ffzg.hr -test -z "$host" && export host=`echo $host_fqdn | cut -d. -f1` +export host_fqdn=narada.vbz.ffzg.hr +test -z "$host" && host=`echo $host_fqdn | cut -d. -f1` +export host test -d $host || mkdir $host ssh_host() { diff --git a/recepies/ganeti/migrate-lxc/0-lxc.sh b/recepies/ganeti/migrate-lxc/0-lxc.sh index 523da2f..4dd5462 100644 --- a/recepies/ganeti/migrate-lxc/0-lxc.sh +++ b/recepies/ganeti/migrate-lxc/0-lxc.sh @@ -1,4 +1,5 @@ -export lxc=prod +export lxc=stage +export lxc_vg=stage5 test -d lxc || mkdir lxc diff --git a/recepies/ganeti/migrate-lxc/3-ganeti-root-lvm.sh b/recepies/ganeti/migrate-lxc/3-ganeti-root-lvm.sh index e1d5b41..ef2a995 100755 --- a/recepies/ganeti/migrate-lxc/3-ganeti-root-lvm.sh +++ b/recepies/ganeti/migrate-lxc/3-ganeti-root-lvm.sh @@ -5,6 +5,7 @@ ssh_master lvcreate --size `cat $host/size` --name $host ffzgvg +ssh_master lvextend --size 4G /dev/mapper/ffzgvg-$host ssh_master parted -s /dev/mapper/ffzgvg-$host 'mklabel msdos mkpart primary 0% 100% set 1 boot on' diff --git a/recepies/ganeti/migrate-lxc/4-lxc-snapshot-create.sh b/recepies/ganeti/migrate-lxc/4-lxc-snapshot-create.sh index fd2f928..c524c70 100755 --- a/recepies/ganeti/migrate-lxc/4-lxc-snapshot-create.sh +++ b/recepies/ganeti/migrate-lxc/4-lxc-snapshot-create.sh @@ -3,8 +3,8 @@ . ./0-host.sh . ./0-lxc.sh -ssh_lxc lvcreate -s -L 1G -n ganeti-$host /dev/raid5/$host +ssh_lxc lvcreate -s -L 1G -n ganeti-$host /dev/$lxc_vg/$host ssh_lxc mkdir /tmp/ganeti-$host -ssh_lxc mount /dev/raid5/ganeti-$host /tmp/ganeti-$host +ssh_lxc mount /dev/$lxc_vg/ganeti-$host /tmp/ganeti-$host ssh_lxc df -h /tmp/ganeti-$host diff --git a/recepies/ganeti/migrate-lxc/5-lxc-rsync-snapshot.sh b/recepies/ganeti/migrate-lxc/5-lxc-rsync-snapshot.sh index ef11fbb..1c28b40 100755 --- a/recepies/ganeti/migrate-lxc/5-lxc-rsync-snapshot.sh +++ b/recepies/ganeti/migrate-lxc/5-lxc-rsync-snapshot.sh @@ -2,5 +2,6 @@ . ./0-host.sh . ./0-lxc.sh +. ./0-ganeti.sh -ssh_lxc rsync -ravH --numeric-ids --sparse --delete --exclude /tmp --exclude /var/tmp /tmp/ganeti-$host/ 10.60.0.112:/tmp/$host/ +ssh_lxc rsync -ravH --numeric-ids --sparse --delete --exclude /tmp --exclude /var/tmp /tmp/ganeti-$host/ $master:/tmp/$host/ diff --git a/recepies/ganeti/migrate-lxc/6-lxc-snapshot-remove.sh b/recepies/ganeti/migrate-lxc/6-lxc-snapshot-remove.sh index b19921f..056f20a 100755 --- a/recepies/ganeti/migrate-lxc/6-lxc-snapshot-remove.sh +++ b/recepies/ganeti/migrate-lxc/6-lxc-snapshot-remove.sh @@ -4,7 +4,7 @@ . ./0-lxc.sh ssh_lxc umount /tmp/ganeti-$host -ssh_lxc dmsetup remove raid5-ganeti--$host-cow -ssh_lxc dmsetup remove raid5-ganeti--$host -ssh_lxc lvremove /dev/raid5/ganeti-$host +ssh_lxc dmsetup remove $lxc_vg-ganeti--$host-cow +ssh_lxc dmsetup remove $lxc_vg-ganeti--$host +ssh_lxc lvremove /dev/$lxc_vg/ganeti-$host diff --git a/recepies/ganeti/migrate-lxc/7-lxc-stop-container.sh b/recepies/ganeti/migrate-lxc/7-lxc-stop-container.sh index 6e7ab64..317d324 100755 --- a/recepies/ganeti/migrate-lxc/7-lxc-stop-container.sh +++ b/recepies/ganeti/migrate-lxc/7-lxc-stop-container.sh @@ -2,9 +2,10 @@ . ./0-host.sh . ./0-lxc.sh +. ./0-ganeti.sh ssh_lxc /etc/init.d/lxc-watchdog stop $host ssh_lxc rm -v /var/lib/lxc/$host/on_boot -ssh_lxc rsync -ravH --numeric-ids --sparse --delete --exclude /tmp --exclude /var/tmp /mnt/$host/ 10.60.0.112:/tmp/$host/ +ssh_lxc rsync -ravH --numeric-ids --sparse --delete --exclude /tmp --exclude /var/tmp /mnt/$host/ $master:/tmp/$host/ diff --git a/recepies/ganeti/migrate-lxc/A-ganeti-fix-root.sh b/recepies/ganeti/migrate-lxc/A-ganeti-fix-root.sh index e5dc644..8c2d185 100755 --- a/recepies/ganeti/migrate-lxc/A-ganeti-fix-root.sh +++ b/recepies/ganeti/migrate-lxc/A-ganeti-fix-root.sh @@ -3,6 +3,12 @@ . ./0-host.sh . ./0-ganeti.sh +ssh_master ls -d /tmp/$host/rootfs/boot > $host/rootfs_boot +if [ -s $host/rootfs_boot ] ; then + ssh_master mv /tmp/$host/rootfs/* /tmp/$host/ + ssh_master mv /tmp/$host/rootfs/.?* /tmp/$host/ + ssh_master rmdir /tmp/$host/rootfs +fi ssh_master mkdir -p /tmp/$host/lib/modules ssh_master cp -ra /lib/modules/3.2.0-4-amd64 /tmp/$host/lib/modules diff --git a/recepies/ganeti/migrate-lxc/B-ganeti-network-interfaces.sh b/recepies/ganeti/migrate-lxc/B-ganeti-network-interfaces.sh index 0ba5a3d..cfedad7 100755 --- a/recepies/ganeti/migrate-lxc/B-ganeti-network-interfaces.sh +++ b/recepies/ganeti/migrate-lxc/B-ganeti-network-interfaces.sh @@ -5,8 +5,8 @@ . ./0-ganeti.sh ssh_lxc cat /var/lib/lxc/$host/config | grep ipv4 | tee $host/ipv4 -public_ip=`grep 193.198 rt/ipv4 | cut -d= -f2 | cut -d/ -f1 | sed 's/ *//'` -local_ip=` grep 10.60 rt/ipv4 | cut -d= -f2 | cut -d/ -f1 | sed 's/ *//'` +public_ip=`grep 193.198 $host/ipv4 | cut -d= -f2 | cut -d/ -f1 | sed 's/ *//'` +local_ip=` grep 10.60 $host/ipv4 | cut -d= -f2 | cut -d/ -f1 | sed 's/ *//'` tee /tmp/network-interfaces-$host << __INTERFACES__ auto eth0 eth1 lo diff --git a/recepies/ganeti/migrate-lxc/D-ganeti-create-instance.sh b/recepies/ganeti/migrate-lxc/D-ganeti-create-instance.sh index 8ee0c3a..7a52ec5 100755 --- a/recepies/ganeti/migrate-lxc/D-ganeti-create-instance.sh +++ b/recepies/ganeti/migrate-lxc/D-ganeti-create-instance.sh @@ -8,5 +8,5 @@ ssh_master umount /tmp/$host ssh_master dmsetup remove ffzgvg-${host}p1 -ssh_master gnt-instance add -H kvm:kernel_path=/boot/vmlinuz-3.2-kvmU,initrd_path=/boot/initrd.img-3.2-kvmU -B maxmem=1G,minmem=1G,vcpus=1 -t plain -n vmh12 -o debootstrap+default --disk 0:adopt=$host --disk 1:adopt=$host-swap --no-start $host_fqdn +ssh_master gnt-instance add -H kvm:kernel_path=/boot/vmlinuz-3.2-kvmU,initrd_path=/boot/initrd.img-3.2-kvmU -B maxmem=1G,minmem=1G,vcpus=2 -t plain -n vmh12 -o debootstrap+default --disk 0:adopt=$host --disk 1:adopt=$host-swap --no-start --no-ip-check --no-name-check $host_fqdn