diff options
author | wutianwei <wutianwei1@huawei.com> | 2018-01-27 18:08:34 +0800 |
---|---|---|
committer | wutianwei <wutianwei1@huawei.com> | 2018-01-27 18:08:34 +0800 |
commit | 3907d59a072d158de67e3cc94bc6ea0ed747d390 (patch) | |
tree | 441271197d405e7ca50ca90e10b83c3f30ab708b /deploy | |
parent | 2c93fa28f1f1e78f4135f096f0c59e82963fd847 (diff) |
Compass4nfv virtual deploy support direct connection
compass4nfv using nat for VM external network currently,
this patch add the direct connection method.
if want to use it ,you need set the NAT_EXTERNAL to false,
and configure the network.yml according to you environment
Change-Id: I5a1a2f96b8c32a00eaef4d591c4452b555f0c9a2
Signed-off-by: wutianwei <wutianwei1@huawei.com>
Diffstat (limited to 'deploy')
-rwxr-xr-x | deploy/compass_vm.sh | 2 | ||||
-rw-r--r-- | deploy/conf/virtual.conf | 1 | ||||
-rwxr-xr-x | deploy/host_virtual.sh | 7 | ||||
-rwxr-xr-x | deploy/network.sh | 13 |
4 files changed, 16 insertions, 7 deletions
diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh index cf215f3b..17171578 100755 --- a/deploy/compass_vm.sh +++ b/deploy/compass_vm.sh @@ -23,7 +23,7 @@ function check_container_alive() { docker exec -it compass-mq bash -c "exit" 1>/dev/null 2>&1 local mq_state=$? - if [ $((deck_state||tasks_state||cobbler_state||db_state||mq-state)) == 0 ]; then + if [ $((deck_state||tasks_state||cobbler_state||db_state||mq_state)) == 0 ]; then echo "true" else echo "false" diff --git a/deploy/conf/virtual.conf b/deploy/conf/virtual.conf index 1e9034f3..1d47603d 100644 --- a/deploy/conf/virtual.conf +++ b/deploy/conf/virtual.conf @@ -7,3 +7,4 @@ export SWITCH_IPS="1.1.1.1" export SWITCH_CREDENTIAL="version=2c,community=public" export DEPLOYMENT_TIMEOUT="300" export POLL_SWITCHES_FLAG="nopoll_switches" +export NAT_EXTERNAL=${NAT_EXTERNAL:true} diff --git a/deploy/host_virtual.sh b/deploy/host_virtual.sh index 03a1230f..d955b747 100755 --- a/deploy/host_virtual.sh +++ b/deploy/host_virtual.sh @@ -52,6 +52,11 @@ function launch_host_vms() { vm_template_file="$vm_template_dir/host.xml" vm_template_arch="$vm_template_dir/host-$COMPASS_ARCH.xml" [ -f $vm_template_arch ] && vm_template_file=$vm_template_arch + if [[ "$NAT_EXTERNAL" == "false" ]]; then + NET_IAAS="external" + else + NET_IAAS="external_nat" + fi log_info "bringing up pxe boot vms" i=0 @@ -67,7 +72,7 @@ function launch_host_vms() { -e "s#REPLACE_IMAGE#$vm_dir/disk.img#g" \ -e "s/REPLACE_BOOT_MAC/${mac_array[i]}/g" \ -e "s/REPLACE_NET_INSTALL/install/g" \ - -e "s/REPLACE_NET_IAAS/external_nat/g" \ + -e "s/REPLACE_NET_IAAS/$NET_IAAS/g" \ "$vm_template_file" \ > $vm_dir/libvirt.xml diff --git a/deploy/network.sh b/deploy/network.sh index 698771b3..eea62277 100755 --- a/deploy/network.sh +++ b/deploy/network.sh @@ -76,9 +76,9 @@ function setup_bridge_external() sudo virsh net-destroy external sudo virsh net-undefine external - #save_network_info + save_network_info sed -e "s/REPLACE_NAME/external/g" \ - -e "s/REPLACE_OVS/br-external_nat/g" \ + -e "s/REPLACE_OVS/br-external/g" \ $COMPASS_DIR/deploy/template/network/bridge_ovs.xml \ > $WORK_DIR/network/external.xml @@ -86,14 +86,12 @@ function setup_bridge_external() sudo virsh net-start external sudo virsh net-autostart external - python $COMPASS_DIR/deploy/setup_vnic.py } function recover_bridge_external() { sudo virsh net-start external - python $COMPASS_DIR/deploy/setup_vnic.py } function setup_nat_net() { @@ -128,7 +126,12 @@ function recover_nat_net() { function setup_virtual_net() { setup_nat_net install $INSTALL_GW $INSTALL_NETMASK - setup_nat_net external_nat $EXT_NAT_GW $EXT_NAT_MASK $EXT_NAT_IP_START $EXT_NAT_IP_END + + if [[ "$NAT_EXTERNAL" == "false" ]]; then + setup_bridge_external + else + setup_nat_net external_nat $EXT_NAT_GW $EXT_NAT_MASK $EXT_NAT_IP_START $EXT_NAT_IP_END + fi } function recover_virtual_net() { |