We are trying to create a hook that will add or delete IP addresses assigned by Open Nebula to a local authoritative DNS server but I cannot get the Hook Manager to actually show any life.
The Hook manager itself is running:
$ ps -ef|grep -i hm oneadmin 3232 31092 0 16:41 pts/3 00:00:00 grep --color=auto -i hm oneadmin 25604 25574 0 15:37 ? 00:00:00 ruby /usr/lib/one/mads/one_hm.rb -p 2101 -l 2102 -b 127.0.0.1 $
There are two hooks defined:
$ onehook list ID NAME TYPE 11 hook-vm state 12 add_ip_to_dns api $
The “hook-vm” is taken from the example provided in the documentation, the second one is a simple one that uses “/usr/bin/echo” as the command.
I create a VM:
$ onevm create --cpu 1 --memory 2 --name test ID: 77 $
I wait for the VM to get to a RUNNING state, then I check the hooks, which are supposed to have executed:
$ onehook show 11 HOOK 11 INFORMATION ID : 11 NAME : hook-vm TYPE : state LOCK : None HOOK TEMPLATE ARGUMENTS="$TEMPLATE pending" COMMAND="vm-pending.rb" LCM_STATE="LCM_INIT" REMOTE="NO" RESOURCE="VM" STATE="PENDING" -bash-4.2$ onehook show 12 HOOK 12 INFORMATION ID : 12 NAME : add_ip_to_dns TYPE : api LOCK : None HOOK TEMPLATE ARGUMENTS="$API" ARGUMENTS_STDIN="yes" CALL="one.vm.action" COMMAND="/usr/bin/echo" REMOTE="NO" $
As you can see there are no log entries. I looked for any logs, but there are none:
$ onehook log $ echo $? 0 $
According to the documentation the HEM should log to /var/log/one/onehem.log but that doesn’t exist. Note that the log directory is owned by the oneadmin user:
$ ls -l /var/log/one/onehem.log ls: cannot access /var/log/one/onehem.log: No such file or directory $ ls -ald /var/log/one drwxr-x---. 2 oneadmin oneadmin 12288 Oct 12 16:51 /var/log/one $
There are lots of other log files in there as well so I’m guessing it’s not a permissions error.
I can see events appearing in the oned.log file:
Tue Oct 12 16:51:23 2021 [Z0][ReM][D]: Req:6080 UID:0 IP:127.0.0.1 one.vm.allocate invoked , "NAME="test" Tue Oct 12 16:51:23 2021 [Z0][ReM][D]: Req:6080 UID:0 one.vm.allocate result SUCCESS, 77 Tue Oct 12 16:51:25 2021 [Z0][ReM][D]: Req:9264 UID:0 IP:127.0.0.1 one.vm.deploy invoked , 77, 6, false, 0, "" Tue Oct 12 16:51:25 2021 [Z0][ReM][D]: Req:9264 UID:0 one.vm.deploy result SUCCESS, 77
So, I am at a loss to diagnose this, I would appreciate your thoughts.
Open Nebula 18.104.22.168 running on CentOS 7
Steps to reproduce:
Simply create a hook template and then create a VM, which should create a log entry.
The hook is not executed.
Hook 11 should produce an error because the script does not exist.
Hook 12 should echo the arguments passed to it.