6 thoughts on “How to inject file/meta/ssh key/root password/userdata/config drive to a VM during nova boot

  1. faizal says:

    hi Kimizhang,

    just to double confirm with you. to have the password injection working we need to have libguestfs to be installed on the nova compute rite? and how about the the variable below?


    do i need to have this 3 variable inside nova.conf of only one of it will do? for eg: libvirt_inject_password=true only. as i did try to set the password injection and i can see compute node try to inject the password which we set thru dashboard. however, still the password is not been injected to the instance.
    Please advise.

    • kimizhang says:

      Yes, you need libguestfs installed on compute node, to make libvirt password injection, you need to configure at least libvirt_inject_password=true and libvirt_inject_partition=-1.

      For password injection, however, either libvirt injection or cloud-init works on that, you should choose one of them. If you want to test libvirt injection, you better to test on one image without cloud-init installed.

  2. Sonia says:

    Hi Kimizhang,

    Very good article. My question are :
    1. If config-drive=true and if we inject a file using –file option , can this file be retrieved only by mounting the config-drive ? Or it can be directly accessed from its destination location (passed in nova boot command)

    2. Just like cloud-init can access and run –user-data files during VM boot process, can cloud-init also use and access the file injected via –file option during the VM boot process ?

    • kimizhang says:

      To Sonia
      1. No matter you use config-drive or not, the injected file can always be accessed directly from its destination location.

      2. I don’t think cloud-init has that function, but you could double-check in cloud-init doc: http://cloudinit.readthedocs.org/en/latest/
      Anyway, you can add your injected file handling by yourself during VM bootup.

      • Sonia says:

        Thanks a lot for the reply.
        When you say that I can handle injected file myself during VM boot up process , is file injected via –file is available at bootup time ? Isnt it available only once the VM is bootup completely ?

        When I use –config-drive=true ,do I still have to do step1 and step2 to inject files via –file option ?

      • kimizhang says:

        Injected file is available at bootup time already.

        config-drive is just an alternative of network based meta-data access, no relation with file injection by “–file” option. You always need to use “–file” to inject file.

        Anyway, there’s other way to inject something into VM, it’s userdata. It can be fetched either by config-drive or meta-data service.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: