Unable to set up HA for VM - ONE 6.0

Hello community!

I am currently trying Open Nebula 6 and when setting up HA for VM I am running into some problems.

I have added the hook by running onehook create <my hook>:

ARGUMENTS = "$TEMPLATE -m -p 5"
COMMAND   = "/var/tmp/one/hooks/ft/host_error.rb"
Preformatted text`NAME      = "host_error"
STATE     = "ERROR"
REMOTE    = "no"
RESOURCE  = HOST
TYPE      = state

When my host gives error I can see that the hook gets activated by reading /var/log/one/onehm.log

Wed Apr 21 20:31:09 2021 [I]: Executing hook 2 for HOST/ERROR/
Wed Apr 21 20:31:11 2021 [E]: Failure executing hook 2 for HOST/ERROR/

Upon further investigation I ran the command onehook show <hook id> -e 0

HOOK 2 INFORMATION                                                              
ID                : 2                   
NAME              : host_error          
TYPE              : state               
LOCK              : None                

ERROR: Invalid predicate: //HOOK_EXECUTION_RECORD[EXECUTION_ID=0cd]
    oneadmin@one-sunstone:/home/onedmin$ ^C
    oneadmin@one-sunstone:/home/onedmin$ onehook show 2 -e 0

HOOK 2 INFORMATION                                                              
ID                : 2                   
NAME              : host_error          
TYPE              : state               
LOCK              : None                

HOOK EXECUTION RECORD                                                           
EXECUTION ID      : 0                   
TIMESTAMP         : 04/21 20:31:11      
COMMAND           : /var/tmp/one/hooks/ft/host_error.rb PEhPU1Q+CiAgPElEPjE8L0lEPgogIDxOQU1FPjE3Mi4xNi4xMDAuNTI8L05BTUU+CiAgPFNUQVRFPjM8L1NUQVRFPgogIDxQUkVWX1NUQVRFPjI8L1BSRVZfU1RBVEU+CiAgPElNX01BRD48IVtDREFUQVtrdm1dXT48L0lNX01BRD4KICA8Vk1fTUFEPjwhW0NEQVRBW2t2bV1dPjwvVk1fTUFEPgogIDxDTFVTVEVSX0lEPjA8L0NMVVNURVJfSUQ+CiAgPENMVVNURVI+ZGVmYXVsdDwvQ0xVU1RFUj4KICA8SE9TVF9TSEFSRT4KICAgIDxNRU1fVVNBR0U+MTMxMDcyPC9NRU1fVVNBR0U+CiAgICA8Q1BVX1VTQUdFPjEwMDw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q+ -m -p 5 
ARGUMENTS         : <HOST>
  <ID>1</ID>
  <NAME>172.16.100.52</NAME>
  <STATE>3</STATE>
  <PREV_STATE>2</PREV_STATE>
  <IM_MAD><![CDATA[kvm]]></IM_MAD>
  <VM_MAD><![CDATA[kvm]]></VM_MAD>
  <CLUSTER_ID>0</CLUSTER_ID>
  <CLUSTER>default</CLUSTER>
  <HOST_SHARE>
    <MEM_USAGE>131072</MEM_USAGE>
    <CPU_USAGE>100</CPU_USAGE>
    <TOTAL_MEM>16398016</TOTAL_MEM>
    <TOTAL_CPU>400</TOTAL_CPU>
    <MAX_MEM>16398016</MAX_MEM>
    <MAX_CPU>400</MAX_CPU>
    <RUNNING_VMS>1</RUNNING_VMS>
    <VMS_THREAD>1</VMS_THREAD>
    <DATASTORES>
      <DISK_USAGE><![CDATA[0]]></DISK_USAGE>
      <DS>
        <FREE_MB><![CDATA[39983]]></FREE_MB>
        <ID><![CDATA[0]]></ID>
        <TOTAL_MB><![CDATA[49637]]></TOTAL_MB>
        <USED_MB><![CDATA[7105]]></USED_MB>
      </DS>
      <FREE_DISK><![CDATA[39983]]></FREE_DISK>
      <MAX_DISK><![CDATA[49637]]></MAX_DISK>
      <USED_DISK><![CDATA[7105]]></USED_DISK>
    </DATASTORES>
    <PCI_DEVICES/>
    <NUMA_NODES>
      <NODE>
        <CORE>
          <CPUS><![CDATA[3:-1]]></CPUS>
          <DEDICATED><![CDATA[NO]]></DEDICATED>
          <FREE><![CDATA[1]]></FREE>
          <ID><![CDATA[0]]></ID>
        </CORE>
        <HUGEPAGE>
          <FREE><![CDATA[0]]></FREE>
          <PAGES><![CDATA[0]]></PAGES>
          <SIZE><![CDATA[2048]]></SIZE>
          <USAGE><![CDATA[0]]></USAGE>
        </HUGEPAGE>
        <MEMORY>
          <DISTANCE><![CDATA[0]]></DISTANCE>
          <FREE><![CDATA[0]]></FREE>
          <TOTAL><![CDATA[16398016]]></TOTAL>
          <USAGE><![CDATA[0]]></USAGE>
          <USED><![CDATA[0]]></USED>
        </MEMORY>
        <NODE_ID><![CDATA[0]]></NODE_ID>
      </NODE>
    </NUMA_NODES>
  </HOST_SHARE>
  <VMS>
    <ID>9</ID>
  </VMS>
  <TEMPLATE>
    <ARCH><![CDATA[x86_64]]></ARCH>
    <CLUSTER_ID><![CDATA[0]]></CLUSTER_ID>
    <CPUSPEED><![CDATA[2394]]></CPUSPEED>
    <ERROR><![CDATA[Wed Apr 21 20:31:09 2021 : Error monitoring Host 172.16.100.52 (1): ]]></ERROR>
    <HOSTNAME><![CDATA[one-kvm2]]></HOSTNAME>
    <HYPERVISOR><![CDATA[kvm]]></HYPERVISOR>
    <IM_MAD><![CDATA[kvm]]></IM_MAD>
    <KVM_CPU_MODEL><![CDATA[Westmere]]></KVM_CPU_MODEL>
    <KVM_CPU_MODELS><![CDATA[486 pentium pentium2 pentium3 pentiumpro coreduo n270 core2duo qemu32 kvm32 cpu64-rhel5 cpu64-rhel6 qemu64 kvm64 Conroe Penryn Nehalem Nehalem-IBRS Westmere Westmere-IBRS SandyBridge SandyBridge-IBRS IvyBridge IvyBridge-IBRS Haswell-noTSX Haswell-noTSX-IBRS Haswell Haswell-IBRS Broadwell-noTSX Broadwell-noTSX-IBRS Broadwell Broadwell-IBRS Skylake-Client Skylake-Client-IBRS Skylake-Client-noTSX-IBRS Skylake-Server Skylake-Server-IBRS Skylake-Server-noTSX-IBRS Cascadelake-Server Cascadelake-Server-noTSX Icelake-Client Icelake-Client-noTSX Icelake-Server Icelake-Server-noTSX athlon phenom Opteron_G1 Opteron_G2 Opteron_G3 Opteron_G4 Opteron_G5 EPYC EPYC-IBPB EPYC-Rome Dhyana]]></KVM_CPU_MODELS>
    <KVM_MACHINES><![CDATA[pc-i440fx-focal ubuntu pc-0.15 pc-i440fx-2.12 pc-i440fx-2.0 pc-i440fx-xenial pc-q35-4.2 q35 pc-i440fx-2.5 pc-i440fx-4.2 pc pc-q35-xenial pc-i440fx-1.5 pc-0.12 pc-q35-2.7 pc-q35-eoan-hpb pc-i440fx-disco-hpb pc-i440fx-zesty pc-q35-artful pc-i440fx-trusty pc-i440fx-2.2 pc-i440fx-eoan-hpb pc-q35-focal-hpb pc-1.1 pc-q35-bionic-hpb pc-i440fx-artful pc-i440fx-2.7 pc-i440fx-yakkety pc-q35-2.4 pc-q35-cosmic-hpb pc-q35-2.10 pc-i440fx-1.7 pc-0.14 pc-q35-2.9 pc-i440fx-2.11 pc-q35-3.1 pc-q35-4.1 pc-i440fx-2.4 pc-1.3 pc-i440fx-4.1 pc-q35-eoan pc-i440fx-2.9 pc-i440fx-bionic-hpb isapc pc-i440fx-1.4 pc-q35-cosmic pc-q35-2.6 pc-i440fx-3.1 pc-q35-bionic pc-q35-disco-hpb pc-i440fx-cosmic pc-q35-2.12 pc-i440fx-bionic pc-q35-disco pc-i440fx-cosmic-hpb pc-i440fx-2.1 pc-1.0 pc-i440fx-wily pc-i440fx-2.6 pc-q35-4.0.1 pc-i440fx-1.6 pc-0.13 pc-q35-2.8 pc-i440fx-2.10 pc-q35-3.0 pc-q35-zesty pc-q35-4.0 microvm pc-i440fx-2.3 pc-q35-focal ubuntu-q35 pc-i440fx-disco pc-1.2 pc-i440fx-4.0 pc-i440fx-focal-hpb pc-i440fx-2.8 pc-i440fx-eoan pc-q35-2.5 pc-i440fx-3.0 pc-q35-yakkety pc-q35-2.11]]></KVM_MACHINES>
    <MODELNAME><![CDATA[Intel(R) Xeon(R) CPU E7- 4870  @ 2.40GHz]]></MODELNAME>
    <NAME><![CDATA[172.16.100.52]]></NAME>
    <RESERVED_CPU><![CDATA[]]></RESERVED_CPU>
    <RESERVED_MEM><![CDATA[]]></RESERVED_MEM>
    <VERSION><![CDATA[6.0.0]]></VERSION>
    <VM_MAD><![CDATA[kvm]]></VM_MAD>
  </TEMPLATE>
  <MONITORING/>
</HOST> -m -p 5 
EXIT CODE         : 1                   

EXECUTION STDOUT                                                                


EXECUTION STDERR                                                                
/usr/lib/ruby/2.7.0/base64.rb:59:in `decode64': undefined method `unpack1' for nil:NilClass (NoMethodError)
	from /var/tmp/one/hooks/ft/host_error.rb:78:in `<main>

I am genuinely lost in this, and any help would be really helpful.

Hi, looks like there is a problem with arguments. The host_error.rb is excepting base64 encoded data passed via stdin, but hook passes it as a normal argument.

You can try to remove lines 75 and 76 from this file one/host_error.rb at master · OpenNebula/one · GitHub

UPDATE:
I found in docs, that there is hook template parameter ARGUMENTS_STDIN = yes

You need to use it when creating hook, so base64 encoded argument will be passed via stdin

So your hook template should looks like this

ARGUMENTS = "$TEMPLATE -m -p 5"
ARGUMENTS_STDIN = yes
COMMAND   = "/var/tmp/one/hooks/ft/host_error.rb"
NAME      = "host_error"
STATE     = "ERROR"
REMOTE    = "no"
RESOURCE  = HOST
TYPE      = state

Hello Kristian,

Thanks for your suggestion. Now I have the meaning of the error clearer. So I follow up with what you shared, first I added ARGUMENTS_STDIN = yes to my hook template. Sadly when I tested the hook I received the following in /var/log/one/onehem.log

Thu Apr 22 14:51:02 2021 [E]: Failure executing hook 3 for HOST/ERROR/
Thu Apr 22 15:00:32 2021 [I]: Executing hook 3 for HOST/ERROR/
Thu Apr 22 15:00:34 2021 [E]: Failure executing hook 3 for HOST/ERROR/

After this I ran onehook show 3 -e 0 and got the following

HOOK 3 INFORMATION                                                              
ID                : 3                   
NAME              : host_error          
TYPE              : state               
LOCK              : None                

HOOK EXECUTION RECORD                                                           
EXECUTION ID      : 0                   
TIMESTAMP         : 04/22 14:51:02      
COMMAND           : /var/tmp/one/hooks/ft/host_error.rb
ARGUMENTS         : <HOST>
  <ID>0</ID>
  <NAME>172.16.100.51</NAME>
  <STATE>3</STATE>
  <PREV_STATE>2</PREV_STATE>
  <IM_MAD><![CDATA[kvm]]></IM_MAD>
  <VM_MAD><![CDATA[kvm]]></VM_MAD>
  <CLUSTER_ID>0</CLUSTER_ID>
  <CLUSTER>default</CLUSTER>
  <HOST_SHARE>
    <MEM_USAGE>131072</MEM_USAGE>
    <CPU_USAGE>100</CPU_USAGE>
    <TOTAL_MEM>16398032</TOTAL_MEM>
    <TOTAL_CPU>400</TOTAL_CPU>
    <MAX_MEM>16398032</MAX_MEM>
    <MAX_CPU>400</MAX_CPU>
    <RUNNING_VMS>1</RUNNING_VMS>
    <VMS_THREAD>1</VMS_THREAD>
    <DATASTORES>
      <DISK_USAGE><![CDATA[0]]></DISK_USAGE>
      <DS>
        <FREE_MB><![CDATA[38780]]></FREE_MB>
        <ID><![CDATA[0]]></ID>
        <TOTAL_MB><![CDATA[49637]]></TOTAL_MB>
        <USED_MB><![CDATA[8308]]></USED_MB>
      </DS>
      <FREE_DISK><![CDATA[40032]]></FREE_DISK>
      <MAX_DISK><![CDATA[49637]]></MAX_DISK>
      <USED_DISK><![CDATA[7055]]></USED_DISK>
    </DATASTORES>
    <PCI_DEVICES/>
    <NUMA_NODES>
      <NODE>
        <CORE>
          <CPUS><![CDATA[3:-1]]></CPUS>
          <DEDICATED><![CDATA[NO]]></DEDICATED>
          <FREE><![CDATA[1]]></FREE>
          <ID><![CDATA[0]]></ID>
        </CORE>
        <HUGEPAGE>
          <FREE><![CDATA[0]]></FREE>
          <PAGES><![CDATA[0]]></PAGES>
          <SIZE><![CDATA[2048]]></SIZE>
          <USAGE><![CDATA[0]]></USAGE>
        </HUGEPAGE>
        <MEMORY>
          <DISTANCE><![CDATA[0]]></DISTANCE>
          <FREE><![CDATA[0]]></FREE>
          <TOTAL><![CDATA[16398032]]></TOTAL>
          <USAGE><![CDATA[0]]></USAGE>
          <USED><![CDATA[0]]></USED>
        </MEMORY>
        <NODE_ID><![CDATA[0]]></NODE_ID>
      </NODE>
    </NUMA_NODES>
  </HOST_SHARE>
  <VMS>
    <ID>9</ID>
  </VMS>
  <TEMPLATE>
    <ARCH><![CDATA[x86_64]]></ARCH>
    <CLUSTER_ID><![CDATA[0]]></CLUSTER_ID>
    <CPUSPEED><![CDATA[2394]]></CPUSPEED>
    <ERROR><![CDATA[Thu Apr 22 14:46:01 2021 : Error monitoring Host 172.16.100.51 (0): ]]></ERROR>
    <HOSTNAME><![CDATA[one-kvm1]]></HOSTNAME>
    <HYPERVISOR><![CDATA[kvm]]></HYPERVISOR>
    <IM_MAD><![CDATA[kvm]]></IM_MAD>
    <KVM_CPU_MODEL><![CDATA[Westmere]]></KVM_CPU_MODEL>
    <KVM_CPU_MODELS><![CDATA[486 pentium pentium2 pentium3 pentiumpro coreduo n270 core2duo qemu32 kvm32 cpu64-rhel5 cpu64-rhel6 qemu64 kvm64 Conroe Penryn Nehalem Nehalem-IBRS Westmere Westmere-IBRS SandyBridge SandyBridge-IBRS IvyBridge IvyBridge-IBRS Haswell-noTSX Haswell-noTSX-IBRS Haswell Haswell-IBRS Broadwell-noTSX Broadwell-noTSX-IBRS Broadwell Broadwell-IBRS Skylake-Client Skylake-Client-IBRS Skylake-Client-noTSX-IBRS Skylake-Server Skylake-Server-IBRS Skylake-Server-noTSX-IBRS Cascadelake-Server Cascadelake-Server-noTSX Icelake-Client Icelake-Client-noTSX Icelake-Server Icelake-Server-noTSX athlon phenom Opteron_G1 Opteron_G2 Opteron_G3 Opteron_G4 Opteron_G5 EPYC EPYC-IBPB EPYC-Rome Dhyana]]></KVM_CPU_MODELS>
    <KVM_MACHINES><![CDATA[pc-i440fx-focal ubuntu pc-0.15 pc-i440fx-2.12 pc-i440fx-2.0 pc-i440fx-xenial pc-q35-4.2 q35 pc-i440fx-2.5 pc-i440fx-4.2 pc pc-q35-xenial pc-i440fx-1.5 pc-0.12 pc-q35-2.7 pc-q35-eoan-hpb pc-i440fx-disco-hpb pc-i440fx-zesty pc-q35-artful pc-i440fx-trusty pc-i440fx-2.2 pc-i440fx-eoan-hpb pc-q35-focal-hpb pc-1.1 pc-q35-bionic-hpb pc-i440fx-artful pc-i440fx-2.7 pc-i440fx-yakkety pc-q35-2.4 pc-q35-cosmic-hpb pc-q35-2.10 pc-i440fx-1.7 pc-0.14 pc-q35-2.9 pc-i440fx-2.11 pc-q35-3.1 pc-q35-4.1 pc-i440fx-2.4 pc-1.3 pc-i440fx-4.1 pc-q35-eoan pc-i440fx-2.9 pc-i440fx-bionic-hpb isapc pc-i440fx-1.4 pc-q35-cosmic pc-q35-2.6 pc-i440fx-3.1 pc-q35-bionic pc-q35-disco-hpb pc-i440fx-cosmic pc-q35-2.12 pc-i440fx-bionic pc-q35-disco pc-i440fx-cosmic-hpb pc-i440fx-2.1 pc-1.0 pc-i440fx-wily pc-i440fx-2.6 pc-q35-4.0.1 pc-i440fx-1.6 pc-0.13 pc-q35-2.8 pc-i440fx-2.10 pc-q35-3.0 pc-q35-zesty pc-q35-4.0 microvm pc-i440fx-2.3 pc-q35-focal ubuntu-q35 pc-i440fx-disco pc-1.2 pc-i440fx-4.0 pc-i440fx-focal-hpb pc-i440fx-2.8 pc-i440fx-eoan pc-q35-2.5 pc-i440fx-3.0 pc-q35-yakkety pc-q35-2.11]]></KVM_MACHINES>
    <MODELNAME><![CDATA[Intel(R) Xeon(R) CPU E7- 4870  @ 2.40GHz]]></MODELNAME>
    <NAME><![CDATA[172.16.100.51]]></NAME>
    <RESERVED_CPU><![CDATA[]]></RESERVED_CPU>
    <RESERVED_MEM><![CDATA[]]></RESERVED_MEM>
    <TOTAL_ZOMBIES><![CDATA[1]]></TOTAL_ZOMBIES>
    <VERSION><![CDATA[6.0.0]]></VERSION>
    <VM_MAD><![CDATA[kvm]]></VM_MAD>
    <ZOMBIES><![CDATA[8]]></ZOMBIES>
  </TEMPLATE>
  <MONITORING/>
</HOST> -m -p 5 
EXIT CODE         : 255                 

EXECUTION STDOUT                                                                


EXECUTION STDERR  

Now it does not return anything. I’m genuinely quite lost, I do not know if I am the one looking for the information in the wrong side of the doc, of if the doc is a little bit hard to find.

Hello @Luis,

First of all, I recommend you to use a relative path in COMMAND, this way OpenNebula will search in /var/lib/one/remotes/hooks.

If you take a look at file /var/lib/one/remotes/hooks/ft/host_error.rb, you’ll see that the script fence_host.sh in the same subfolder is called. And if you take a look at /var/lib/one/remotes/hooks/ft/host_error.rb, you’ll see this disclaimer: This script needs to be modified to enable fencing of the host. By default it will fail, as the first line is 'exit 1'. You will need to remove it. Therefore, you need to adapt it depending on the fencing tool you are going to use.

In your case, it is failing because you probably don’t have the /var/tmp/one/hooks/ft/fence_host.sh script and therefore the exit code is 255 instead of 1.

To properly configure host_error hook follow the steps below:

  • Make a copy of the of ft folder (to avoid overwriting your modifications by opennebula packages): cp -rp /var/lib/one/remotes/hooks/ft /var/lib/one/remotes/hooks/myft (myft or whatever name you want).
  • Customize the /var/lib/one/remotes/hooks/myft/fence_host.sh script.
  • Create a hook template similar to this (host_error.tmpl):
ARGUMENTS = "$TEMPLATE -m -p 5"
ARGUMENTS_STDIN = yes
COMMAND   = "myft/host_error.rb"
NAME      = "host_error"
STATE     = "ERROR"
REMOTE    = "no"
RESOURCE  = HOST
TYPE      = state
  • Register the hook: onehook create hook_error.tmpl.

Cheers.