diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 36412e61e0..a74a4f3a80 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -179,34 +179,50 @@ TM_MAD = [ # absolute path or relative to $ONE_LOCATION/lib/mads (or # /usr/lib/one/mads/ if OpenNebula was installed in /) # -# arguments : for the driver executable, can be an absolute path or relative -# to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was installed +# arguments : for the driver executable, can be an absolute path or relative +# to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was installed # in /) # # Virtual Machine Hooks (VM_HOOK) defined by: -# name : for the hook, useful to track the hook (OPTIONAL) -# on : when the hook should be executed +# 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) +# - RUNNING, after the VM is successfully booted +# - SHUTDOWN, after the VM is shutdown +# - STOP, after the VM is stopped (including VM image transfers) # 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 +# - $ATTR[VAR, COND], same of previous but COND select between # multiple ATTRs e.g. $NIC[MAC, NETWORK="Public"] +# remote : values, +# - YES, The hook is executed in the host where the VM was +# allocated +# - NO, The hook is executed in the OpenNebula server (default) #------------------------------------------------------------------------------- HM_MAD = [ executable = "one_hm" ] -#------------------------------------------------------------------------------- +#-------------------------------- Hook Examples -------------------------------- #VM_HOOK = [ # name = "dhcp", # on = "create", # command = "/bin/echo", -# arguments = "$NAME $NIC[MAC] > /tmp/test.$VM_ID" ] +# arguments = "$NAME > /tmp/test.$VM_ID" ] #------------------------------------------------------------------------------- - - - - - +#VM_HOOK = [ +# name = "ebtables", +# on = "running", +# command = "/usr/local/one/bin/set_net", +# arguments = '$NIC[MAC, Network = "Private"]', +# remote = "yes" ] +#------------------------------------------------------------------------------- +#VM_HOOK = [ +# name = "mail", +# on = "running", +# command = "/usr/local/one/bin/send_mail", +# arguments = "$VM_ID $NAME", +# remote = "no" ] +#------------------------------------------------------------------------------ diff --git a/src/vm/VirtualMachinePool.cc b/src/vm/VirtualMachinePool.cc index fd16a5eaf1..8f711af2a0 100644 --- a/src/vm/VirtualMachinePool.cc +++ b/src/vm/VirtualMachinePool.cc @@ -101,7 +101,7 @@ VirtualMachinePool::VirtualMachinePool(SqliteDB * db, VirtualMachineStateHook * hook; hook = new VirtualMachineStateHook(name, cmd, arg, remote, - VirtualMachine::LCM_INIT, VirtualMachine::DONE); + VirtualMachine::EPILOG, VirtualMachine::ACTIVE); add_hook(hook); state_hook = true;