← Back to team overview

openstack team mailing list archive

cloud-init support for config-drive

 

Hey all,
   I recently (yesterday) added 'configdrive' support to cloud-init.
The most recent daily builds of ubuntu 12.04 (precise) [1] should
be able to take advantage of configdrive.
   I tried to document what I have at
 http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/configdrive/README

   I'd really like people to take it for a spin.  From the code I've read,
it looks like I  need to setup multinic in order to get 'interfaces' file
inserted, so I've not actually tested that path.  I'm not sure how to
configure multinic (and get nova command line to use '-nic' correctly).

   Anyway, the most recent cloud images at
https://cloud-images.ubuntu.com/server/precise/current/ (after 20111216)
have support baked in.

   Example of how to use it below.  The goal is that you can now use
cloud-init with configdrive and no EC2 metadata service.

   Please give it a try and let me know what you find.

## 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