Hi there,
I’m doing some refactoring of the opennebula-metadata module, and would like to know what’s the quickest way to get the vmid, if having the IP address of a virtual machine.
Currently I’m doing as follows:
flags = OpenNebula::Pool::INFO_ALL || OpenNebula::VirtualMachinePool::INFO_NOT_DONE
vmpool = VirtualMachinePool.new(@oneadmin_client, flags)
vmpool.info
vmpool.each do |vm|
return vm.id if vm["TEMPLATE/NIC/IP"] == ip
end
Transversing all the vmpool for every single attribute the metadata server returns is not something I consider a nice and efficient implementation.
Thanks,
Ricardo