mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
bug 10197: add some scripts which is used in upgrade
This commit is contained in:
parent
3e8fb4add2
commit
5b168f30e0
8
scripts/vm/hypervisor/xenserver/cloud-clean-vlan.sh
Executable file
8
scripts/vm/hypervisor/xenserver/cloud-clean-vlan.sh
Executable 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
|
||||
53
scripts/vm/hypervisor/xenserver/cloud-prepare-upgrade.sh
Executable file
53
scripts/vm/hypervisor/xenserver/cloud-prepare-upgrade.sh
Executable 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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user