Revision history [back]

click to hide/show revision 1
initial version

You can pass your instances a script to run at first boot. You do this as a user-data script, but the default mechanism for obtaining this information is via the Nova metadata service, which requires your system to already have an ip address.

In situations where networking is not available, you can pass this information as a config driver (providing the --config-drive=true option to nova boot). This will make metadata about your instance -- including the user-data script -- available to tools like cloud-init that handle initial boot configuration.

The config drive will contain the normal ec2 metadata, including the local-ipv4 address assigned by openstack. You can read this in your user-data script and manually configure the interface, rather than relying on a dhcp server.

Your boot command would look something like:

nova boot --user-data=path/to/myscript.sh --config-drive=true ...

You can pass your instances a script to run at first boot. You do this as a user-data script, but the default mechanism for obtaining this information is via the Nova metadata service, which requires your system to already have an ip address.

In situations where networking is not available, you can pass this information as a config driver (providing the --config-drive=true option to nova boot). This will make metadata about your instance -- including the user-data script -- available to tools like cloud-init that handle initial boot configuration.

If your image does not have cloud-init available, you can process the metadata yourself. The config drive will be attached as a CD-ROM device, typically /dev/sr0, that contains the following files:

./ec2/2009-04-04/meta-data.json
./ec2/2009-04-04/user-data
./ec2/latest/meta-data.json
./ec2/latest/user-data
./openstack/2012-08-10/meta_data.json
./openstack/2012-08-10/user_data
./openstack/2013-04-04/meta_data.json
./openstack/2013-04-04/user_data
./openstack/2013-10-17/meta_data.json
./openstack/2013-10-17/user_data
./openstack/2013-10-17/vendor_data.json
./openstack/latest/meta_data.json
./openstack/latest/user_data
./openstack/latest/vendor_data.json

The config drive will contain the normal ec2 metadata, including the local-ipv4 address assigned by openstack. You can read this in your user-data script and manually configure the interface, rather than relying on a dhcp server.

Your boot command would look something like:

nova boot --user-data=path/to/myscript.sh --config-drive=true ...