@@ -93,7 +93,7 @@ IRONIC_AGENT_KERNEL_URL=${IRONIC_AGENT_KERNEL_URL:-http://tarballs.openstack.org
9393IRONIC_AGENT_RAMDISK_URL=${IRONIC_AGENT_RAMDISK_URL:-http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe_image-oem.cpio.gz}
9494
9595# Which deploy driver to use - valid choices right now
96- # are 'pxe_ssh', 'pxe_ipmitool' and 'agent_ssh '.
96+ # are 'pxe_ssh', 'pxe_ipmitool', 'agent_ssh' and 'agent_ipmitool '.
9797IRONIC_DEPLOY_DRIVER=${IRONIC_DEPLOY_DRIVER:-pxe_ssh}
9898
9999#TODO(agordeev): replace 'ubuntu' with host distro name getting
@@ -152,6 +152,11 @@ function is_ironic_hardware {
152152 return 1
153153}
154154
155+ function is_deployed_by_agent {
156+ [[ -z "${IRONIC_DEPLOY_DRIVER%%agent*}" ]] && return 0
157+ return 1
158+ }
159+
155160# install_ironic() - Collect source and prepare
156161function install_ironic {
157162 # make sure all needed service were enabled
@@ -307,7 +312,7 @@ function configure_ironic_conductor {
307312 if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
308313 iniset $IRONIC_CONF_FILE pxe pxe_append_params "nofb nomodeset vga=normal console=ttyS0"
309314 fi
310- if [[ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ]] ; then
315+ if is_deployed_by_agent ; then
311316 if [[ "$SWIFT_ENABLE_TEMPURLS" == "True" ]] ; then
312317 iniset $IRONIC_CONF_FILE glance swift_temp_url_key $SWIFT_TEMPURL_KEY
313318 else
@@ -510,7 +515,7 @@ function enroll_nodes {
510515 if [[ "$IRONIC_DEPLOY_DRIVER" == "pxe_ssh" ]] ; then
511516 local _IRONIC_DEPLOY_KERNEL_KEY=pxe_deploy_kernel
512517 local _IRONIC_DEPLOY_RAMDISK_KEY=pxe_deploy_ramdisk
513- elif [[ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ]] ; then
518+ elif is_deployed_by_agent ; then
514519 local _IRONIC_DEPLOY_KERNEL_KEY=deploy_kernel
515520 local _IRONIC_DEPLOY_RAMDISK_KEY=deploy_ramdisk
516521 fi
@@ -552,6 +557,10 @@ function enroll_nodes {
552557 # we create the bare metal flavor with minimum value
553558 local node_options="-i ipmi_address=$ipmi_address -i ipmi_password=$ironic_ipmi_passwd\
554559 -i ipmi_username=$ironic_ipmi_username"
560+ if is_deployed_by_agent; then
561+ node_options+=" -i $_IRONIC_DEPLOY_KERNEL_KEY=$IRONIC_DEPLOY_KERNEL_ID"
562+ node_options+=" -i $_IRONIC_DEPLOY_RAMDISK_KEY=$IRONIC_DEPLOY_RAMDISK_ID"
563+ fi
555564 fi
556565
557566 local node_id=$(ironic node-create --chassis_uuid $chassis_id \
@@ -589,7 +598,7 @@ function configure_iptables {
589598 # nodes boot from TFTP and callback to the API server listening on $HOST_IP
590599 sudo iptables -I INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
591600 sudo iptables -I INPUT -d $HOST_IP -p tcp --dport $IRONIC_SERVICE_PORT -j ACCEPT || true
592- if [ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ] ; then
601+ if is_deployed_by_agent ; then
593602 # agent ramdisk gets instance image from swift
594603 sudo iptables -I INPUT -d $HOST_IP -p tcp --dport ${SWIFT_DEFAULT_BIND_PORT:-8080} -j ACCEPT || true
595604 fi
@@ -665,8 +674,8 @@ function upload_baremetal_ironic_deploy {
665674 fi
666675
667676 if [ -z "$IRONIC_DEPLOY_KERNEL" -o -z "$IRONIC_DEPLOY_RAMDISK" ]; then
668- local IRONIC_DEPLOY_KERNEL_PATH=$TOP_DIR/files/ir-deploy.kernel
669- local IRONIC_DEPLOY_RAMDISK_PATH=$TOP_DIR/files/ir-deploy.initramfs
677+ local IRONIC_DEPLOY_KERNEL_PATH=$TOP_DIR/files/ir-deploy-$IRONIC_DEPLOY_DRIVER .kernel
678+ local IRONIC_DEPLOY_RAMDISK_PATH=$TOP_DIR/files/ir-deploy-$IRONIC_DEPLOY_DRIVER .initramfs
670679 else
671680 local IRONIC_DEPLOY_KERNEL_PATH=$IRONIC_DEPLOY_KERNEL
672681 local IRONIC_DEPLOY_RAMDISK_PATH=$IRONIC_DEPLOY_RAMDISK
@@ -677,17 +686,17 @@ function upload_baremetal_ironic_deploy {
677686 if [ "$IRONIC_BUILD_DEPLOY_RAMDISK" = "True" ]; then
678687 # we can build them only if we're not offline
679688 if [ "$OFFLINE" != "True" ]; then
680- if [ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ] ; then
689+ if is_deployed_by_agent ; then
681690 build_ipa_coreos_ramdisk $IRONIC_DEPLOY_KERNEL_PATH $IRONIC_DEPLOY_RAMDISK_PATH
682691 else
683692 ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
684- -o $TOP_DIR/files/ir-deploy
693+ -o $TOP_DIR/files/ir-deploy-$IRONIC_DEPLOY_DRIVER
685694 fi
686695 else
687696 die $LINENO "Deploy kernel+ramdisk files don't exist and cannot be build in OFFLINE mode"
688697 fi
689698 else
690- if [ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ] ; then
699+ if is_deployed_by_agent ; then
691700 # download the agent image tarball
692701 wget "$IRONIC_AGENT_KERNEL_URL" -O $IRONIC_DEPLOY_KERNEL_PATH
693702 wget "$IRONIC_AGENT_RAMDISK_URL" -O $IRONIC_DEPLOY_RAMDISK_PATH
@@ -751,7 +760,7 @@ function cleanup_baremetal_basic_ops {
751760 restart_service xinetd
752761 sudo iptables -D INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
753762 sudo iptables -D INPUT -d $HOST_IP -p tcp --dport $IRONIC_SERVICE_PORT -j ACCEPT || true
754- if [ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ] ; then
763+ if is_deployed_by_agent ; then
755764 # agent ramdisk gets instance image from swift
756765 sudo iptables -D INPUT -d $HOST_IP -p tcp --dport ${SWIFT_DEFAULT_BIND_PORT:-8080} -j ACCEPT || true
757766 fi
0 commit comments