Hello Gary, Thanks for the reply, but as far as I know not all templates are XML yet, the old text format that I used in my examples is also still supported. Would your approach work for those too?
Also, I need some extra hints with respect to the DS or TM scripts you mention. I've tried to locate them in the OpenNebula sources, but I have frankly no idea what you are referring to. (And lastly, I am still hoping that OpenNebula has a simpler way to access such variables, rather than using xpath on the template file.) Again, thanks for your help! -- Kees On 16 Aug 2012, at 12:20, Gary S. Cuozzo <[email protected]> wrote: > Hi, > I believe the $TEMPLATE is actually a base64 encoded version of the entire > XML document with all the variable in it. That is how the DS/TM stuff works. > If you look in any of the DS or TM scripts, you can copy/paste the xpath > related lines to access any variables you want. > > If you want to see the exact structure, you can get the base64 encoded stream > from the oned.log and run it through the base64 command to see the xml which > is encoded. > > Something like: echo "encoded stream here" | base64 > > Hope that helps. I have not used hooks, but I have used this to develop > custom DS/TM drivers. > gary > > > ----- Original Message ----- > From: "reeuwijk" <[email protected]> > To: "opennebula users" <[email protected]> > Sent: Thursday, August 16, 2012 10:12:54 AM > Subject: [one-users] Fwd: Template parameters arguments to hook script? > > Hi, > > I want to pass some parameters from OpenNebula templates to a hook script. > > In OpenNebula 2.2 I could use something like > > CONTEXT = [ > : > SERVER = "bla" > : > ] > > and then in oned.conf I could use a hook script with something like: > > VM_HOOK = [ > arguments = " … $CONTEXT[SERVER] …" > ] > > and the hook script would be invoked with the value I defined in CONTEXT. > > Unfortunately, it seems that OpenNebula 3.6 does not support this any longer. > Instead of the value defined in CONTEXT, the expression '$CONTEXT' is > replaced with the empty string, so the hook script of the example always gets > the string [SERVER]. > > From the documentation it is not entirely clear to me whether the mechanism I > used for 2.2 is supported at all. The webpage at > http://opennebula.org/documentation:rel3.6:oned_conf only mentions access to > $VMID and $TEMPLATE and nothing else, so I may have been using an > undocumented feature of OpenNebula 2.2. > > However, limiting access to only those two variables seems overly restrictive > to me, so for now I am assuming more is possible. But exactly what is > allowed, and what is not? > > -- > Kees van Reeuwijk > > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.opennebula.org/listinfo.cgi/users-opennebula.org > _______________________________________________ > Users mailing list > [email protected] > http://lists.opennebula.org/listinfo.cgi/users-opennebula.org _______________________________________________ Users mailing list [email protected] http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
