From b61d9c076b4ce69312bc5e5303d58522e40352fe Mon Sep 17 00:00:00 2001 From: Sam Betts Date: Wed, 13 Apr 2016 12:40:33 +0100 Subject: [PATCH] Add support for Cisco drivers in Ironic devstack Ironic devstack currently only supports real hardware being controlled with the *_ipmitool drivers, this patch adds support for the two Cisco Ironic drivers UCS and CIMC. To provide this support it deprecates the old IRONIC_IPMIINFO_FILE replacing it with IRONIC_HWINFO_FILE, which can support extra fields on top of the standard address, mac address, username and password fields. Change-Id: Ia658835491bc8c142c1ddee58df7c4ff7fd5a352 --- devstack/lib/ironic | 80 +++++++++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index f9407d547e..83f9a6b15e 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -54,12 +54,32 @@ IRONIC_HW_NODE_RAM=${IRONIC_HW_NODE_RAM:-512} IRONIC_HW_NODE_DISK=${IRONIC_HW_NODE_DISK:-10} IRONIC_HW_EPHEMERAL_DISK=${IRONIC_HW_EPHEMERAL_DISK:-0} IRONIC_HW_ARCH=${IRONIC_HW_ARCH:-x86_64} -# The file is composed of multiple lines, each line includes four field -# separated by white space: IPMI address, MAC address, IPMI username -# and IPMI password. + +# The file is composed of multiple lines, each line includes fields +# separated by white space, in the format: # -# 192.168.110.107 00:1e:67:57:50:4c root otc123 -IRONIC_IPMIINFO_FILE=${IRONIC_IPMIINFO_FILE:-$IRONIC_DATA_DIR/hardware_info} +# [] +# +# For example: +# +# 192.168.110.107 00:1e:67:57:50:4c root otc123 +# +# Supported IRONIC_DEPLOY_DRIVERs: +# *_ipmitool: +# +# +# *_cimc: +# +# +# *_ucs: +# +# +# IRONIC_IPMIINFO_FILE is deprecated, please use IRONIC_HWINFO_FILE. IRONIC_IPMIINFO_FILE will be removed in Ocata. +IRONIC_IPMIINFO_FILE=${IRONIC_IPMIINFO_FILE:-""} +if [ ! -z "$IRONIC_IPMIINFO_FILE" ]; then + deprecated "IRONIC_IPMIINFO_FILE is deprecated, please switch to IRONIC_HWINFO_FILE. IRONIC_IPMIINFO_FILE will be removed in Ocata." +fi +IRONIC_HWINFO_FILE=${IRONIC_HWINFO_FILE:-${IRONIC_IPMIINFO_FILE:-$IRONIC_DATA_DIR/hardware_info}} # Set up defaults for functional / integration testing IRONIC_NODE_UUID=${IRONIC_NODE_UUID:-`uuidgen`} @@ -219,6 +239,16 @@ function is_deployed_by_ipmitool { return 1 } +function is_deployed_by_cimc { + [[ -z "${IRONIC_DEPLOY_DRIVER##*_cimc}" ]] && return 0 + return 1 +} + +function is_deployed_by_ucs { + [[ -z "${IRONIC_DEPLOY_DRIVER##*_ucs}" ]] && return 0 + return 1 +} + function is_deployed_with_ipa_ramdisk { is_deployed_by_agent || [[ "$IRONIC_DEPLOY_DRIVER_ISCSI_WITH_IPA" == "True" ]] && return 0 return 1 @@ -740,9 +770,7 @@ function enroll_nodes { local ironic_node_disk=$IRONIC_HW_NODE_DISK local ironic_ephemeral_disk=$IRONIC_HW_EPHEMERAL_DISK local ironic_node_arch=$IRONIC_HW_ARCH - if [[ -z "${IRONIC_DEPLOY_DRIVER##*_ipmitool}" ]]; then - local ironic_hwinfo_file=$IRONIC_IPMIINFO_FILE - fi + local ironic_hwinfo_file=$IRONIC_HWINFO_FILE fi local total_nodes=0 @@ -757,23 +785,33 @@ function enroll_nodes { vbmc_port=$(echo $hardware_info | awk '{print $2}') node_options+=" -i ipmi_port=$vbmc_port" fi - - elif is_deployed_by_ipmitool; then - local ipmi_address - ipmi_address=$(echo $hardware_info |awk '{print $1}') - local mac_address - mac_address=$(echo $hardware_info |awk '{print $2}') - local ironic_ipmi_username - ironic_ipmi_username=$(echo $hardware_info |awk '{print $3}') - local ironic_ipmi_passwd - ironic_ipmi_passwd=$(echo $hardware_info |awk '{print $4}') + else # Currently we require all hardware platform have same CPU/RAM/DISK info # in future, this can be enhanced to support different type, and then # we create the bare metal flavor with minimum value - local node_options="-i ipmi_address=$ipmi_address -i ipmi_password=$ironic_ipmi_passwd\ - -i ipmi_username=$ironic_ipmi_username" - node_options+=" -i deploy_kernel=$IRONIC_DEPLOY_KERNEL_ID" + local bmc_address + bmc_address=$(echo $hardware_info |awk '{print $1}') + local mac_address + mac_address=$(echo $hardware_info |awk '{print $2}') + local bmc_username + bmc_username=$(echo $hardware_info |awk '{print $3}') + local bmc_passwd + bmc_passwd=$(echo $hardware_info |awk '{print $4}') + local node_options="-i deploy_kernel=$IRONIC_DEPLOY_KERNEL_ID" node_options+=" -i deploy_ramdisk=$IRONIC_DEPLOY_RAMDISK_ID" + + if is_deployed_by_ipmitool; then + node_options+=" -i ipmi_address=$bmc_address -i ipmi_password=$bmc_passwd\ + -i ipmi_username=$bmc_username" + elif is_deployed_by_cimc; then + node_options+=" -i cimc_address=$bmc_address -i cimc_password=$bmc_passwd\ + -i cimc_username=$bmc_username" + elif is_deployed_by_ucs; then + local ucs_service_profile + ucs_service_profile=$(echo $hardware_info |awk '{print $5}') + node_options+=" -i ucs_address=$bmc_address -i ucs_password=$bmc_passwd\ + -i ucs_username=$bmc_username -i ucs_service_profile=$ucs_service_profile" + fi fi # First node created will be used for testing in ironic w/o glance