[one-users] updating TEMPLATE from hooks with onevm update

Olivier Sallou olivier.sallou at irisa.fr
Tue Nov 26 02:55:04 PST 2013


On 11/26/2013 11:51 AM, Olivier Sallou wrote:
>
> On 11/26/2013 11:14 AM, Carlos Martín Sánchez wrote:
>> Hi,
>>
>> When the VM is created, the template contents are parsed and stored
>> in VM/TEMPLATE. All the extra unknown attributes are stored in
>> VM/USER_TEMPLATE. You can see this with the onevm show -x command.
>> The onevm update action only allows to edit the USER_TEMPLATE
>> attributes, and as you described, the create hook is triggered after
>> the VM has been correctly created.
>>
>> I don't see any easy way to make your work flow fit into OpenNebula.
>> Could you elaborate a bit more on your use case?
> What I expect is to get my USER_TEMPLATE in the context.sh mounted in
> my VM.
>
> A basic use case is to generate a unique password for a web
> application running in the VM. I'd like to generate the passsword with
> a hook and send the password to the user by mail (until here, this is
> fine). The generated password is also in the VM context/template so
> that it appears in the context.sh of the VM. At startup, a specific
> init script read the VM contextualization and init the web application
> with the password provided.
The above example could be managed directly in the VM, without specific
contextualization, but there are cases where some variables could be
user dependent, so those variables would need to be set dynamically on
opennebula server side.
>
>
> Olivier
>>
>> I'm assuming you want those two variables to end in the context
>> section of the VM. In that case the preferred way to do so would be
>> to have a VM Template for each Image, and in there set the needed
>> variables.
>>
>> Regards
>> --
>> Carlos Martín, MSc
>> Project Engineer
>> OpenNebula - Flexible Enterprise Cloud Made Simple
>> www.OpenNebula.org <http://www.OpenNebula.org> |
>> cmartin at opennebula.org <mailto:cmartin at opennebula.org> | @OpenNebula
>> <http://twitter.com/opennebula>
>>
>>
>> On Tue, Nov 26, 2013 at 8:41 AM, Olivier Sallou
>> <olivier.sallou at irisa.fr <mailto:olivier.sallou at irisa.fr>> wrote:
>>
>>     Hi,
>>
>>     If my VM HOOK (on CREATE) adds new elements with a onevm update,
>>     I can see those variables in the the "user template"  of the vm/
>>
>>     onevm show:
>>
>>     ....
>>     USER
>>     TEMPLATE                                                                  
>>
>>     SSH_PUBLIC_KEY="ssh-rsa......"
>>     XGRID_PWD="xxx"
>>     ....
>>
>>     In my image template, I have set:
>>
>>     SSH_PUBLIC_KEY 	$USER[SSH_PUBLIC_KEY]
>>     XGRID_PWD 	$USER[XGRID_PWD]
>>
>>
>>     But in the VM template, I do not see any of those variable.
>>
>>     It would seem that user template attributes are created *after*
>>     the vm template generation.
>>
>>     Any idea  ?
>>
>>     Thanks
>>
>>     Olivier
>>
>>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.opennebula.org <mailto:Users at lists.opennebula.org>
>>     http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>
>>
>
> -- 
> Olivier Sallou
> IRISA / University of Rennes 1
> Campus de Beaulieu, 35000 RENNES - FRANCE
> Tel: 02.99.84.71.95
>
> gpg key id: 4096R/326D8438  (keyring.debian.org)
> Key fingerprint = 5FB4 6F83 D3B9 5204 6335  D26D 78DC 68DB 326D 8438
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org

-- 
Olivier Sallou
IRISA / University of Rennes 1
Campus de Beaulieu, 35000 RENNES - FRANCE
Tel: 02.99.84.71.95

gpg key id: 4096R/326D8438  (keyring.debian.org)
Key fingerprint = 5FB4 6F83 D3B9 5204 6335  D26D 78DC 68DB 326D 8438

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20131126/3bbee01a/attachment-0002.htm>


More information about the Users mailing list