cloudstack-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiroki Ohashi <silvernsh...@gmail.com>
Subject Re: Cloudstack user-data empty for VMs
Date Wed, 04 Dec 2013 19:56:45 GMT
Hi Derek

When you use user-data, you have to provide user-data and deliver it
to virtual router. Unfortunately, CloudStack only provides REST API to
deliver user-data to virtual router now. This API is
deployVirtualMachine that creates instance and set instance specific
data.

For example, I assume you want to deliver a shell script as user-data
below.

    ----------------------------------------------------------------------
    #! /bin/sh

    echo "Hello user-data!"
    ----------------------------------------------------------------------

In this case, you can call deployVirtualMachine by CloudMonkey like
this.

    $ cloudmonkey deploy virtualmachine serviceofferingid=XXX
templateid=XXX zoneid=XXX networkids=XXX
userdata='IyEgL2Jpbi9zaAoKZWNobyAiSGVsbG8gdXNlci1kYXRhISIK'

As a result of the command, a new instance is created with user-data
delivered to virtual router, so you can access user-data from the
instance.

CloudMonkey is CLI tool to call CloudStack REST API easily and you can
give parameters as key value pair. In the example, user-data is base64
encoded shell script and provied as a parameter.

Best regards
Hiroki Ohashi

2013/12/5 Derek Cole <derek.cole@gmail.com>:
> I was kind of wondering about that, when I saw it earlier. It appears that
> maybe the cloudstack_resources module has become out of date? I think you
> are the preparer of a slide-show I was following here:
> http://www.slideshare.net/PuppetLabs/cloudstack-18489665
>
> It seems like in those slides, Group was being used to hold the roles? This
> is why I assumed that was OK. I was doing something like
>
>         case $::role {
>                 'db': {
>                         notify {"detected a fact named role with value db"
> :}
>                 }
>         }
> because I thought that the custom fact here:
> https://github.com/jasonhancock/puppet-facts/blob/master/cloudstack_userdata.rb
>
> Turned the cloudstack userdata into a fact where if you had
> "role=db,foo=bar" you would get two custom facts, role and foo, with their
> respective values.
>
> May I ask for some clarity if that is not the intended usage?
>
> In my case, obviously cloudstack_userdata is not generating the correct
> facts, because the wget that is in that code returns nothing because
> userdata is empty.
>
> Thanks,
>
> -Derek
>
>
>
> On Wed, Dec 4, 2013 at 12:57 PM, David Nalley <david@gnsa.us> wrote:
>
>> Hi Derek:
>>
>> Glad that the puppet resources are useful.
>>
>> Setting user-data is different than setting group:
>>
>> Look at the options here:
>>
>> http://cloudstack.apache.org/docs/api/apidocs-4.2/user/deployVirtualMachine.html
>>
>> --David
>>
>> On Wed, Dec 4, 2013 at 11:54 AM, Derek Cole <derek.cole@gmail.com> wrote:
>> > Hello,
>> >
>> > I am attempting to use the cloudstack API to get user-data for my VMs.
>> >
>> > I am creating the VMs with the puppet cloudstack-resources module, and it
>> > seems to populate it (From the cloudstack GUI, under "Group" I see my
>> data)
>> >
>> > However, when I do a
>> >
>> > wget http://router/latest/user-data
>> >
>> > I get back an empty file. On the VR itself I have checked and there are a
>> > bunch of /var/www/html/userdata/IP/user-data files, but every one of them
>> > is empty. This same applies to VMs that I added the "Group" user data
>> > manually.
>> >
>> > The VM's are all FreeBSD10, and I am using xenserver 6.2, and cloudstack
>> 4.2
>> >
>> > Is this a bug? Is there a workaround or a fix?
>> >
>> > Thanks
>>



-- 
大橋 宏樹
mail: silvernshell@gmail.com

Mime
View raw message