[Openstack-operators] ISO containing the user data. How to attach it at boot time?

Lorin Hochstein lorin at nimbisservices.com
Thu Nov 22 16:07:44 UTC 2012


Hi Salman:

Responses are inline.


On Nov 21, 2012, at 1:53 PM, Salman Toor <salman.toor at it.uu.se> wrote:

> Hi, 
> 
> Thanks for all your responses, I have started with --user_data with nova command but seems like something is missing 
> 
> Red color is for important stuff.
> 
> [sztoor at sal2 ~]$ nova boot --flavor 2 --image c402227d-dddf-45a6-9391-ef5d2733e4de --user_data user_data.sh --key_name mykey --security_group default basic-userData
> +-------------------------------------+--------------------------------------+
> |               Property              |                Value                 |
> +-------------------------------------+--------------------------------------+
> | OS-DCF:diskConfig                   | MANUAL                               |
> | OS-EXT-SRV-ATTR:host                | None                                 |
> | OS-EXT-SRV-ATTR:hypervisor_hostname | None                                 |
> | OS-EXT-SRV-ATTR:instance_name       | instance-0000003b                    |
> | OS-EXT-STS:power_state              | 0                                    |
> | OS-EXT-STS:task_state               | scheduling                           |
> | OS-EXT-STS:vm_state                 | building                             |
> | accessIPv4                          |                                      |
> | accessIPv6                          |                                      |
> | adminPass                           | PjxzNM46U7wk                         |
> | config_drive                        |                                      |
> | created                             | 2012-11-21T17:42:17Z                 |
> | flavor                              | m1.small                             |
> | hostId                              |                                      |
> | id                                  | f055cddc-85ad-4520-a458-2f08ee6a0ccb |
> | image                               | Basic-x86_64_qcow2              |
> | key_name                            | mykey                                |
> | metadata                            | {}                                   |
> | name                                | basic-userData                  |
> | progress                            | 0                                    |
> | status                              | BUILD                                |
> | tenant_id                           | fc310cff7c6d4684954151196f944dc8     |
> | updated                             | 2012-11-21T17:42:18Z                 |
> | user_id                             | 11c08cf04c844185b83ce9d8ff8588f5     |
> +-------------------------------------+--------------------------------------+
> 

The "metadata" property you see when you call "nova boot" is different from the data sent using the --user_data flag.

In particular, the "metadata" property shows key-value pairs that you send when using the --meta option of "nova boot", e.g.:

nova boot --meta key=value


> 
> user_data.sh is a file which contains 
> 
> --------------
> 
> EC2_USER_DATA=" base64 string "
> # Context variables 
> ONE_CONTEXT_PATH="PATH/TO/CONTEXT"
> 
> --------------
> 
> When the image boot seems it didn't use the user_data.sh
> 
> 
> I am also wandering if I am using the command-line option to send user data using --user_data, do I need this metadata service? I mean for user data .... I can understand that the service can be used for getting SSH key or other stuff but does it required for user data? 
> 

Yes, you need the metadata service for retrieving the user data. 

> But when I try to access it with wget it said internal error. 
> 
> [sztoor at sal2 ~]$ wget http://130.248.17.161:8775/latest/user-data
> --2012-11-21 19:44:33--  http://130.248.17.161:8775/latest/user-data
> Connecting to 130.248.17.161:8775... connected.
> HTTP request sent, awaiting response... 500 Internal Server Error
> 2012-11-21 19:44:33 ERROR 500: Internal Server Error.
> 


I am currently in the process of updating the metadata documentation which describe how to do this: https://review.openstack.org/16728

I think you're using the wrong IP address, the metadata service is accessible at 169.254.169.254. Doing a wget on any of these URLs from inside of your instance should get you the user data:

http://169.254.169.254/2009-04-04/user-data
http://169.254.169.254/latest/user-data
http://169.254.169.254/openstack/2012-08-10/user_data
http://169.254.169.254/openstack/latest/user_data



Take care,

Lorin
--
Lorin Hochstein
Lead Architect - Cloud Services
Nimbis Services, Inc.
www.nimbisservices.com




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20121122/7e7ac4ba/attachment.html>


More information about the OpenStack-operators mailing list