Skip to content

Commit a6a4546

Browse files
Add ironic-python-agent support to devstack
This adds support for using ironic-python-agent with Ironic. Change-Id: I8f1e93e09ddde447996ecbedceb091f51d60040e
1 parent 722284f commit a6a4546

2 files changed

Lines changed: 62 additions & 6 deletions

File tree

lib/ironic

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ IRONIC_DEPLOY_RAMDISK=${IRONIC_DEPLOY_RAMDISK:-}
7676
IRONIC_DEPLOY_KERNEL=${IRONIC_DEPLOY_KERNEL:-}
7777
IRONIC_DEPLOY_ELEMENT=${IRONIC_DEPLOY_ELEMENT:-deploy-ironic}
7878

79+
IRONIC_AGENT_TARBALL=${IRONIC_AGENT_TARBALL:-http://tarballs.openstack.org/ironic-python-agent/coreos/ipa-coreos.tar.gz}
80+
81+
# Which deploy driver to use - valid choices right now
82+
# are 'pxe_ssh' and 'agent_ssh'.
83+
IRONIC_DEPLOY_DRIVER=${IRONIC_DEPLOY_DRIVER:-pxe_ssh}
84+
7985
#TODO(agordeev): replace 'ubuntu' with host distro name getting
8086
IRONIC_DEPLOY_FLAVOR=${IRONIC_DEPLOY_FLAVOR:-ubuntu $IRONIC_DEPLOY_ELEMENT}
8187

@@ -218,6 +224,22 @@ function configure_ironic_conductor {
218224
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
219225
iniset $IRONIC_CONF_FILE pxe pxe_append_params "nofb nomodeset vga=normal console=ttyS0"
220226
fi
227+
if [[ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ]] ; then
228+
if [[ "$SWIFT_ENABLE_TEMPURLS" == "True" ]] ; then
229+
iniset $IRONIC_CONF_FILE glance swift_temp_url_key $SWIFT_TEMPURL_KEY
230+
else
231+
die $LINENO "SWIFT_ENABLE_TEMPURLS must be True to use agent_ssh driver in Ironic."
232+
fi
233+
iniset $IRONIC_CONF_FILE glance swift_endpoint_url http://${HOST_IP}:8080
234+
iniset $IRONIC_CONF_FILE glance swift_api_version v1
235+
iniset $IRONIC_CONF_FILE glance swift_account AUTH_${SERVICE_TENANT}
236+
iniset $IRONIC_CONF_FILE glance swift_container glance
237+
iniset $IRONIC_CONF_FILE glance swift_temp_url_duration 3600
238+
iniset $IRONIC_CONF_FILE agent heartbeat_timeout 30
239+
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
240+
iniset $IRONIC_CONF_FILE agent agent_pxe_append_params "nofb nomodeset vga=normal console=ttyS0"
241+
fi
242+
fi
221243
}
222244

223245
# create_ironic_cache_dir() - Part of the init_ironic() process
@@ -365,10 +387,21 @@ function create_bridge_and_vms {
365387
function enroll_vms {
366388
local chassis_id=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2)
367389
local idx=0
390+
391+
if [[ "$IRONIC_DEPLOY_DRIVER" == "pxe_ssh" ]] ; then
392+
local _IRONIC_DEPLOY_KERNEL_KEY=pxe_deploy_kernel
393+
local _IRONIC_DEPLOY_RAMDISK_KEY=pxe_deploy_ramdisk
394+
elif [[ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ]] ; then
395+
local _IRONIC_DEPLOY_KERNEL_KEY=deploy_kernel
396+
local _IRONIC_DEPLOY_RAMDISK_KEY=deploy_ramdisk
397+
fi
398+
368399
while read MAC; do
369-
local node_id=$(ironic node-create --chassis_uuid $chassis_id --driver pxe_ssh \
370-
-i pxe_deploy_kernel=$IRONIC_DEPLOY_KERNEL_ID \
371-
-i pxe_deploy_ramdisk=$IRONIC_DEPLOY_RAMDISK_ID \
400+
401+
local node_id=$(ironic node-create --chassis_uuid $chassis_id \
402+
--driver $IRONIC_DEPLOY_DRIVER \
403+
-i $_IRONIC_DEPLOY_KERNEL_KEY=$IRONIC_DEPLOY_KERNEL_ID \
404+
-i $_IRONIC_DEPLOY_RAMDISK_KEY=$IRONIC_DEPLOY_RAMDISK_ID \
372405
-i ssh_virt_type=$IRONIC_SSH_VIRT_TYPE \
373406
-i ssh_address=$IRONIC_VM_SSH_ADDRESS \
374407
-i ssh_port=$IRONIC_VM_SSH_PORT \
@@ -480,13 +513,27 @@ function upload_baremetal_ironic_deploy {
480513
if [ "$IRONIC_BUILD_DEPLOY_RAMDISK" = "True" ]; then
481514
# we can build them only if we're not offline
482515
if [ "$OFFLINE" != "True" ]; then
483-
$DIB_DIR/bin/ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
484-
-o $TOP_DIR/files/ir-deploy
516+
if [ "$IRONIC_DEPLOY_RAMDISK" == "agent_ssh" ]; then
517+
die $LINENO "Ironic-python-agent build is not yet supported"
518+
else
519+
$DIB_DIR/bin/ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
520+
-o $TOP_DIR/files/ir-deploy
521+
fi
485522
else
486523
die $LINENO "Deploy kernel+ramdisk files don't exist and cannot be build in OFFLINE mode"
487524
fi
488525
else
489-
die $LINENO "Deploy kernel+ramdisk files don't exist and their building was disabled explicitly by IRONIC_BUILD_DEPLOY_RAMDISK"
526+
if [ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ]; then
527+
# download the agent image tarball
528+
wget "$IRONIC_AGENT_TARBALL" -O ironic_agent_tarball.tar.gz
529+
tar zxfv ironic_agent_tarball.tar.gz
530+
mv UPLOAD/coreos_production_pxe.vmlinuz $IRONIC_DEPLOY_KERNEL_PATH
531+
mv UPLOAD/coreos_production_pxe_image-oem.cpio.gz $IRONIC_DEPLOY_RAMDISK_PATH
532+
rm -rf UPLOAD
533+
rm ironic_agent_tarball.tar.gz
534+
else
535+
die $LINENO "Deploy kernel+ramdisk files don't exist and their building was disabled explicitly by IRONIC_BUILD_DEPLOY_RAMDISK"
536+
fi
490537
fi
491538
fi
492539

stackrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,15 @@ case "$VIRT_DRIVER" in
366366
DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.0-x86_64-disk}
367367
IMAGE_URLS=${IMAGE_URLS:-"https://github.com/downloads/citrix-openstack/warehouse/cirros-0.3.0-x86_64-disk.vhd.tgz"}
368368
IMAGE_URLS+=",http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-uec.tar.gz";;
369+
ironic)
370+
# Ironic can do both partition and full disk images, depending on the driver
371+
if [[ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ]]; then
372+
DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-x86_64-disk}
373+
else
374+
DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-x86_64-uec}
375+
fi
376+
IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-uec.tar.gz"}
377+
IMAGE_URLS+=",http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-disk.img";;
369378
*) # Default to Cirros with kernel, ramdisk and disk image
370379
DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec}
371380
IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec.tar.gz"};;

0 commit comments

Comments
 (0)