One way to customize the personality of an instance is by injecting data into it upon boot

This would be handy for updating /etc/passwd or /etc/group with customized pre-built files.

Here is an example:

nova boot --image cirros-qcow2 --flavor m1.tiny  --file /etc/passwd=/your/local/path/passwd MyInstance

By default, the Icehouse release of OpenStack can support up 5 files:

nova boot --image cirros-qcow2 --flavor m1.tiny  --file /home/cirros/myfirstfile=myfirstfile --file /home/cirros/mysecondfile=mysecondfile --file /home/cirros/mythirdfile=mythirdfile --file /home/cirros/myfourthfile=myfourthfile --file /home/cirros/myfifthfile=myfifthfile MyInstance

If you would like to inject more than 5 files, update your /etc/nova/nova.conf with the following flag:

quota_injected_files=50

Restart nova-compute

sudo service nova-compute restart

50 appears to the max amount of files it will allow you to pass.

Additional info about file injection:

  • Max size per file is 255 bytes.
  • One can only inject text files. Binary or zip files won't work.
  • During file injection, any existing files that match specified files are renamed to include .bak extension appended with a time stamp.
  • Once written, the files have 0440 permissions.


Comments

comments powered by Disqus