[one-users] vm hooks

Carlos Martín Sánchez cmartin at opennebula.org
Mon May 5 02:24:20 PDT 2014


Hi,

On Fri, May 2, 2014 at 5:09 PM, Thomas Stein <himbeere at meine-oma.de> wrote:

> Hello.
>
> I need a litte bit help with the hook system. I think i'm having
> problems understanding the concept. Let's say i wanna have a script
> executed after a start of a certain VM. How would the hook look like?
> Something like this?
>
>  VM_HOOK = [
>    name      = "change_gateway",
>    on        = "START",
>    state     = "ACTIVE",
>    command   = "cg.sh",
>    arguments = "$ID" ]
>

No, on START is not a valid option, see [1] for a reference. It should look
like:

 VM_HOOK = [
   name      = "change_gateway",
   on        = "RUNNING",    # or CREATE
   command   = "cg.sh",
   arguments = "$ID" ]


> So this goes to /etc/one/oned.conf?


Yes. If you don't use an absolute path for the command, it needs to be
copied into /var/lib/one/remotes/hooks


> Do i need to assign this to the VM
> in some way?
>

Hooks are triggered for all VMs, you don't need to enable the hook in any
way.


> $ID = ID of the VM?
>

Yes, OpenNebula will call your command with the arguments provided. $ID
will be replaced with the VM ID.


> Sorry a lot of questions. Thanks and best regards
>
> t.
>

Regards

[1]
http://docs.opennebula.org/4.6/integration/infrastructure_integration/hooks.html

--
Carlos Martín, MSc
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org <http://www.opennebula.org/> | cmartin at opennebula.org |
@OpenNebula <http://twitter.com/opennebula>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20140505/5d9d0654/attachment-0002.htm>


More information about the Users mailing list