summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbaigk <baiguoku@huawei.com>2015-11-02 23:23:52 -0800
committerbaigk <baiguoku@huawei.com>2015-11-03 08:47:58 -0800
commitffb507c689826bb57647004f24ba8f8b8b21b758 (patch)
tree083a78d116ce981e28d61ebda3b12de82fe5d552
parent9e28b43af14bdaa4693b3d05a043ff6cdb797fbf (diff)
Create Deployment Hardware Adapter (DHA) file for compass
JIRA: COMPASS-132 Change-Id: I8e3f73b93acd8dae9f40dd43548679bc2eb1ea3c Signed-off-by: baigk <baiguoku@huawei.com>
-rw-r--r--deploy/conf/hardware_environment/huawei_us_lab/pod1/dha.yml42
-rw-r--r--deploy/conf/hardware_environment/huawei_us_lab/pod1/network.yml90
-rw-r--r--deploy/config_parse.py13
-rw-r--r--deploy/deploy_host.sh5
-rwxr-xr-xdeploy/deploy_parameter.sh43
-rwxr-xr-xdeploy/launch.sh2
6 files changed, 171 insertions, 24 deletions
diff --git a/deploy/conf/hardware_environment/huawei_us_lab/pod1/dha.yml b/deploy/conf/hardware_environment/huawei_us_lab/pod1/dha.yml
new file mode 100644
index 00000000..0d5e9b40
--- /dev/null
+++ b/deploy/conf/hardware_environment/huawei_us_lab/pod1/dha.yml
@@ -0,0 +1,42 @@
+
+TYPE: baremetal
+FLAVOR: cluster
+POWER_TOOL: ipmitool
+
+ipmiUser: root
+ipmiPass: root
+ipmiVer: '2.0'
+
+hosts:
+ - name: host1
+ mac: '80:FB:06:35:8C:84'
+ ipmiIp: 10.145.140.201
+ roles:
+ - controller
+ - ha
+
+ - name: host2
+ mac: '4C:B1:6C:90:57:CF'
+ ipmiIp: 10.145.140.202
+ roles:
+ - controller
+ - ha
+
+ - name: host3
+ mac: '4C:B1:6C:90:57:E4'
+ ipmiIp: 10.145.140.203
+ roles:
+ - controller
+ - ha
+
+ - name: host4
+ mac: '4C:B1:6C:90:57:D8'
+ ipmiIp: 10.145.140.204
+ roles:
+ - compute
+
+ - name: host5
+ mac: '4C:B1:6C:90:57:D2'
+ ipmiIp: 10.145.140.205
+ roles:
+ - compute
diff --git a/deploy/conf/hardware_environment/huawei_us_lab/pod1/network.yml b/deploy/conf/hardware_environment/huawei_us_lab/pod1/network.yml
new file mode 100644
index 00000000..38e5b6e8
--- /dev/null
+++ b/deploy/conf/hardware_environment/huawei_us_lab/pod1/network.yml
@@ -0,0 +1,90 @@
+nic_mappings: []
+bond_mappings: []
+
+provider_net_mappings:
+ - name: br-prv
+ network: physnet
+ interface: eth1
+ type: ovs
+ role:
+ - controller
+ - compute
+
+sys_intf_mappings:
+ - name: mgmt
+ interface: eth1
+ vlan_tag: 101
+ type: vlan
+ role:
+ - controller
+ - compute
+
+ - name: storage
+ interface: eth1
+ vlan_tag: 102
+ type: vlan
+ role:
+ - controller
+ - compute
+
+ - name: external
+ interface: br-prv
+ vlan_tag: 1411
+ type: vlan
+ role:
+ - controller
+ - compute
+
+ip_settings:
+ - name: mgmt
+ ip_ranges:
+ - - "172.16.1.1"
+ - "172.16.1.254"
+ cidr: "172.16.1.0/24"
+ role:
+ - controller
+ - compute
+
+ - name: storage
+ ip_ranges:
+ - - "172.16.2.1"
+ - "172.16.2.254"
+ cidr: "172.16.2.0/24"
+ role:
+ - controller
+ - compute
+
+ - name: external
+ ip_ranges:
+ - - "10.145.140.100"
+ - "10.145.140.110"
+ cidr: "10.145.140.0/23"
+ gw: "10.145.140.1"
+ role:
+ - controller
+ - compute
+
+internal_vip:
+ ip: 172.16.1.222
+ netmask: "24"
+ interface: mgmt
+
+public_vip:
+ ip: 10.145.140.111
+ netmask: "23"
+ interface: external
+
+public_net_info:
+ enable: False
+ network: ext-net
+ type: vlan
+ segment_id: 1000
+ subnet: ext-subnet
+ provider_network: physnet
+ router: router-ext
+ enable_dhcp: False
+ no_gateway: False
+ external_gw: "192.168.50.1"
+ floating_ip_cidr: "192.168.50.0/24"
+ floating_ip_start: "192.168.50.221"
+ floating_ip_end: "192.168.50.231"
diff --git a/deploy/config_parse.py b/deploy/config_parse.py
index f6c0dfa4..172388ce 100644
--- a/deploy/config_parse.py
+++ b/deploy/config_parse.py
@@ -34,12 +34,15 @@ def hostroles(s, seq, host=None):
def hostmacs(s, seq, host=None):
return host.get('mac', '')
-def export_config_file(s, ofile):
+def export_config_file(s, conf_dir, ofile):
env = {}
env.update(s)
if env.get('hosts', []):
env.pop('hosts')
+ env.update({'NEUTRON': os.path.join(conf_dir, "neutron_cfg.yaml")})
+ env.update({'NETWORK': os.path.join(conf_dir, "network_cfg.yaml")})
+
env.update({'TYPE': s.get('TYPE', "virtual")})
env.update({'FLAVOR': s.get('FLAVOR', "cluster")})
env.update({'HOSTNAMES': hostnames(s, ',')})
@@ -67,19 +70,19 @@ def export_reset_file(s, tmpl_dir, output_dir, output_file):
os.system("echo 'export POWER_MANAGE=%s' >> %s" % (reset_file_name, output_file))
if __name__ == "__main__":
- if len(sys.argv) != 5:
+ if len(sys.argv) != 6:
print("parameter wrong%d %s" % (len(sys.argv), sys.argv))
sys.exit(1)
- _, config_file, tmpl_dir, output_dir, output_file = sys.argv
- config_file += '.yml'
+ _, config_file, conf_dir, tmpl_dir, output_dir, output_file = sys.argv
+
if not os.path.exists(config_file):
print("%s is not exist" % config_file)
sys.exit(1)
data = init(config_file)
- export_config_file(data, os.path.join(output_dir, output_file))
+ export_config_file(data, conf_dir, os.path.join(output_dir, output_file))
export_reset_file(data, tmpl_dir, output_dir, os.path.join(output_dir, output_file))
sys.exit(0)
diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh
index a055702e..02a53cd5 100644
--- a/deploy/deploy_host.sh
+++ b/deploy/deploy_host.sh
@@ -1,8 +1,5 @@
function deploy_host(){
- NETWORK_FILE=${COMPASS_DIR}/deploy/conf/network_cfg.yaml
- NEUTRON_FILE=${COMPASS_DIR}/deploy/conf/neutron_cfg.yaml
- pip install oslo.config
ssh $ssh_args root@${MGMT_IP} mkdir -p /opt/compass/bin/ansible_callbacks
scp $ssh_args -r ${COMPASS_DIR}/deploy/status_callback.py root@${MGMT_IP}:/opt/compass/bin/ansible_callbacks/status_callback.py
@@ -25,6 +22,6 @@ function deploy_host(){
--host_roles="${HOST_ROLES}" --default_roles="${DEFAULT_ROLES}" --switch_ips="${SWITCH_IPS}" \
--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"
+ --cluster_vip="${VIP}" --network_cfg="$NETWORK" --neutron_cfg="$NEUTRON"
}
diff --git a/deploy/deploy_parameter.sh b/deploy/deploy_parameter.sh
index 8fade105..8b2e7695 100755
--- a/deploy/deploy_parameter.sh
+++ b/deploy/deploy_parameter.sh
@@ -12,11 +12,15 @@ function get_option_flag_list()
function get_conf_name()
{
+ if [[ -n $DHA ]]; then
+ return
+ fi
+
cfg_file=`ls $COMPASS_DIR/deploy/conf/*.conf`
option_name=`get_option_name_list "$cfg_file"`
option_flag=`get_option_flag_list "$option_name"`
- TEMP=`getopt -o h -l $option_flag -n 'deploy_parameter.sh' -- "$@"`
+ TEMP=`getopt -o h -l dha:,network:,neutron:,conf-dir:,$option_flag -n 'deploy_parameter.sh' -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$TEMP"
@@ -29,11 +33,20 @@ function get_conf_name()
done
if [[ $# -eq 0 ]]; then
- echo "virtual_cluster"
+ export DHA="$COMPASS_DIR/deploy/conf/virtual_cluster.yml"
elif [[ "$1" == "five" ]];then
- echo "virtual_five"
+ export DHA="$COMPASS_DIR/deploy/conf/virtual_five.yml"
else
- echo $1
+ file=${1%*.yml}.yml
+ if [[ -f $file ]]; then
+ export DHA=$file
+ elif [[ -f $CONF_DIR/$file ]]; then
+ export DHA=$CONF_DIR/$file
+ elif [[ -f $COMPASS_DIR/deploy/conf/$file ]]; then
+ export DHA=$COMPASS_DIR/deploy/conf/$file
+ else
+ exit 1
+ fi
fi
}
@@ -47,7 +60,7 @@ function generate_input_env_file()
option_name=`get_option_name_list "$cfg_file"`
option_flag=`get_option_flag_list "$option_name"`
- TEMP=`getopt -o h -l conf-name:,$option_flag -n 'deploy_parameter.sh' -- "$@"`
+ TEMP=`getopt -o h -l dha:,network:,neutron:,conf-dir:,$option_flag -n 'deploy_parameter.sh' -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$TEMP"
@@ -58,15 +71,10 @@ function generate_input_env_file()
fi
option=`echo ${1##-?} | tr [:lower:] [:upper:] | sed 's/-/_/g'`
- echo "$option_name" | grep -w $option > /dev/null
- if [[ $? -eq 0 ]]; then
- echo "export $option=$2" >> $ofile
- shift 2
- continue
- fi
+ echo "export $option=$2" >> $ofile
+ shift 2
+ continue
- echo "Internal error!"
- exit 1
done
echo $ofile
@@ -74,8 +82,15 @@ function generate_input_env_file()
function process_default_para()
{
+ if [[ -z $CONF_DIR ]]; then
+ local set conf_dir=${COMPASS_DIR}/deploy/conf
+ else
+ local set conf_dir=$CONF_DIR
+ fi
+
+ get_conf_name $*
python ${COMPASS_DIR}/deploy/config_parse.py \
- "${COMPASS_DIR}/deploy/conf/`get_conf_name $*`" \
+ "$DHA" "$conf_dir" \
"${COMPASS_DIR}/deploy/template" \
"${WORK_DIR}/script" \
"deploy_config.sh"
diff --git a/deploy/launch.sh b/deploy/launch.sh
index d191766e..bad03cf7 100755
--- a/deploy/launch.sh
+++ b/deploy/launch.sh
@@ -5,8 +5,8 @@ mkdir -p $WORK_DIR/script
source ${COMPASS_DIR}/util/log.sh
source ${COMPASS_DIR}/deploy/deploy_parameter.sh
-source $(process_default_para $*) || exit 1
source $(process_input_para $*) || exit 1
+source $(process_default_para $*) || exit 1
source ${COMPASS_DIR}/deploy/conf/${FLAVOR}.conf
source ${COMPASS_DIR}/deploy/conf/${TYPE}.conf
source ${COMPASS_DIR}/deploy/conf/base.conf