bug 10197: add some scripts which is used in upgrade

This commit is contained in:
anthony 2011-07-26 16:22:54 -07:00
parent 3e8fb4add2
commit 5b168f30e0
4 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,8 @@
#!/bin/bash
# Version @VERSION@
#set -x
for vlan in $(xe vlan-list | grep ^uuid | awk '{print $NF}'); do xe vlan-destroy uuid=$vlan 2&>/dev/null; done
for networkname in $(xe network-list | grep "name-label ( RW): VLAN" | awk '{print $NF}'); do network=$(xe network-list name-label=$networkname --minimal); xe network-destroy uuid=$network 2&>/dev/null; done

View File

@ -0,0 +1,53 @@
#!/bin/bash
# Version @VERSION@
#set -x
# propagate VLANs to other host
for networkname in $(xe network-list | grep "name-label ( RW): VLAN" | awk '{print $NF}');
do
network=$(xe network-list name-label=$networkname --minimal)
tagpif=$(xe pif-list network-uuid=$network --minimal | cut -d, -f 1)
device=$(xe pif-param-get uuid=$tagpif param-name=device)
vlan=$(xe pif-param-get uuid=$tagpif param-name=VLAN)
for host in $(xe host-list | grep ^uuid | awk '{print $NF}')
do
tagpif=$(xe pif-list network-uuid=$network host-uuid=$host --minimal)
if [ -z $tagpif ]; then
pif=$(xe pif-list host-uuid=$host device=$device --minimal)
xe vlan-create network-uuid=$network pif-uuid=$pif vlan=$vlan
fi
done
done
# fake PV for PV VM
fake_pv_driver() {
local vm=$1
res=$(xe vm-param-get uuid=$vm param-name=PV-drivers-version)
if [ ! "$res" = "<not in database>" ]; then
return 1
fi
res=$(xe vm-param-get uuid=$vm param-name=HVM-boot-policy)
if [ ! -z $res ]; then
echo "Warning VM $vm is HVM, but PV driver is not installed, you may need to stop it manually"
return 0
fi
make_migratable.sh $vm
}
vms=$(xe vm-list is-control-domain=false| grep ^uuid | awk '{print $NF}')
for vm in $vms
do
state=$(xe vm-param-get uuid=$vm param-name=power-state)
if [ $state = "running" ]; then
fake_pv_driver $vm
elif [ $state = "halted" ]; then
echo "VM $vm is in $state"
else
echo "Warning : Don't know how to handle VM $vm, it is in $state state"
fi
done

View File

@ -42,4 +42,6 @@ InterfaceReconfigure.py=.,0755,/opt/xensource/bin
fsimage.so=..,0755,/usr/lib/fs/ext2fs-lib
create_privatetemplate_from_snapshot.sh=..,0755,/opt/xensource/bin
upgrade_snapshot.sh=..,0755,/opt/xensource/bin
cloud-clean-vlan.sh=..,0755,/opt/xensource/bin
cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin
getRouterStatus.sh=../../../../network/domr/,0755,/opt/xensource/bin

View File

@ -42,3 +42,5 @@ vhd-util=..,0755,/opt/xensource/bin
vmopspremium=..,0755,/etc/xapi.d/plugins
create_privatetemplate_from_snapshot.sh=..,0755,/opt/xensource/bin
upgrade_snapshot.sh=..,0755,/opt/xensource/bin
cloud-clean-vlan.sh=..,0755,/opt/xensource/bin
cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin