summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin chi <chigang@huawei.com>2015-10-12 05:32:17 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-10-12 05:32:17 +0000
commit2cbacbc060805b446769def612253798f3b7fb03 (patch)
tree1619e8bde3ff9f988b7f7a7bd9ce7a8a5f2cf867
parentd27248783e7f49f4edb3a584ffd06c56c61b32c5 (diff)
parent80c770bb093ad2af54171de1a2c4630536d4daf0 (diff)
Merge "bugfix: libvirt_type should be kvm when host is barebetal mode"
-rwxr-xr-xbuild.sh6
-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
-rw-r--r--util/isolinux.cfg40
-rw-r--r--util/ks.cfg24
15 files changed, 160 insertions, 35 deletions
diff --git a/build.sh b/build.sh
index 88308190..7151317a 100755
--- a/build.sh
+++ b/build.sh
@@ -32,8 +32,7 @@ function download_git()
file_dir=$CACHE_DIR/${1%.*}
if [[ -d $file_dir/.git ]]; then
cd $file_dir
- git fetch origin master
- git checkout origin/master
+ git pull origin master
cd -
else
rm -rf $CACHE_DIR/$file_dir
@@ -74,9 +73,6 @@ function download_packages()
download_local $name $i
fi
done
-
- git fetch
- git checkout origin/master -- $COMPASS_DIR/deploy/adapters
}
function copy_file()
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>
diff --git a/util/isolinux.cfg b/util/isolinux.cfg
new file mode 100644
index 00000000..ca612f77
--- /dev/null
+++ b/util/isolinux.cfg
@@ -0,0 +1,40 @@
+default vesamenu.c32
+#prompt 1
+timeout 15
+
+display boot.msg
+
+menu background splash.jpg
+menu title Welcome to CentOS 6.5!
+menu color border 0 #ffffffff #00000000
+menu color sel 7 #ffffffff #ff000000
+menu color title 0 #ffffffff #00000000
+menu color tabmsg 0 #ffffffff #00000000
+menu color unsel 0 #ffffffff #00000000
+menu color hotsel 0 #ff000000 #ffffffff
+menu color hotkey 7 #ffffffff #ff000000
+menu color scrollbar 0 #ffffffff #00000000
+
+label linux
+ menu label ^Install or upgrade an existing system
+ menu default
+ kernel vmlinuz
+ append ks=cdrom:/isolinux/ks.cfg initrd=initrd.img mgmt_ip=REPLACE_MGMT_IP mgmt_netmask=REPLACE_MGMT_NETMASK install_ip=REPLACE_INSTALL_IP install_netmask=REPLACE_INSTALL_NETMASK gw=REPLACE_GW external_ip=REPLACE_COMPASS_EXTERNAL_IP external_mask=REPLACE_COMPASS_EXTERNAL_NETMASK external_gw=REPLACE_COMPASS_EXTERNAL_GW dns1=REPLACE_COMPASS_DNS1 dns2=REPLACE_COMPASS_DNS2
+
+
+label vesa
+ menu label Install system with ^basic video driver
+ kernel vmlinuz
+ append initrd=initrd.img xdriver=vesa nomodeset
+label rescue
+ menu label ^Rescue installed system
+ kernel vmlinuz
+ append initrd=initrd.img rescue
+label local
+ menu label Boot from ^local drive
+ localboot 0xffff
+label memtest86
+ menu label ^Memory test
+ kernel memtest
+ append -
+
diff --git a/util/ks.cfg b/util/ks.cfg
index 7d70e6f2..9e33f42f 100644
--- a/util/ks.cfg
+++ b/util/ks.cfg
@@ -166,7 +166,11 @@ function save_nic_cfg() {
}
function save_gateway() {
- echo GATEWAY=$gw >> /etc/sysconfig/network
+ if [[ -z $external_gw ]]; then
+ echo GATEWAY=$gw >> /etc/sysconfig/network
+ else
+ echo GATEWAY=$external_gw >> /etc/sysconfig/network
+ fi
search="domain $domain\nsearch $domain"
echo -e "${search}\nnameserver 127.0.0.1" > /etc/resolv.conf
[ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/resolv.conf
@@ -175,7 +179,11 @@ function save_gateway() {
[ $dns2 ] && echo "nameserver $dns2" >> /etc/dnsmasq.upstream
if [[ -z "$dns1" && -z "$dns2" ]]; then
- echo "nameserver $gw" >> /etc/resolv.conf
+ if [[ -z $external_gw ]]; then
+ echo "nameserver $gw" >> /etc/resolv.conf
+ else
+ echo "nameserver $external_gw" >> /etc/resolv.conf
+ fi
fi
}
# Default FQDN
@@ -184,19 +192,29 @@ hostname="compass"
for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
domain=$hostname
gw=$gw
+ex_gw=$external_gw
install_ip=$install_ip
install_netmask=$install_netmask
install_intf="eth1"
install_hwaddr=`ifconfig $install_intf | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
+save_nic_cfg $install_intf $install_ip $install_netmask $install_hwaddr
+
mgmt_ip=$mgmt_ip
mgmt_netmask=$mgmt_netmask
mgmt_intf="eth0"
mgmt_hwaddr=`ifconfig $mgmt_intf | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
-save_nic_cfg $install_intf $install_ip $install_netmask $install_hwaddr
save_nic_cfg $mgmt_intf $mgmt_ip $mgmt_netmask $mgmt_hwaddr
+
+external_ip=$external_ip
+external_netmask=$external_mask
+external_intf="eth2"
+external_hwaddr=`ifconfig $external_intf | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
+
+save_nic_cfg $external_intf $external_ip $external_netmask $external_hwaddr
+
save_gateway
# already chroot