Chapter 6. Set a Configuration Drive for Instances
You can use the
config-drive parameter to present a read-only drive to your instances. This drive can contain selected files that are then accessible to the instance. The configuration drive is attached to the instance at boot, and is presented to the instance as a partition. Configuration drives are useful when combined with cloud-init (for server bootstrapping), and when you want to pass large files to your instances.
6.1. Configuration Drive Options
Use your Compute environment file to set the following configuration drive parameters:
config_drive_format- sets the format of the drive, and accepts the options
vfat. By default, it uses
force_config_drive- this forces the configuration drive to be presented to all instances. Set to "True".
mkisofs_cmd- specifies the command to use for ISO file creation. This value must not be changed, as only genisoimage is supported.
6.2. Use a Configuration Drive
An instance attaches its configuration drive at boot time. This is enabled by the
--config-drive option. For example, this command creates a new instance named test-instance01 and attaches a drive containing a file named /root/user-data.txt:
# nova boot --flavor m1.tiny --config-drive true --file /root/user-data.txt=/root/user-data.txt --image cirros test-instance01
Once the instance has booted, you can log in to it and see a file named /root/user-data.txt.
You can use the configuration drive as a source for cloud-init information. During the initial instance boot, cloud-init can automatically mount the configuration drive and run the setup scripts.