aboutsummaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
authorbaigk <baiguoku@huawei.com>2015-10-09 18:32:31 +0800
committerbaigk <baiguoku@huawei.com>2015-10-10 10:17:48 +0800
commit80c770bb093ad2af54171de1a2c4630536d4daf0 (patch)
tree693a483f4b4f02eb7dcd908691e2db67f7b6003c /deploy
parent00aaaac786bcec0d2de7c14c4f3c5a89ba2553f5 (diff)
bugfix: libvirt_type should be kvm when host is barebetal mode
JIRA: COMPASS-81 Change-Id: Iba3cb182a3e461ab89eb40fdba7800b8b2a1fc3e Signed-off-by: baigk <baiguoku@huawei.com>
Diffstat (limited to 'deploy')
-rw-r--r--deploy/adapters/ansible/roles/nova-compute/templates/nova-compute.conf4
-rw-r--r--deploy/client.py6
-rw-r--r--deploy/compass_vm.sh22
-rw-r--r--deploy/conf/baremetal.conf1
-rw-r--r--deploy/conf/base.conf12
-rw-r--r--deploy/conf/compass.conf15
-rw-r--r--deploy/deploy_host.sh2
-rwxr-xr-xdeploy/deploy_parameter.sh2
-rw-r--r--deploy/host_virtual.sh2
-rwxr-xr-xdeploy/launch.sh1
-rwxr-xr-xdeploy/network.sh53
-rw-r--r--deploy/template/vm/compass.xml5
12 files changed, 98 insertions, 27 deletions
diff --git a/deploy/adapters/ansible/roles/nova-compute/templates/nova-compute.conf b/deploy/adapters/ansible/roles/nova-compute/templates/nova-compute.conf
index 401dee79..1ac775b1 100644
--- a/deploy/adapters/ansible/roles/nova-compute/templates/nova-compute.conf
+++ b/deploy/adapters/ansible/roles/nova-compute/templates/nova-compute.conf
@@ -2,6 +2,10 @@
compute_driver=libvirt.LibvirtDriver
force_raw_images = true
[libvirt]
+{% if deploy_type == 'virtual' %}
virt_type=qemu
+{% else %}
+virt_type=kvm
+{% endif %}
images_type = raw
mem_stats_period_seconds=0
diff --git a/deploy/client.py b/deploy/client.py
index 33d987ee..84041af5 100644
--- a/deploy/client.py
+++ b/deploy/client.py
@@ -216,6 +216,9 @@ opts = [
cfg.StrOpt('repo_name',
help='repo name',
default=''),
+ cfg.StrOpt('deploy_type',
+ help='deploy type',
+ default='virtual'),
]
CONF.register_cli_opts(opts)
@@ -418,6 +421,7 @@ class CompassClient(object):
https_proxy = CONF.https_proxy
local_repo_url = CONF.local_repo_url
repo_name = CONF.repo_name
+ deploy_type = CONF.deploy_type
if not https_proxy and http_proxy:
https_proxy = http_proxy
@@ -479,6 +483,8 @@ class CompassClient(object):
general_config['local_repo'] = local_repo_url
if repo_name:
general_config['repo_name'] = repo_name
+ if deploy_type:
+ general_config['deploy_type'] = deploy_type
os_config["general"] = general_config
diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh
index d3fec236..944c6cff 100644
--- a/deploy/compass_vm.sh
+++ b/deploy/compass_vm.sh
@@ -63,7 +63,26 @@ function launch_compass() {
sudo umount $old_mnt
chmod 755 -R $new_mnt
- sed -i -e "s/REPLACE_MGMT_IP/$MGMT_IP/g" -e "s/REPLACE_MGMT_NETMASK/$MGMT_MASK/g" -e "s/REPLACE_INSTALL_IP/$COMPASS_SERVER/g" -e "s/REPLACE_INSTALL_NETMASK/$INSTALL_MASK/g" -e "s/REPLACE_GW/$MGMT_GW/g" $new_mnt/isolinux/isolinux.cfg
+
+ cp $COMPASS_DIR/util/isolinux.cfg $new_mnt/isolinux/ -f
+
+ sed -i -e "s/REPLACE_MGMT_IP/$MGMT_IP/g" \
+ -e "s/REPLACE_MGMT_NETMASK/$MGMT_MASK/g" \
+ -e "s/REPLACE_GW/$MGMT_GW/g" \
+ -e "s/REPLACE_INSTALL_IP/$COMPASS_SERVER/g" \
+ -e "s/REPLACE_INSTALL_NETMASK/$INSTALL_MASK/g" \
+ -e "s/REPLACE_COMPASS_EXTERNAL_NETMASK/$COMPASS_EXTERNAL_MASK/g" \
+ -e "s/REPLACE_COMPASS_EXTERNAL_IP/$COMPASS_EXTERNAL_IP/g" \
+ -e "s/REPLACE_COMPASS_EXTERNAL_GW/$COMPASS_EXTERNAL_GW/g" \
+ $new_mnt/isolinux/isolinux.cfg
+
+ if [[ -n $COMPASS_DNS1 ]]; then
+ sed -i -e "s/REPLACE_COMPASS_DNS1/$COMPASS_DNS1/g" $new_mnt/isolinux/isolinux.cfg
+ fi
+
+ if [[ -n $COMPASS_DNS2 ]]; then
+ sed -i -e "s/REPLACE_COMPASS_DNS2/$COMPASS_DNS2/g" $new_mnt/isolinux/isolinux.cfg
+ fi
ssh-keygen -f $new_mnt/bootstrap/boot.rsa -t rsa -N ''
cp $new_mnt/bootstrap/boot.rsa $rsa_file
@@ -82,6 +101,7 @@ function launch_compass() {
-e "s#REPLACE_ISO#$compass_vm_dir/centos.iso#g" \
-e "s/REPLACE_NET_MGMT/mgmt/g" \
-e "s/REPLACE_BRIDGE_INSTALL/br_install/g" \
+ -e "s/REPLACE_BRIDGE_EXTERNAL/br_external/g" \
$COMPASS_DIR/deploy/template/vm/compass.xml \
> $WORK_DIR/vm/compass/libvirt.xml
diff --git a/deploy/conf/baremetal.conf b/deploy/conf/baremetal.conf
index 5d42b36d..56903c77 100644
--- a/deploy/conf/baremetal.conf
+++ b/deploy/conf/baremetal.conf
@@ -2,3 +2,4 @@ export SWITCH_IPS="192.168.124.2"
export SWITCH_CREDENTIAL="version=2c,community=public"
export DEPLOYMENT_TIMEOUT="150"
export POLL_SWITCHES_FLAG="nopoll_switches"
+export INSTALL_NIC=${INSTALL_NIC:-eth3}
diff --git a/deploy/conf/base.conf b/deploy/conf/base.conf
index 050fe350..c48aca64 100644
--- a/deploy/conf/base.conf
+++ b/deploy/conf/base.conf
@@ -9,18 +9,8 @@ export MGMT_MASK=${MAGMT_MASK:-255.255.252.0}
export MGMT_GW=${MAGMT_GW:-192.168.200.1}
export MGMT_IP_START=${MGMT_IP_START:-192.168.200.3}
export MGMT_IP_END=${MGMT_IP_END:-192.168.200.254}
-export OM_NIC=${OM_NIC:-eth3}
-export COMPASS_VIRT_CPUS=4
-export COMPASS_VIRT_MEM=4096
-export COMPASS_SERVER=$INSTALL_IP
-export COMPASS_SERVER_URL="http://$COMPASS_SERVER/api"
-export COMPASS_USER_EMAIL="admin@huawei.com"
-export COMPASS_USER_PASSWORD="admin"
+export EXTERNAL_NIC=${EXTERNAL_NIC:-eth3}
export CLUSTER_NAME="opnfv2"
-export LANGUAGE="EN"
-export TIMEZONE="America/Los_Angeles"
-export NTP_SERVER="$COMPASS_SERVER"
-export NAMESERVERS="$COMPASS_SERVER"
export DOMAIN="ods.com"
export PARTITIONS="/=70%,/home=5%,/tmp=5%,/var=20%"
export SUBNETS="10.1.0.0/24,172.16.2.0/24,172.16.3.0/24,172.16.4.0/24"
diff --git a/deploy/conf/compass.conf b/deploy/conf/compass.conf
new file mode 100644
index 00000000..eee23e9f
--- /dev/null
+++ b/deploy/conf/compass.conf
@@ -0,0 +1,15 @@
+export COMPASS_VIRT_CPUS=4
+export COMPASS_VIRT_MEM=4096
+export COMPASS_SERVER=$INSTALL_IP
+export COMPASS_SERVER_URL="http://$COMPASS_SERVER/api"
+export COMPASS_USER_EMAIL="admin@huawei.com"
+export COMPASS_USER_PASSWORD="admin"
+export COMPASS_DNS1=${COMPASS_DNS1:-'8.8.8.8'}
+export COMPASS_DNS2=${COMPASS_DNS2:-}
+export COMPASS_EXTERNAL_IP=${COMPASS_EXTERNAL_IP:-192.168.124.221}
+export COMPASS_EXTERNAL_MASK=${COMPASS_EXTERNAL_MASK:-255.255.252.0}
+export COMPASS_EXTERNAL_GW=${COMPASS_EXTERNAL_GW:-192.168.124.1}
+export LANGUAGE="EN"
+export TIMEZONE="America/Los_Angeles"
+export NTP_SERVER="$COMPASS_SERVER"
+export NAMESERVERS="$COMPASS_SERVER"
diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh
index 92853469..2ec7b8c8 100644
--- a/deploy/deploy_host.sh
+++ b/deploy/deploy_host.sh
@@ -23,7 +23,7 @@ function deploy_host(){
--console_credentials="${CONSOLE_CREDENTIALS}" --host_networks="${HOST_NETWORKS}" \
--network_mapping="${NETWORK_MAPPING}" --package_config_json_file="${PACKAGE_CONFIG_FILENAME}" \
--host_roles="${HOST_ROLES}" --default_roles="${DEFAULT_ROLES}" --switch_ips="${SWITCH_IPS}" \
- --machines=${machines//\'} --switch_credential="${SWITCH_CREDENTIAL}" \
+ --machines=${machines//\'} --switch_credential="${SWITCH_CREDENTIAL}" --deploy_type="${TYPE}" \
--deployment_timeout="${DEPLOYMENT_TIMEOUT}" --${POLL_SWITCHES_FLAG} --dashboard_url="${DASHBOARD_URL}" \
--cluster_vip="${VIP}" --network_cfg="$NETWORK_FILE" --neutron_cfg="$NEUTRON_FILE"
diff --git a/deploy/deploy_parameter.sh b/deploy/deploy_parameter.sh
index 4cceb1ad..8fade105 100755
--- a/deploy/deploy_parameter.sh
+++ b/deploy/deploy_parameter.sh
@@ -43,7 +43,7 @@ function generate_input_env_file()
echo '#input deployment parameter' > $ofile
- cfg_file=`ls $COMPASS_DIR/deploy/conf/{base,"$TYPE"_"$FLAVOR",$TYPE,$FLAVOR}.conf 2>/dev/null`
+ cfg_file=`ls $COMPASS_DIR/deploy/conf/{base,"$TYPE"_"$FLAVOR",$TYPE,$FLAVOR,compass}.conf 2>/dev/null`
option_name=`get_option_name_list "$cfg_file"`
option_flag=`get_option_flag_list "$option_name"`
diff --git a/deploy/host_virtual.sh b/deploy/host_virtual.sh
index 0754b1f4..35ab4352 100644
--- a/deploy/host_virtual.sh
+++ b/deploy/host_virtual.sh
@@ -31,7 +31,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_BRIDGE_MGMT/br_install/g" \
- -e "s/REPLACE_BRIDGE_TENANT/br_install/g" \
+ -e "s/REPLACE_BRIDGE_TENANT/br_external/g" \
-e "s/REPLACE_BRIDGE_PUBLIC/br_install/g" \
-e "s/REPLACE_BRIDGE_STORAGE/br_install/g" \
$COMPASS_DIR/deploy/template/vm/host.xml\
diff --git a/deploy/launch.sh b/deploy/launch.sh
index c040900c..6397cceb 100755
--- a/deploy/launch.sh
+++ b/deploy/launch.sh
@@ -10,6 +10,7 @@ source $(process_input_para $*) || exit 1
source ${COMPASS_DIR}/deploy/conf/${FLAVOR}.conf
source ${COMPASS_DIR}/deploy/conf/${TYPE}.conf
source ${COMPASS_DIR}/deploy/conf/base.conf
+source ${COMPASS_DIR}/deploy/conf/compass.conf
source ${COMPASS_DIR}/deploy/prepare.sh
source ${COMPASS_DIR}/deploy/network.sh
source ${COMPASS_DIR}/deploy/host_${TYPE}.sh
diff --git a/deploy/network.sh b/deploy/network.sh
index a5344f58..e5133c9e 100755
--- a/deploy/network.sh
+++ b/deploy/network.sh
@@ -8,15 +8,20 @@ function destroy_bridge()
{
bridge=$1
nic=$2
- install_gw="$3"
+ ip="$3"
brige_info=$(ip addr show $bridge 2>/dev/null)
if [[ -z $brige_info ]]; then
return
fi
- ips=`echo "$brige_info" | grep 'inet ' | grep -v $install_gw | sed "s/inet //g"`
- routes=$(ip route show | grep $bridge | grep -v $install_gw)
+ if [[ -n $ip ]]; then
+ ip addr delete $ip dev $bridge | true
+ fi
+
+ ips=`echo "$brige_info" | grep 'inet ' | sed "s/inet //g"`
+
+ routes=$(ip route show | grep $bridge)
ip link set $bridge down
@@ -77,9 +82,6 @@ function create_bridge()
done
fi
- mask_len=`get_mask_len $INSTALL_MASK`
- broadcast=`get_broadcast_addr $INSTALL_GW $INSTALL_MASK`
- ip addr add $INSTALL_GW/$mask_len brd $broadcast dev $bridge
if [[ -n $routes ]]; then
echo "$routes" | while read line; do
@@ -88,12 +90,36 @@ function create_bridge()
fi
}
-function setup_om_bridge() {
- destroy_bridge br_install $OM_NIC $INSTALL_GW
- create_bridge br_install $OM_NIC
+function add_install_ip() {
+ mask_len=`get_mask_len $INSTALL_MASK`
+ broadcast=`get_broadcast_addr $INSTALL_GW $INSTALL_MASK`
+ ip addr add $INSTALL_GW/$mask_len brd $broadcast dev $bridge
+}
+
+function setup_install_bridge() {
+ destroy_bridge br_install $INSTALL_NIC $INSTALL_GW
+ create_bridge br_install $INSTALL_NIC
+ add_install_ip
}
-function setup_om_nat() {
+function setup_external_net() {
+ if [[ -z `brctl show br_external 2>/dev/null` ]]; then
+ brctl addbr br_external
+ fi
+
+ if [[ -z $EXTERNAL_NIC ]]; then
+ return
+ fi
+
+ if [[ $TYPE == baremetal && $EXTERNAL_NIC == $INSTALL_NIC ]]; then
+ exit 1
+ fi
+
+ destroy_bridge br_external $EXTERNAL_NIC ""
+ create_bridge br_external $EXTERNAL_NIC
+}
+
+function setup_install_nat() {
destroy_nat install
# create install network
sed -e "s/REPLACE_BRIDGE/br_install/g" \
@@ -126,9 +152,12 @@ function create_nets() {
# create install network
if [[ ! -z $VIRT_NUMBER ]];then
- setup_om_nat
+ setup_install_nat
else
- setup_om_bridge
+ setup_install_bridge
fi
+
+ # create external network
+ setup_external_net
}
diff --git a/deploy/template/vm/compass.xml b/deploy/template/vm/compass.xml
index 918a9f21..453e728d 100644
--- a/deploy/template/vm/compass.xml
+++ b/deploy/template/vm/compass.xml
@@ -46,6 +46,11 @@
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</interface>
+ <interface type='bridge'>
+ <source bridge='REPLACE_BRIDGE_EXTERNAL'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+ </interface>
<serial type='pty'>
<target port='0'/>
</serial>