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

Salman Toor salman.toor at it.uu.se
Wed Nov 21 18:53:57 UTC 2012


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     |
+-------------------------------------+--------------------------------------+


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 wondering how should I check that my file has passed to the image and runs it (I mean some logs or ... ). I want to confirm this before starting to find if there is any problem in the base64 data I am passing. 

I was reading the following section from the documentation. 

http://docs.openstack.org/folsom/openstack-compute/admin/content/metadata-service.html

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? 

I have check my computing node logs, seems like metadata service is working  

---------------   
2012-11-21 17:21:09 DEBUG nova.service [-] metadata_host : 130.248.17.161 from (pid=2548) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:21:09 DEBUG nova.service [-] metadata_listen_port : 8775 from (pid=2548) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:21:09 DEBUG nova.service [-] quota_metadata_items : 128 from (pid=2548) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:21:09 DEBUG nova.service [-] metadata_listen : 0.0.0.0 from (pid=2548) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:21:09 DEBUG nova.service [-] enabled_apis : ['metadata'] from (pid=2548) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:21:09 DEBUG nova.service [-] metadata_port : 8775 from (pid=2548) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:21:09 DEBUG nova.service [-] metadata_manager : nova.api.manager.MetadataManager from (pid=2548) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:33:45 DEBUG nova.service [-] metadata_host : 130.248.17.162 from (pid=4129) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:33:45 DEBUG nova.service [-] metadata_listen_port : 8775 from (pid=4129) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:33:45 DEBUG nova.service [-] quota_metadata_items : 128 from (pid=4129) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:33:45 DEBUG nova.service [-] metadata_listen : 130.248.17.161 from (pid=4129) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:33:45 DEBUG nova.service [-] enabled_apis : ['metadata'] from (pid=4129) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:33:45 DEBUG nova.service [-] metadata_port : 8775 from (pid=4129) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 17:33:45 DEBUG nova.service [-] metadata_manager : nova.api.manager.MetadataManager from (pid=4129) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:09:37 DEBUG nova.service [-] metadata_host : 130.248.17.162 from (pid=6242) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:09:37 DEBUG nova.service [-] metadata_listen_port : 8775 from (pid=6242) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:09:37 DEBUG nova.service [-] quota_metadata_items : 128 from (pid=6242) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:09:37 DEBUG nova.service [-] metadata_listen : 130.248.17.161 from (pid=6242) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:09:37 DEBUG nova.service [-] enabled_apis : ['metadata'] from (pid=6242) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:09:37 DEBUG nova.service [-] metadata_port : 8775 from (pid=6242) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:09:37 DEBUG nova.service [-] metadata_manager : nova.api.manager.MetadataManager from (pid=6242) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:11:39 DEBUG nova.service [-] metadata_host : 130.248.17.162 from (pid=6814) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:11:39 DEBUG nova.service [-] metadata_listen_port : 8775 from (pid=6814) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:11:39 DEBUG nova.service [-] quota_metadata_items : 128 from (pid=6814) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:11:40 DEBUG nova.service [-] metadata_listen : 130.248.17.161 from (pid=6814) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:11:40 DEBUG nova.service [-] enabled_apis : ['ec2', 'osapi_compute', 'osapi_volume', 'metadata'] from (pid=6814) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:11:40 DEBUG nova.service [-] metadata_port : 8775 from (pid=6814) wait /usr/lib/python2.7/site-packages/nova/service.py:411
2012-11-21 18:11:40 DEBUG nova.service [-] metadata_manager : nova.api.manager.MetadataManager from (pid=6814) wait /usr/lib/python2.7/site-packages/nova/service.py:411
---------------

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.

Credentials are set correctly can be seen by the following command. 

[sztoor at sal2 ~]$ nova list
+--------------------------------------+---------------------+--------+------------------+
|                  ID                  |         Name        | Status |     Networks     |
+--------------------------------------+---------------------+--------+------------------+
| f055cddc-85ad-4520-a458-2f08ee6a0ccb | basic-userData | ACTIVE | private=10.0.0.5 |
+--------------------------------------+---------------------+--------+------------------+


Can some explain it for me. 

Thanks in advance. 

Regards..
Salman. 


Salman Toor, PhD
salman.toor at it.uu.se



On Nov 21, 2012, at 5:23 AM, Lorin Hochstein wrote:

> An alternative to file injection is to use the config drive, so that the files passed to "nova boot --file …"  get placed into a separate disk  which can be mounted by your instance instead of injected directly into the instance's primary disk.
> 
> Documentation for how to do this is under review: https://review.openstack.org/#/c/16504/
> 
> Take care,
> 
> Lorin
> --
> Lorin Hochstein
> Lead Architect - Cloud Services
> Nimbis Services, Inc.
> www.nimbisservices.com
> 
> 
> 
> 
> 
> On Nov 20, 2012, at 3:25 AM, Anton Haldin <ahaldin at griddynamics.com> wrote:
> 
>> If you have some agent installed in your image you can  execute script at the boot time .
>> CloudInit is good example. And it will execute user-data script ( you can define this script in "nova boot  .....  --user-data <user-data>"
>> As agent installed in image  you can also use something simple like this script  http://code.google.com/p/gentoo-aws/source/browse/trunk/packages/gentoo-ec2/bin/ec2-get-metadata.sh?spec=svn2&r=2
>> 
>> Another way is to use file injection "nova boot ...... --file <dst-path=src-path> " you can inject it somewhere , for example in /etc/init.d/ 
>> 
>> 
>> Anton
>> 
>> On Tue, Nov 20, 2012 at 12:11 PM, James R Penick <penick at yahoo-inc.com> wrote:
>> Hey Salman,
>>  Check out the cloud-init stuff here: https://help.ubuntu.com/community/CloudInit that'll allow you to run arbitrary commands during boot time. Though it's not what you're looking for, it's probably exactly what you need. :)
>> 
>> -James
>> 
>> 
>> From: Salman Toor <salman.toor at it.uu.se>
>> Date: Monday, November 19, 2012 11:47 PM
>> To: Anton Haldin <ahaldin at griddynamics.com>
>> Cc: "openstack-operators at lists.openstack.org" <OpenStack-operators at lists.openstack.org>
>> Subject: Re: [Openstack-operators] ISO containing the user data. How to	attach it at boot time?
>> 
>> Hi, 
>> 
>> Thanks for your answer Anton. 
>> 
>> Actually the images we have required to  fetch/enable some components while booting the instance. In order to do that, we are using some scripts. ISO contains those scripts. We have mount the iso to the image at boot time by defining it into the image config file. 
>> 
>> The bottom line is that we need to run some scripts. Can you please give me an example how do I run the scripts at the boot time in Openstack?  And also where should I place those scripts? 
>> 
>> Regards..
>> Salman. 
>> 
>> Salman Toor
>> salman.toor at it.uu.se
>> 
>> 
>> 
>> On Nov 19, 2012, at 7:51 PM, Anton Haldin wrote:
>> 
>>> Hi Salman 
>>> 
>>> I'm not sure if I understand your question.
>>> If you want to launch instances by using your image , you need to load it in glance (storage service for images) 
>>> 
>>> If you want to push some data to the new instance ,  you can use "user data" parameter with "nova boot" command .Value of this parameter would be pushed into instance by file injection.  You can also use meta data with "nova boot" command. Values of meta data ( tags) would be available in instance through metadata service.
>>> 
>>> 
>>> Anton.
>>> 
>>> On Mon, Nov 19, 2012 at 5:06 PM, Salman Toor <salman.toor at it.uu.se> wrote:
>>> Hi, 
>>> 
>>> I have created a user-data.iso (only contains startup script) and I am using KVM in my setup. Right now I have tested my user-data.iso with virsh tool and now I want to use that iso file everytime I boot my instance in openstack. I read that there is a service call metadata service. Can somebody guide me how do I upload/use my iso file at boot time with the instances in openstack?
>>> 
>>> Thanks in advance. 
>>> 
>>> Regards 
>>> Salman.
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> OpenStack-operators mailing list
>>> OpenStack-operators at lists.openstack.org
>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
>>> 
>>> 
>> 
>> 
>> _______________________________________________
>> OpenStack-operators mailing list
>> OpenStack-operators at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
> 

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


More information about the OpenStack-operators mailing list