[one-users] VM_HOOK "on = CREATE" cannot work on remote hosts

Akihiko Ota skywalker.37th at gmail.com
Tue Jun 19 01:44:42 PDT 2012


Hi Carlos,

Hmm... It seems that the RUNNING hook executes the script
simultaneously with starting of VM. I'd like to execute the script on
remote host before VM begins to start because this script does some
preparation for VM.

Now, I am using the DONE hook to execute this script to clean up after
VM shutdown. I expect this config works fine.

Thanks,

-- 
Akihiko Ota

From: Carlos Martín Sánchez <cmartin at opennebula.org>
Subject: Re: [one-users] VM_HOOK "on = CREATE" cannot work on remote hosts
Date: Mon, 18 Jun 2012 18:19:16 +0200

> Hi,
> 
> When a VM is created it is not assigned yet to any host, until the
> scheduler decides to deploy it, thus the hook can't be remote.
> You can use the RUNNING hook instead.
> 
> Regards
> --
> Carlos Martín, MSc
> Project Engineer
> OpenNebula - The Open-source Solution for Data Center Virtualization
> www.OpenNebula.org | cmartin at opennebula.org |
> @OpenNebula<http://twitter.com/opennebula><cmartin at opennebula.org>
> 
> 
> 
> On Mon, Jun 18, 2012 at 8:34 AM, Akihiko Ota <skywalker.37th at gmail.com>wrote:
> 
>> Hi,
>>
>> I tryed to run a script on remote hosts by VM_HOOK. It works as
>> intended if it is defined "on = DONE", but don't work if defined "on =
>> CREATE".
>> I have defined a hook in etc/oned.conf as follows:
>>
>> VM_HOOK = [
>>   name      = "clear_work",
>>   on        = "CREATE",
>>   command   = "ft/clear_work.sh",
>>   remote    = "YES",
>>   arguments = "" ]
>>
>> Then deployed the script to remote VM hosting machines by "onehost sync",
>> and restart oned. But the HOOK had failed.
>>
>> Mon Jun 18 14:30:08 2012 [HKM][D]: Message received: LOG I 166 Command
>> execution fail: /var/tmp/one/hooks//ft/clear_work.sh ""
>> Mon Jun 18 14:30:08 2012 [HKM][D]: Message received: LOG I 166 sh:
>> /var/tmp/one/hooks//ft/clear_work.sh: No such file or directory
>> Mon Jun 18 14:30:08 2012 [HKM][D]: Message received: LOG I 166 ExitCode:
>> 127
>> Mon Jun 18 14:30:08 2012 [HKM][D]: Message received: EXECUTE FAILURE
>> 166 clear_work: -
>>
>> "/var/tmp/one/hooks//ft/clear_work.sh" script exists on all VM hosting
>> machines. So, I had a try deploy a dummy script onto the OpenNebula
>> frontend machine:
>>
>> [ascadm at frontend]% /bin/hostname
>> frontend
>> [ascadm at frontend]% mkdir -p /var/tmp/one/hooks//ft/
>> [ascadm at frontend]% cat > /var/tmp/one/hooks//ft/clear_work.sh
>> #!/bin/sh
>> /bin/hostname
>> ^D
>> [ascadm at frontend]% chmod +x /var/tmp/one/hooks//ft/clear_work.sh
>> [ascadm at frontend]% onevm create ~/work/vms/normal.one
>> ID: 167
>>
>> [ascadm at frontend]% less /srv/cloud/one/var/oned.log
>> (snip)
>> Mon Jun 18 14:40:58 2012 [HKM][D]: Message received: LOG I 167 ExitCode: 0
>> Mon Jun 18 14:40:58 2012 [HKM][D]: Message received: EXECUTE SUCCESS
>> 167 clear_work: frontend
>> (snip)
>>
>> It seems HOOK script runs on the frontend machine instead of the
>> remote host. Is this correct behavior?
>>
>> I am using OpenNebula 3.2.1 on CentOS 5.7(x86_64) now.
>>
>> Thanks,
>>
>> --
>> Akihiko Ota
>> _______________________________________________
>> Users mailing list
>> Users at lists.opennebula.org
>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>



More information about the Users mailing list