[Openstack] Injecting user data into instances

Vladimir Popovski vladimir at zadarastorage.com
Thu Jun 9 16:46:27 UTC 2011


Hi All,



Thanks for answers. Injecting files into running instance is a very
interesting topic, but it is not our goal (at least for now).

I was just curious seeing these APIs and guessed that those are placeholders
(as Ed confirmed).



However, what we are missing is the way of injecting data provided in
user_data arg.



Could you please point us to the code where it is actually implemented?



Seems like similarly to injecting keys and networking info there should be a
code of placing user_data into nbd-mouted device.

But I don’t see it.



Another alternative might be to attach a new device (similarly to attaching
volumes) and in this case autostart script will be fired after mounting this
device … but we can’t find this code neither.



Thanks,

-Vladimir









*From:* Vishvananda Ishaya [mailto:vishvananda at gmail.com]
*Sent:* Wednesday, June 08, 2011 9:46 PM
*To:* Vladimir Popovski
*Cc:* openstack at lists.launchpad.net
*Subject:* Re: [Openstack] Injecting user data into instances



User data is provided to the vm through the ec2 metadata url.  It is not
touched by the hypervisor at all.  It does work for regular user data and
for cloudpipe.  The smoketests also verify that user data is working in the
SecurityGroupTests by passing in a script proxy script that runs on boot.



Vish



On Jun 8, 2011, at 5:36 PM, Vladimir Popovski wrote:



Folks,



Have anybody tried to inject user data into instances? Or if anybody
actually tried to use Cloudpipe / VPN functionality?



It seems like there is some code missing (at least on libvirt/connection
level).



If I’m not missing anything, EC2 RunInstances takes user_data from kwargs
arguments and provides it to compute_api, who stores it in base_options /
instances table.

Cloudpipe’s launch_vpn_instance also goes through the same path. However,
there is no any parser of user_data field on compute manager / driver level.



For example, if we will look at spawn implementation in libvirt:



it calls _create_image(instance, …

, who calls

disk.inject_data(basepath('disk'), key, net, partition=target_partition,
nbd=FLAGS.use_cow_images)

                where image is mounted as nbd device and key/net information
is inserted by



                    inject_data_into_fs(tmpdir, key, net, utils.execute)

_inject_key_into_fs

_inject_net_into_fs



It seems reasonable to pass user data to disk.inject_data and
inject_data_into_fs and inject it into FS as well, but there is no such code
…



Or am I missing anything?





Another interesting situation is with inject_file compute APIs  …



on API level there is no even file/contents fields, only

def inject_file(self, context, instance_id):

but they exist on compute.manager level:

def inject_file(self, context, instance_id, path, file_contents):





Thanks,

-Vladimir

_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to     : openstack at lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20110609/765178d1/attachment.html>


More information about the Openstack mailing list