From 316f9ee4bfb27375ae92027664a59b94922f11ec Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 17 Feb 2012 16:58:02 -0500 Subject: more documentation on configdrive --- doc/configdrive/README | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'doc') diff --git a/doc/configdrive/README b/doc/configdrive/README index 1ad7b0d0..ed9033c9 100644 --- a/doc/configdrive/README +++ b/doc/configdrive/README @@ -67,6 +67,51 @@ the following ways: This provides cloud-init user-data. See other documentation for what all can be present here. +== Example == +Here is an example using the nova client (python-novaclien) + +Assuming the following variables set up: + * img_id : set to the nova image id (uuid from image-list) + * flav_id : set to numeric flavor_id (nova flavor-list) + * keyname : set to name of key for this instance (nova keypair-list) + +$ cat my-user-data +#!/bin/sh +echo ==== USER_DATA FROM EC2 MD ==== | tee /ud.log + +$ ud_value=$(sed 's,EC2 MD,META KEY,') + +## Now, 'ud_value' has same content of my-user-data file, but +## with the string "USER_DATA FROM META KEY" + +## launch an instance with dsmode=pass +## This will really not use the configdrive for anything as the mode +## for the datasource is 'pass', meaning it will still expect some +## other data source (DataSourceEc2). + +$ nova boot --image=$img_id --config-drive=1 --flavor=$flav_id \ + --key_name=$keyname \ + --user_data=my-user-data \ + "--meta=instance-id=iid-001 \ + "--meta=user-data=${ud_keyval}" \ + "--meta=dsmode=pass" cfgdrive-dsmode-pass + +$ euca-get-console-output i-0000001 | grep USER_DATA +echo ==== USER_DATA FROM EC2 MD ==== | tee /ud.log + +## Now, launch an instance with dsmode=local +## This time, the only metadata and userdata available to cloud-init +## are on the config-drive +$ nova boot --image=$img_id --config-drive=1 --flavor=$flav_id \ + --key_name=$keyname \ + --user_data=my-user-data \ + "--meta=instance-id=iid-001 \ + "--meta=user-data=${ud_keyval}" \ + "--meta=dsmode=local" cfgdrive-dsmode-local + +$ euca-get-console-output i-0000002 | grep USER_DATA +echo ==== USER_DATA FROM META KEY ==== | tee /ud.log + -- [1] https://github.com/openstack/nova/blob/master/doc/source/api_ext/ext_config_drive.rst for more if -- cgit v1.2.3