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:
parent
91a8831912
commit
9e5bb8b974
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user