<font color="#6633ff"><font><font face="tahoma,sans-serif"><span style="font-family:courier new,monospace">Thank you Pádraig Brady, I learn a lot, but still can not get some of them</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">since centos has no nbd supported, I use libguestfs-mount to inject ssh-key, and I make it work</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">you said if I can inject ssh-key, I can inject file, etc. but I don't know how</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">I added --meta key=value to boot command, I notice that when instance boot, it said </span><span style="color:rgb(255,0,0)"><span style="font-family:courier new,monospace">No suck file or directory, </span><font color="#000000"><span style="font-family:courier new,monospace">do I have to build meta.js myself?</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">I still don't get metadata, is key=value I specified will store in there, can I see that's in metadata server?</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">so now, I make injection function work, and seems don't know how to use them, please give me some examples, </span><br></font><br>
</span></font></font></font><br><div class="gmail_quote">On Fri, Jun 1, 2012 at 8:16 PM, Pádraig Brady <span dir="ltr"><<a href="mailto:P@draigbrady.com" target="_blank">P@draigbrady.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 06/01/2012 10:55 AM, William Herry wrote:<br>
> I have been spend all days to search metadata and file injection related info with Google,<br>
> there are few doc or blog about this topic (or I am not use the proper keyword)<br>
> I know about this is only pieces<br>
><br>
> what I know now is:<br>
> cloud-init can inject files to instance and a lot other things, seems only on ubuntu,<br>
<br>
</div>cloud-init is available for Fedora now.<br>
There is also a test package available for RHEL and derivatives:<br>
<a href="http://pbrady.fedorapeople.org/cloud-init-el6/" target="_blank">http://pbrady.fedorapeople.org/cloud-init-el6/</a><br>
<div class="im"><br>
> I can inject ssh key with qemu-nbd<br>
<br>
</div>If you can do that, you can also inject 'metadata',<br>
'files' and root 'passwords'. Note only failure to<br>
inject 'files' will result in a failure to boot the guest.<br>
<div class="im"><br>
> my question is:<br>
> what is in metadata, how can I use matadata<br>
> there is no injection related sub command in nova<br>
><br>
> any related URL will be very appreciate<br>
<br>
</div>The `nova` command interface is defined in:<br>
<a href="https://github.com/openstack/python-novaclient/blob/master/novaclient/v1_1/shell.py" target="_blank">https://github.com/openstack/python-novaclient/blob/master/novaclient/v1_1/shell.py</a><br>
It would be good to have a man page for the `nova`<br>
command that you could reference.<br>
<br>
Anyway here is what you get when executing the<br>
help for the 'boot' command:<br>
<br>
<br>
# nova help boot<br>
usage: nova boot [--flavor <flavor>] [--image <image>] [--meta <key=value>]<br>
                 [--file <dst-path=src-path>] [--key_name <key_name>]<br>
                 [--user_data <user-data>]<br>
                 [--availability_zone <availability-zone>]<br>
                 [--security_groups <security_groups>]<br>
                 [--block_device_mapping <dev_name=mapping>]<br>
                 [--hint <key=value>]<br>
                 [--nic <net-id=net-uuid,v4-fixed-ip=ip-addr>]<br>
                 [--config-drive <value>] [--poll]<br>
                 <name><br>
<br>
Boot a new server.<br>
<br>
Positional arguments:<br>
  <name>                Name for the new server<br>
<br>
Optional arguments:<br>
  --flavor <flavor>     Flavor ID (see 'nova flavor-list').<br>
  --image <image>       Image ID (see 'nova image-list').<br>
  --meta <key=value>    Record arbitrary key/value metadata. May be give<br>
                        multiple times.<br>
  --file <dst-path=src-path><br>
                        Store arbitrary files from <src-path> locally to <dst-<br>
                        path> on the new server. You may store up to 5 files.<br>
  --key_name <key_name><br>
                        Key name of keypair that should be created earlier<br>
                        with the command keypair-add<br>
  --user_data <user-data><br>
                        user data file to pass to be exposed by the metadata<br>
                        server.<br>
  --availability_zone <availability-zone><br>
                        The availability zone for instance placement.<br>
  --security_groups <security_groups><br>
                        comma separated list of security group names.<br>
  --block_device_mapping <dev_name=mapping><br>
                        Block device mapping in the format <dev_name=<id>:<typ<br>
                        e>:<size(GB)>:<delete_on_terminate>.<br>
  --hint <key=value>    Send arbitrary key/value pairs to the scheduler for<br>
                        custom use.<br>
  --nic <net-id=net-uuid,v4-fixed-ip=ip-addr><br>
                        Create a NIC on the server. Specify option multiple<br>
                        times to create multiple NICs. net-id: attach NIC to<br>
                        network with this UUID (optional) v4-fixed-ip: IPv4<br>
                        fixed address for NIC (optional).<br>
  --config-drive <value><br>
                        Enable config drive<br>
  --poll                Blocks while instance builds so progress can be<br>
                        reported.<br>
<br>
<br>
Here are the related APIs that are used by the command above:<br>
<a href="http://docs.openstack.org/api/openstack-compute/2/content/CreateServers.html" target="_blank">http://docs.openstack.org/api/openstack-compute/2/content/CreateServers.html</a><br>
<br>
So what happens when you present --meta options above?<br>
That will bubble through the API to:<br>
<a href="https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py" target="_blank">https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py</a><br>
If you look at _inject_metadata_into_fs() there, you can see<br>
that a 'meta.js' file is written to the / directory.<br>
Logic within the guest can then inspect that as required.<br>
<br>
cheers,<br>
Pádraig.<br>
</blockquote></div><br><br clear="all"><br>-- <br><font><br><br><br><span style="font-family:tahoma,sans-serif;color:rgb(102,51,255)">William Herry</span></font><font style="font-family:tahoma,sans-serif;color:rgb(102,51,255)" size="2"><br>
====================</font><span style="font-family:tahoma,sans-serif;color:rgb(102,51,255)"></span><br style="font-family:tahoma,sans-serif;color:rgb(102,51,255)"><font style="font-family:tahoma,sans-serif;color:rgb(102,51,255)" size="2">WilliamHerryChina@Gmail.com</font><font><span style="font-family:tahoma,sans-serif;color:rgb(102,51,255)"></span><br>
</font><br>