[Openstack] Injecting user data into instances

Vishvananda Ishaya vishvananda at gmail.com
Thu Jun 9 23:09:56 UTC 2011


As I mentioned before user_data is provided via the metadata server on 169.254.169.254.  It is the responsibility of the guest to hit 169.254.169.254/latest/user-data/ to retrieve the info set in user data.

Vish

On Jun 9, 2011, at 9:46 AM, Vladimir Popovski wrote:

> 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/02df7237/attachment.html>


More information about the Openstack mailing list