[one-users] Find the Host of a given VM via RPC Interface
Daniel Molina
dmolina at opennebula.org
Mon Feb 20 03:15:17 PST 2012
Hi Manuel,
On 20 February 2012 10:36, Manuel Peuster <manuel at peuster.de> wrote:
> Hello,
>
> I am trying to get the host on which a given VM is running at this moment,
> this should be used for status output purpose in my cloud controlling tool.
>
> I am using the ONE XML-RPC interface.
>
> Am I right , that the only place where this information is given is returned
> in the <HISTORY_RECORDS> part of the vm.info action? There is an entry
> called <HID> with the host id?
>
You are right, that is the best way to retrieve such kind of info. If
you retrieve the whole pool (vmpool.info) the last HISTORY will be
included in the HISTORY_RECORDS section and you can get the HID and
HOSTNAME of the current HOST in which the VM is running. You have to
take into account that if the VM state is STOPPED the HISTORY will
show the HOST information of the VM when it was running.
If you want to get a full HISTORY of the VM you can retrieve it using
the vm.info request. All the HISTORY records will be included in the
XML. A new HISTORY is generated with a new SEQ number each time a VM
moves to another HOST, .
You can see an example of this in the onevm_helper.rb file. The d
variable is a Hash built from the VM section fo the VM_POOL xml
https://github.com/OpenNebula/one/blob/master/src/cli/one_helper/onevm_helper.rb#L85
Hope this helps.
> Are there better ways to get this information?
>
> Thank you.
>
> Regards,
>
> Manuel
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
--
Daniel Molina
Project Engineer
OpenNebula - The Open Source Solution for Data Center Virtualization
www.OpenNebula.org | dmolina at opennebula.org | @OpenNebula
More information about the Users
mailing list