fixed script

This commit is contained in:
anthony 2011-08-16 15:19:32 -07:00
parent bb8265ded3
commit 2cea330540

View File

@ -4,23 +4,31 @@
#set -x #set -x
# propagate VLANs to other host # propagate VLANs to other host
for networkname in $(xe network-list | grep "name-label ( RW): VLAN" | awk '{print $NF}');
do for vlan_networkname in $(xe network-list | grep "name-label ( RW): VLAN" | awk '{print $NF}');
network=$(xe network-list name-label=$networkname --minimal) do
tagpif=$(xe pif-list network-uuid=$network --minimal | cut -d, -f 1) vlan_network=$(xe network-list name-label=$vlan_networkname --minimal)
device=$(xe pif-param-get uuid=$tagpif param-name=device) this_tagged_pif=$(xe pif-list network-uuid=$vlan_network --minimal | cut -d, -f 1)
vlan=$(xe pif-param-get uuid=$tagpif param-name=VLAN) if [ -x $this_tagged_pif ]; then
continue
fi
vlan=$(xe pif-param-get uuid=$this_tagged_pif param-name=VLAN)
this_host=$(xe pif-param-get uuid=$this_tagged_pif param-name=host-uuid)
this_device=$(xe pif-param-get uuid=$this_tagged_pif param-name=device)
untagged_pif=$(xe pif-list host-uuid=$this_host device=$this_device VLAN=-1 --minimal)
untagged_network=$(xe pif-param-get uuid=$untagged_pif param-name=network-uuid)
for host in $(xe host-list | grep ^uuid | awk '{print $NF}') for host in $(xe host-list | grep ^uuid | awk '{print $NF}')
do do
tagpif=$(xe pif-list network-uuid=$network host-uuid=$host --minimal) tagpif=$(xe pif-list network-uuid=$vlan_network host-uuid=$host --minimal)
if [ -z $tagpif ]; then if [ -z $tagpif ]; then
pif=$(xe pif-list host-uuid=$host device=$device VLAN=-1 --minimal) pif=$(xe pif-list host-uuid=$host network_uuid=$untagged_network --minimal)
xe vlan-create network-uuid=$network pif-uuid=$pif vlan=$vlan xe vlan-create network-uuid=$vlan_network pif-uuid=$pif vlan=$vlan
fi fi
done done
done done
# fake PV for PV VM # fake PV for PV VM
fake_pv_driver() { fake_pv_driver() {
@ -38,7 +46,6 @@ fake_pv_driver() {
xe host-call-plugin host-uuid=$host plugin=vmops fn=preparemigration args:uuid=$vm xe host-call-plugin host-uuid=$host plugin=vmops fn=preparemigration args:uuid=$vm
} }
vms=$(xe vm-list is-control-domain=false| grep ^uuid | awk '{print $NF}') vms=$(xe vm-list is-control-domain=false| grep ^uuid | awk '{print $NF}')
for vm in $vms for vm in $vms
do do