1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Feature #1739: Drivers inform that the VM_POLL info is included, making things easier for the core when 0 vms are found

This commit is contained in:
Carlos Martín 2013-02-13 12:40:34 +01:00
parent aac7ca944c
commit 5ad0a55cad
4 changed files with 13 additions and 5 deletions

View File

@ -91,6 +91,8 @@ void InformationManagerDriver::protocol(
if ( action == "MONITOR" )
{
bool vm_poll;
host = hpool->get(id,true);
if ( host == 0 )
@ -145,6 +147,9 @@ void InformationManagerDriver::protocol(
delete hinfo;
host->get_template_attribute("VM_POLL", vm_poll);
host->remove_template_attribute("VM_POLL");
host->remove_template_attribute("VM");
host->touch(true);
@ -187,10 +192,7 @@ void InformationManagerDriver::protocol(
delete *it;
}
// TODO Some drivers do not return info about the VMs, but we should
// have a better way to check that. This will be true when no VMs are
// reported
if (!vm_att.empty())
if (vm_poll)
{
for (set<int>::iterator it = vm_ids.begin(); it != vm_ids.end(); it++)
{

View File

@ -101,6 +101,8 @@ def get_vm_info(host, vm)
end
def get_all_vm_info(host, vms)
puts "VM_POLL=YES"
vms.each do |vm|
info=get_vm_info(host, vm)
@ -111,7 +113,7 @@ def get_all_vm_info(host, vms)
puts "VM=["
puts " ID=#{number},"
puts " DEPLOY_ID=#{vm},\n"
puts " DEPLOY_ID=#{vm},"
puts " POLL=\"#{info}\" ]"
end
end

View File

@ -113,6 +113,8 @@ if !ALL
puts info_string(dom_info)
else
puts "VM_POLL=YES"
doms_info.each do |name, data|
puts vm_info(name, data)
end

View File

@ -346,6 +346,8 @@ end
def print_all_vm_template(hypervisor)
vms=hypervisor.get_all_vm_info
puts "VM_POLL=YES"
vms.each do |name, data|
number = -1