[one-users] Using USER template variable in VM Template

Hyun Woo Kim hyunwoo at fnal.gov
Sun Aug 26 14:07:54 PDT 2012


Hi,

Thanks very much for the response.

Actually, your answer seems a bit different from what the manual says
and what I observe.

I observe that the "USERS" actually have "TEMPLATE" attribute
which returns the contents of "user_pool" in the database
(We are using MySQL).
The contents of MySQL "user_pool" contain NAME field.
I thought these fields in DB and <user_attribute>s of USER template
somehow are related..

Let me simplify my original question.
Is there anyway to fetch the NAME field of the DB for the 
user who does "onetemplate instantiate"..?

Thanks,
Hyunwoo



Current version of OpenNebula can only access template variables from
users, or networks. By default users have an empty template, so there
is no NAME variable unless you define it, e.g. oneuser update. About
$UID, this variable is predefined so the OpenNebula core it is not
actually accessing the user information but that stored in the VM.

Cheers

Ruben

On Fri, Aug 24, 2012 at 10:37 PM, Hyun Woo Kim <hyunwoo at fnal.gov> wrote:
> Dear Developers,
>
> I want to define a variable "username" in CONTEXT
> and replace it by a real user name who does
> onetemplate instantiate
>
> The CONTEXT section of my VM Template looks like the following;
> CONTEXT = [
> username    = "$USER[NAME]"
> ]
>
> I am following the instruction in
> http://opennebula.org/documentation:archives:rel3.2:template
> which says at the bottom ;
> ...
> Using User template variables
> $USER[ <user_attribute> ]: Any single value variable in the user template
> for example: ssh_key = "$USER[SSH_KEY]"
> The user_attribute can be TEMPLATE to include…
> …..
>
>
> So, I thought NAME can be one possible <user_attribute> like TEMPLATE,
> but this does not work..
> I even tried
> username    = "$USER[NAME, USER_ID=$UID]"
> username    = "$USER[NAME, ID=$UID]"
> username    = "$USER[NAME, USER_ID=2]"
> username    = "$USER[NAME, ID=2]"
> All fail..
>
> By the way,
> username    = "$UID" works and username is assigned my correct user id
>
> What am I doing wrong here?
>
>
> Thank you.
> Hyunwoo
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>



--
Ruben S. Montero, PhD
Project co-Lead and Chief Architect
OpenNebula - The Open Source Solution for Data Center Virtualization
www.OpenNebula.org | rsmontero at opennebula.org | @OpenNebula



More information about the Users mailing list