diff options
author | Feng Pan <fpan@redhat.com> | 2016-05-22 23:42:34 -0400 |
---|---|---|
committer | Feng Pan <fpan@redhat.com> | 2016-05-24 19:52:51 -0400 |
commit | 73ae3482ce09b5b561a783ebfd31187b879c6f67 (patch) | |
tree | 928a4ec8a7eb2560c9e9bebba84802a95eb2a635 | |
parent | 5fec80057dbd799d52a4c1ff2f35a1c8cc5ad6ea (diff) |
Use linux bridge for virtual deployment
Changes virtual deployment to use linux bridge rather than OVS
bridge on jumphost. Also fixed an issue with network deletion
in cleaning code.
Change-Id: Ibcfa283c6bf32aafa2ee91b2ffd55355d7d6746e
Signed-off-by: Feng Pan <fpan@redhat.com>
-rwxr-xr-x | ci/clean.sh | 8 | ||||
-rwxr-xr-x | ci/deploy.sh | 55 |
2 files changed, 44 insertions, 19 deletions
diff --git a/ci/clean.sh b/ci/clean.sh index 42090069..368ce8bc 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -20,6 +20,7 @@ source $CONFIG/lib/common-functions.sh vm_index=4 ovs_bridges="br-admin br-private br-public br-storage" +OPNFV_NETWORK_TYPES="admin_network private_network public_network storage_network" # Clean off instack/undercloud VM for vm in instack undercloud; do @@ -39,10 +40,13 @@ for i in $(seq 0 $vm_index); do rm -f /var/lib/libvirt/images/baremetal${i}.qcow2 2> /dev/null done +for network in ${OPNFV_NETWORK_TYPES}; do + virsh net-destroy ${network} 2> /dev/null + virsh net-undefine ${network} 2> /dev/null +done + # Clean off created bridges for bridge in ${ovs_bridges}; do - virsh net-destroy ${bridge} 2> /dev/null | xargs echo -n - virsh net-undefine ${bridge} 2> /dev/null | xargs echo -n if detach_interface_from_ovs ${bridge} 2> /dev/null; then ovs-vsctl del-br ${bridge} 2> /dev/null fi diff --git a/ci/deploy.sh b/ci/deploy.sh index 59cfc6d1..d43960ef 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -272,10 +272,11 @@ function configure_deps { virsh net-list --all | grep -E "default\s+active" > /dev/null || virsh net-start default virsh net-list --all | grep -E "default\s+active\s+yes" > /dev/null || virsh net-autostart --network default - for network in ${OPNFV_NETWORK_TYPES}; do - echo "${blue}INFO: Creating Virsh Network: $network & OVS Bridge: ${NET_MAP[$network]}${reset}" - ovs-vsctl list-br | grep "^${NET_MAP[$network]}$" > /dev/null || ovs-vsctl add-br ${NET_MAP[$network]} - virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF + if [[ -z "$virtual" || "$virtual" == "FALSE" ]]; then + for network in ${OPNFV_NETWORK_TYPES}; do + echo "${blue}INFO: Creating Virsh Network: $network & OVS Bridge: ${NET_MAP[$network]}${reset}" + ovs-vsctl list-br | grep "^${NET_MAP[$network]}$" > /dev/null || ovs-vsctl add-br ${NET_MAP[$network]} + virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF <network> <name>$network</name> <forward mode='bridge'/> @@ -283,21 +284,18 @@ function configure_deps { <virtualport type='openvswitch'/> </network> EOF - if ! (virsh net-list --all | grep $network > /dev/null); then - echo "${red}ERROR: unable to create network: ${network}${reset}" - exit 1; - fi - rm -f ${libvirt_dir}/apex-virsh-net.xml &> /dev/null; - virsh net-list | grep -E "$network\s+active" > /dev/null || virsh net-start $network - virsh net-list | grep -E "$network\s+active\s+yes" > /dev/null || virsh net-autostart --network $network - done + if ! (virsh net-list --all | grep $network > /dev/null); then + echo "${red}ERROR: unable to create network: ${network}${reset}" + exit 1; + fi + rm -f ${libvirt_dir}/apex-virsh-net.xml &> /dev/null; + virsh net-list | grep -E "$network\s+active" > /dev/null || virsh net-start $network + virsh net-list | grep -E "$network\s+active\s+yes" > /dev/null || virsh net-autostart --network $network + done - echo -e "${blue}INFO: Bridges set: ${reset}" - ovs-vsctl list-br - echo -e "${blue}INFO: virsh networks set: ${reset}" - virsh net-list + echo -e "${blue}INFO: Bridges set: ${reset}" + ovs-vsctl list-br - if [[ -z "$virtual" || "$virtual" == "FALSE" ]]; then # bridge interfaces to correct OVS instances for baremetal deployment for network in ${enabled_network_list}; do if [[ "$network" != "admin_network" && "$network" != "public_network" ]]; then @@ -317,8 +315,31 @@ EOF exit 1 fi done + else + for network in ${OPNFV_NETWORK_TYPES}; do + echo "${blue}INFO: Creating Virsh Network: $network${reset}" + virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF +<network ipv6='yes'> +<name>$network</name> +<bridge name='${NET_MAP[$network]}'/> +</network> +EOF + if ! (virsh net-list --all | grep $network > /dev/null); then + echo "${red}ERROR: unable to create network: ${network}${reset}" + exit 1; + fi + rm -f ${libvirt_dir}/apex-virsh-net.xml &> /dev/null; + virsh net-list | grep -E "$network\s+active" > /dev/null || virsh net-start $network + virsh net-list | grep -E "$network\s+active\s+yes" > /dev/null || virsh net-autostart --network $network + done + + echo -e "${blue}INFO: Bridges set: ${reset}" + brctl show fi + echo -e "${blue}INFO: virsh networks set: ${reset}" + virsh net-list + # ensure storage pool exists and is started virsh pool-list --all | grep default > /dev/null || virsh pool-define-as --name default dir --target /var/lib/libvirt/images virsh pool-list | grep -Eo "default\s+active" > /dev/null || (virsh pool-autostart default; virsh pool-start default) |