[one-users] Host hooks aren't triggered

Zaina AFOULKI zaina.afoulki at ensi-bourges.fr
Fri Apr 1 08:23:50 PDT 2011


 Hi Tino,

 I added this to the ruby script (I'm new to Ruby, so I'm not sure it's 
 correct):

 my_file.puts "OpenNebula host  #{vm_ids_array.class}"
 for item in 0...vm_ids_array.length
         my_file.puts " #{vm_ids_array[item]}";
 end

 $cat /tmp/remove_me.txt
 OpenNebula host has failed 31
 NilClass

 oned.log:

 Fri Apr  1 17:16:36 2011 [HKM][D]: Message received: LOG - 31 Command 
 execution fail: /home/oneadmin/one/share/hooks/host_error.rb 31 -r y
 Fri Apr  1 17:16:36 2011 [HKM][D]: Message received: LOG - 31 STDERR 
 follows.
 Fri Apr  1 17:16:36 2011 [HKM][D]: Message received: LOG - 31 
 /home/oneadmin/one/share/hooks/host_error.rb:81: undefined method 
 `length' for nil:NilClass (NoMethodError)

 Thanks for your help,

 --
 Zaina

 On Fri, 1 Apr 2011 12:31:21 +0100, Tino Vazquez wrote:
> Hi Zaina,
>
> Could you please print out also the content of "vm_ids_array"? I am
> afraid the xpath expression may not be doing its job.
>
> Regards,
>
> -Tino
>
> --
> Constantino Vázquez Blanco, MSc
> OpenNebula Major Contributor
> www.OpenNebula.org | @tinova79
>
>
>
> On Fri, Apr 1, 2011 at 8:57 AM, Zaina AFOULKI
> <zaina.afoulki at ensi-bourges.fr> wrote:
>> Hi,
>>
>> I checked the ruby script that's called and it seems that the array
>> containing the list of VMs is empty
>> vm_ids_array =
>> 
>> vms.retrieve_elements("/VM_POOL/VM[STATE=3]/HISTORY[HOSTNAME=\"#{host_name}\"]/../ID")
>>
>> I tried printing something to a tmp file to make sure that the 
>> script gets
>> the right host id.
>> my_file = File.new("/tmp/remove_me.txt", "w")
>> my_file.puts "OpenNebula host has failed #{ARGV[0]}"
>>
>> The hostname and host_id are correctly detected by the script.
>>
>> Thank you for any hints on how to fix this,
>>
>> --
>> Zaina
>>
>> On Thu, 31 Mar 2011 16:36:22 +0200, Zaina AFOULKI wrote:
>>>
>>> I just checked back the oned.log and it seems that the hook is 
>>> executed
>>> [HKM][D]: Message received: EXECUTE SUCCESS 31 disable
>>>
>>> However the VMs aren't re-submitted as expected ?
>>>
>>> Thanks,
>>> --
>>> Zaina
>>>
>>> On Thu, 31 Mar 2011 16:20:27 +0200, Zaina AFOULKI wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm having some trouble getting the HOST_HOOKS to work:
>>>> I added this to the configuration file and restarted oned.
>>>>
>>>> HOST_HOOK = [
>>>>    name      = "disable",
>>>>    on        = "DISABLE",
>>>>    command   = "host_error.rb",
>>>>    arguments = "$HID -r y",
>>>>    remote    = "no" ]
>>>>
>>>> However when I disable a host using "onehost disable" the VMs 
>>>> aren't
>>>> re-submitted.
>>>> The oned.log doesn't indicate that the hook has been triggered.
>>>>
>>>> I'm using OpenNebula 2.2 and the script host_error.rb is indeed
>>>> located in my $ONE_LOCATION/share/hooks/
>>>>
>>>> What am I doing wrong? Thanks
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opennebula.org
>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>

-- 
 Zaina AFOULKI
 Étudiante à l'Ecole Nationale Supérieure d'Ingénieurs de Bourges.
 1ère année Sécurité et Technologies Informatiques



More information about the Users mailing list