← Back to team overview

openstack team mailing list archive

Injecting user data into instances

 

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

Follow ups