Feature #15
General hook mechanism
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | Ruben S. Montero | % Done: | 0% | |
Category: | Core & System | |||
Target version: | Release 1.4 | |||
Resolution: | Pull request: |
Description
Execution of predefined commands or actions when a given event occurs. This functionality will be used to implement several advance one features (e.g. two_phase_commits, remote host control operations...).
DESCRIPTION-----------
A "hook" is defined by:
- EVENT: The event that will trigger the execution of the hook. Predefined events are, VM states (BOOT,RUNNING...)
- ACTION: The command that will be executed. The action can be:
- Pre-defined: For example, restart, destroy...
- Custom: a command
- Local: the action is executed in the ONE frontend
- Remote: the action is executed in the remote host
Several hooks may be defined for the same action. The hooks should be defined at the daemon level, but also VM's can defined custom hooks.
Associated revisions
Added HookExecutionManager for ticket #15
git-svn-id: http://svn.opennebula.org/one/trunk@441 3034c82b-c49b-4eb3-8279-a7acafdc01c0
Bug in HookManagerDriver (#15)
git-svn-id: http://svn.opennebula.org/one/trunk@442 3034c82b-c49b-4eb3-8279-a7acafdc01c0
#15 : VirtualMachine Hooks, allocate (stub now). Needs to be integrated
with the Execution Manager to actually execute the hook.
git-svn-id: http://svn.opennebula.org/one/trunk@447 3034c82b-c49b-4eb3-8279-a7acafdc01c0
#15 : Added driver wrapper. Driver files in install program. Added the
HookManager and HookManagerDriver. Included the Hook driver in conf file
git-svn-id: http://svn.opennebula.org/one/trunk@453 3034c82b-c49b-4eb3-8279-a7acafdc01c0
#15 : Removed action support from HookManager. Delete HM on Nebula destruction
git-svn-id: http://svn.opennebula.org/one/trunk@455 3034c82b-c49b-4eb3-8279-a7acafdc01c0
#15 define hooks in the oned.conf file
git-svn-id: http://svn.opennebula.org/one/trunk@456 3034c82b-c49b-4eb3-8279-a7acafdc01c0
#15 : Brought back threads for HM
git-svn-id: http://svn.opennebula.org/one/trunk@457 3034c82b-c49b-4eb3-8279-a7acafdc01c0
History
#1 Updated by Ruben S. Montero over 12 years ago
Just scheduling this feature for a future release, as it does not fit in the time-frame of 1.2
#2 Updated by Ruben S. Montero over 12 years ago
Adding comments on this topic from Soren
It would be really nice if OpenNebula could call a hook script of some sort every > time it hands out a network lease with at least the following arguments:
- MAC address
- IP address
- Name
That way, I can automatically add the relevant information to my dhcp server (mac >address->(ip,hostname) mapping). This saves us from having to put the MAC->ip >address mapping script in every image and also lets us automatically send the
designated hostname via dhcp.
#3 Updated by Javi Fontan over 12 years ago
A new HookExecutionDriver will be created to take care of the script execution. It will answer to this command:
EXECUTE <id> <hook_name> <LOCAL|host> <script> <args|->
Anwser will be something like this:
EXECUTE <SUCCESS|FAILURE> <id> <hook_name> <info>
If hook_name is not specified script name will be used (this is for core, not for the driver).
#4 Updated by Ruben S. Montero over 12 years ago
Hooks for the VMs can now be defined in oned.conf, as:
#------------------------------------------------------------------------------- # Virtual Machine Hooks (VM_HOOK) defined by: # name : for the hook, useful to track the hook (OPTIONAL) # on : when the hook should be executed # - CREATE, when the VM is created (onevm create) # command : use absolute path here # arguments : for the hook. You can access to VM template variables with $ # - $ATTR, the value of an attribute e.g. $NAME or $VM_ID # - $ATTR[VAR], the value of a vector e.g. $NIC[MAC] # - $ATTR[VAR, COND], same of previous but COND select between # multiple ATTRs e.g. $NIC[MAC, NETWORK="Public"] #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- #VM_HOOK = [ # name = "dhcp", # on = "create", # command = "/bin/echo", # arguments = "$NAME $NIC[MAC] > /tmp/test.$VM_ID" ] #-------------------------------------------------------------------------------
#5 Updated by Ruben S. Montero about 12 years ago
- Status changed from New to Closed
- Priority changed from High to Normal
The hook system has been tested with some network related scripts and works as it should, closing this...