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

F #4913: Use the pool instead of querying opennebula

This commit is contained in:
Jaime Melis 2017-07-17 17:30:11 +02:00
parent 91a8831912
commit 9e5bb8b974
2 changed files with 12 additions and 12 deletions

View File

@ -464,21 +464,21 @@ class ClusterComputeResource
number = matches[1] if matches
# Extract vmid from ref and vcenter instance uuid if possible
one_vm = nil
if number == -1
one_vm = VCenterDriver::VIHelper.find_by_ref(OpenNebula::VirtualMachinePool,
"DEPLOY_ID",
vm_ref,
vc_uuid,
vm_pool)
number = one_vm["ID"] if one_vm
end
if one_vm
number = one_vm["ID"]
if number != -1
next if @monitored_vms.include? number
@monitored_vms << number
next if @monitored_vms.include? number
@monitored_vms << number
if vm.get_vm_id(vm_pool)
vm.one_item
vm.one_item = one_vm
vm.vm_id = number
end
end

View File

@ -818,7 +818,7 @@ class VirtualMachine < Template
VM_SHUTDOWN_TIMEOUT = 600 #10 minutes til poweroff hard
attr_accessor :item
attr_accessor :item, :vm_id
attr_accessor :vm_info
@ -920,8 +920,8 @@ class VirtualMachine < Template
# @return String the vm_id stored in vCenter
def get_vm_id(vm_pool = nil)
if defined?(@one_item_id) && @one_item_id
return @one_item_id
if defined?(@vm_id) && @vm_id
return @vm_id
end
vm_ref = self['_ref']
@ -936,8 +936,8 @@ class VirtualMachine < Template
vm_pool)
return nil if !one_vm
@one_item_id = one_vm["ID"]
return @one_item_id
@vm_id = one_vm["ID"]
return @vm_id
end
def get_vcenter_instance_uuid