Browse code

Add ironic-python-agent support to devstack

This adds support for using ironic-python-agent with Ironic.

Change-Id: I8f1e93e09ddde447996ecbedceb091f51d60040e

Jim Rollenhagen authored on 2014/08/06 03:08:29
Showing 2 changed files
... ...
@@ -76,6 +76,12 @@ IRONIC_DEPLOY_RAMDISK=${IRONIC_DEPLOY_RAMDISK:-}
76 76
 IRONIC_DEPLOY_KERNEL=${IRONIC_DEPLOY_KERNEL:-}
77 77
 IRONIC_DEPLOY_ELEMENT=${IRONIC_DEPLOY_ELEMENT:-deploy-ironic}
78 78
 
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
+
79 85
 #TODO(agordeev): replace 'ubuntu' with host distro name getting
80 86
 IRONIC_DEPLOY_FLAVOR=${IRONIC_DEPLOY_FLAVOR:-ubuntu $IRONIC_DEPLOY_ELEMENT}
81 87
 
... ...
@@ -218,6 +224,22 @@ function configure_ironic_conductor {
218 218
     if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
219 219
         iniset $IRONIC_CONF_FILE pxe pxe_append_params "nofb nomodeset vga=normal console=ttyS0"
220 220
     fi
221
+    if [[ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ]] ; then
222
+        if [[ "$SWIFT_ENABLE_TEMPURLS" == "True" ]] ; then
223
+            iniset $IRONIC_CONF_FILE glance swift_temp_url_key $SWIFT_TEMPURL_KEY
224
+        else
225
+            die $LINENO "SWIFT_ENABLE_TEMPURLS must be True to use agent_ssh driver in Ironic."
226
+        fi
227
+        iniset $IRONIC_CONF_FILE glance swift_endpoint_url http://${HOST_IP}:8080
228
+        iniset $IRONIC_CONF_FILE glance swift_api_version v1
229
+        iniset $IRONIC_CONF_FILE glance swift_account AUTH_${SERVICE_TENANT}
230
+        iniset $IRONIC_CONF_FILE glance swift_container glance
231
+        iniset $IRONIC_CONF_FILE glance swift_temp_url_duration 3600
232
+        iniset $IRONIC_CONF_FILE agent heartbeat_timeout 30
233
+        if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
234
+            iniset $IRONIC_CONF_FILE agent agent_pxe_append_params "nofb nomodeset vga=normal console=ttyS0"
235
+        fi
236
+    fi
221 237
 }
222 238
 
223 239
 # create_ironic_cache_dir() - Part of the init_ironic() process
... ...
@@ -365,10 +387,21 @@ function create_bridge_and_vms {
365 365
 function enroll_vms {
366 366
     local chassis_id=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2)
367 367
     local idx=0
368
+
369
+    if [[ "$IRONIC_DEPLOY_DRIVER" == "pxe_ssh" ]] ; then
370
+        local _IRONIC_DEPLOY_KERNEL_KEY=pxe_deploy_kernel
371
+        local _IRONIC_DEPLOY_RAMDISK_KEY=pxe_deploy_ramdisk
372
+    elif [[ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ]] ; then
373
+        local _IRONIC_DEPLOY_KERNEL_KEY=deploy_kernel
374
+        local _IRONIC_DEPLOY_RAMDISK_KEY=deploy_ramdisk
375
+    fi
376
+
368 377
     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 \
378
+
379
+        local node_id=$(ironic node-create --chassis_uuid $chassis_id \
380
+            --driver $IRONIC_DEPLOY_DRIVER \
381
+            -i $_IRONIC_DEPLOY_KERNEL_KEY=$IRONIC_DEPLOY_KERNEL_ID \
382
+            -i $_IRONIC_DEPLOY_RAMDISK_KEY=$IRONIC_DEPLOY_RAMDISK_ID \
372 383
             -i ssh_virt_type=$IRONIC_SSH_VIRT_TYPE \
373 384
             -i ssh_address=$IRONIC_VM_SSH_ADDRESS \
374 385
             -i ssh_port=$IRONIC_VM_SSH_PORT \
... ...
@@ -480,13 +513,27 @@ function upload_baremetal_ironic_deploy {
480 480
         if [ "$IRONIC_BUILD_DEPLOY_RAMDISK" = "True" ]; then
481 481
             # we can build them only if we're not offline
482 482
             if [ "$OFFLINE" != "True" ]; then
483
-                $DIB_DIR/bin/ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
484
-                    -o $TOP_DIR/files/ir-deploy
483
+                if [ "$IRONIC_DEPLOY_RAMDISK" == "agent_ssh" ]; then
484
+                    die $LINENO "Ironic-python-agent build is not yet supported"
485
+                else
486
+                    $DIB_DIR/bin/ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
487
+                        -o $TOP_DIR/files/ir-deploy
488
+                fi
485 489
             else
486 490
                 die $LINENO "Deploy kernel+ramdisk files don't exist and cannot be build in OFFLINE mode"
487 491
             fi
488 492
         else
489
-            die $LINENO "Deploy kernel+ramdisk files don't exist and their building was disabled explicitly by IRONIC_BUILD_DEPLOY_RAMDISK"
493
+            if [ "$IRONIC_DEPLOY_DRIVER" == "agent_ssh" ]; then
494
+                # download the agent image tarball
495
+                wget "$IRONIC_AGENT_TARBALL" -O ironic_agent_tarball.tar.gz
496
+                tar zxfv ironic_agent_tarball.tar.gz
497
+                mv UPLOAD/coreos_production_pxe.vmlinuz $IRONIC_DEPLOY_KERNEL_PATH
498
+                mv UPLOAD/coreos_production_pxe_image-oem.cpio.gz $IRONIC_DEPLOY_RAMDISK_PATH
499
+                rm -rf UPLOAD
500
+                rm ironic_agent_tarball.tar.gz
501
+            else
502
+                die $LINENO "Deploy kernel+ramdisk files don't exist and their building was disabled explicitly by IRONIC_BUILD_DEPLOY_RAMDISK"
503
+            fi
490 504
         fi
491 505
     fi
492 506
 
... ...
@@ -366,6 +366,15 @@ case "$VIRT_DRIVER" in
366 366
         DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-0.3.0-x86_64-disk}
367 367
         IMAGE_URLS=${IMAGE_URLS:-"https://github.com/downloads/citrix-openstack/warehouse/cirros-0.3.0-x86_64-disk.vhd.tgz"}
368 368
         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";;
369 378
     *) # Default to Cirros with kernel, ramdisk and disk image
370 379
         DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec}
371 380
         IMAGE_URLS=${IMAGE_URLS:-"http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-uec.tar.gz"};;