1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-13 13:17:39 +03:00

Feature #1739: Drivers only return VM/ID when the VM name is exactly one-id

This commit is contained in:
Carlos Martín 2013-02-12 18:50:33 +01:00
parent ad44a97905
commit d95d0bddbc
3 changed files with 20 additions and 3 deletions

View File

@ -103,9 +103,15 @@ end
def get_all_vm_info(host, vms)
vms.each do |vm|
info=get_vm_info(host, vm)
number=vm.split('-').last
number = -1
if (vm =~ /^one-\d*$/)
number = vm.split('-').last
end
puts "VM=["
puts " ID=#{number},"
puts " DEPLOY_ID=#{vm},\n"
puts " POLL=\"#{info}\" ]"
end
end

View File

@ -60,9 +60,15 @@ def info_string(dom_info)
end
def vm_info(name, dom_info)
number=name.split('-').last
number = -1
if (name =~ /^one-\d*$/)
number = name.split('-').last
end
string="VM=[\n"
string<<" ID=\"#{number}\",\n"
string<<" DEPLOY_ID=#{name},\n"
string<<" POLL=\"#{info_string(dom_info)}\" ]"
string
end

View File

@ -347,10 +347,15 @@ def print_all_vm_template(hypervisor)
vms=hypervisor.get_all_vm_info
vms.each do |name, data|
number=name.split("-")[-1]
number = -1
if (name =~ /^one-\d*$/)
number = name.split('-').last
end
string="VM=[\n"
string<<" ID=#{number},\n"
string<<" DEPLOY_ID=#{name},\n"
values=data.map do |key, value|
print_data(key, value)