Ask Your Question

How can I extend nova metadata to alter the user data after VM's boot?

asked 2013-10-09 15:33:34 -0500

B.Callanan gravatar image

updated 2013-10-11 17:50:18 -0500

smaffulli gravatar image

If I run nova --debug meta <vm_instance> set cat=dog I can see that the API will add the metadata into the cache for that instance.</vm_instance>

If I run nova boot and I specify "--user-data" and add a script/mime-type/any_of_the_supported cloud init types...etc The data injected here is only at boot time. Personalities (5 files) can also be loaded as well...

This is all great... However, I'd like to inject different stuff into the VM through the lifetime of the VM "without" using a floating IP to get to the VM. Nor do I have the ability to ssh to the VM (certainly not as root).

I want to modify the metadata/user_data to inject other stuff during the lifetime of the VM. If I can inject new key-value pairs I should be able to change more stuff. (Note: we are using the full openstack API and are very comfortable with passing any type of JSON to and from the API.

On the VM, I'm using Curl to see the contents of the metadata on a per instance basis. On the compute-node that is also running the metadata process I try to query the metadata port (ie curl ) what can I use are the request to get access to the each different vm instance metadata spaces/caches. is it possible?

Can I post anything else to the metadata server in this way?

Aside from writing a new agent to sit along side the metadata server I have not other options with what is provided by openstack to get data to or from the vms.

edit retag flag offensive close merge delete


What would be equally great is have the VM instance be able to post into the metadata. For instance, it could post whether the VM was healthy or not. The options are limitless...

B.Callanan gravatar imageB.Callanan ( 2013-10-09 16:19:32 -0500 )edit

Remember that you can edit your question instead of adding a comment.

smaffulli gravatar imagesmaffulli ( 2013-10-11 17:48:35 -0500 )edit

I have same question about this argument. I have an instance ad i want to inject a custom user-data to it. It's possible ?

salvorapi gravatar imagesalvorapi ( 2014-03-27 03:52:27 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2014-11-20 12:10:49 -0500

B.Callanan gravatar image

You can adjust the meta data at any time and a curl back to the metadata will show that. The VM must have access back to the metadata server for that to work (ie I don't see a nova command for issuing a modification to the user data. Also note that Cloud-init only runs the user data on first boot. If you want to have the vm run user data you must alter the rc configuration to make that happen. Feel free to ask questions.

User data (custom data of any kind) can be issued at boot time. But not in an update as far as I can see.

[root@wma-cloud-06 ~]# nova help meta usage: nova meta <server> <action> <key=value> [<key=value> ...]

Set or Delete metadata on a server. Positional arguments: <server> Name or ID of server <action> Actions: 'set' or 'delete' <key=value> Metadata to set or delete (only key is necessary on delete)

edit flag offensive delete link more


Only way I've found to change user-data has been through the DB. I detailed how to do it in mysql for grizzly / havana @ (

joshuamiller01 gravatar imagejoshuamiller01 ( 2015-04-18 20:07:55 -0500 )edit

answered 2015-07-07 03:13:32 -0500

BhavaniPrasad gravatar image

I have my file(a.xml) to be injected as below: cat /root/a.xml :

hello $description

So during nova boot i am passing the meta value as description="centos_demo1". Here I want the given meta value to be reflected file after server boots.

After server boots,I would like to see the injected file as: cat /hello :

hello centos_demo1

nova boot --image 3bd9b5b7-8295-48e5-8c59-ecb752011b8b --nic net-id=60befe35-a0f0-41c4-994c-64ccb86c583e --flavor 09ce098a-a939-4dab-97d6-bd1a31c11074 --meta description="centos_demo1" --file /hello=/root/a.xml --config-drive True "server1"

Please help me out in this.Thanks in advance.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2013-10-09 15:33:34 -0500

Seen: 7,607 times

Last updated: Jul 07 '15