<div dir="ltr">Hi,<div><br></div><div class="gmail_extra"><div class="gmail_quote">On Fri, May 2, 2014 at 5:09 PM, Thomas Stein <span dir="ltr"><<a href="mailto:himbeere@meine-oma.de" target="_blank">himbeere@meine-oma.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello.<br>
<br>
I need a litte bit help with the hook system. I think i'm having<br>
problems understanding the concept. Let's say i wanna have a script<br>
executed after a start of a certain VM. How would the hook look like?<br>
Something like this?<br>
<br>
VM_HOOK = [<br>
name = "change_gateway",<br>
on = "START",<br>
state = "ACTIVE",<br>
command = "cg.sh",<br>
arguments = "$ID" ]<br></blockquote><div><br></div><div>No, on START is not a valid option, see [1] for a reference. It should look like:</div><div><br></div><div><font face="courier new, monospace"> VM_HOOK = [</font></div>
<div><font face="courier new, monospace"> name = "change_gateway",</font></div><div><font face="courier new, monospace"> on = "RUNNING", # or CREATE</font></div><div><font face="courier new, monospace"> command = "cg.sh",</font></div>
<div><font face="courier new, monospace"> arguments = "$ID" ]</font></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
So this goes to /etc/one/oned.conf?</blockquote><div><br></div><div>Yes. If you don't use an absolute path for the command, it needs to be copied into /var/lib/one/remotes/hooks</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Do i need to assign this to the VM<br>
in some way?<br></blockquote><div> </div><div>Hooks are triggered for all VMs, you don't need to enable the hook in any way.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
$ID = ID of the VM?<br></blockquote><div><br></div><div>Yes, OpenNebula will call your command with the arguments provided. $ID will be replaced with the VM ID.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Sorry a lot of questions. Thanks and best regards<br>
<br>
t.<br></blockquote><div class="gmail_quote"><br></div><div class="gmail_quote">Regards</div><div class="gmail_quote"><br></div><div class="gmail_quote">[1] <a href="http://docs.opennebula.org/4.6/integration/infrastructure_integration/hooks.html">http://docs.opennebula.org/4.6/integration/infrastructure_integration/hooks.html</a><br>
</div><br class="">--<br><div>Carlos Martín, MSc<br>Project Engineer</div><div>OpenNebula - Flexible Enterprise Cloud Made Simple<br></div><div><a href="http://www.opennebula.org/" target="_blank" style="font-family:arial,sans-serif;font-size:13px">www.OpenNebula.org</a><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"> </span><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px">|</span><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"> </span><a href="mailto:cmartin@opennebula.org" target="_blank" style="font-family:arial,sans-serif;font-size:13px">cmartin@opennebula.org</a><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"> </span><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px">|</span><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"> </span><a href="http://twitter.com/opennebula" target="_blank" style="font-family:arial,sans-serif;font-size:13px">@OpenNebula</a> </div>
</div></div></div>