mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-29 18:50:08 +03:00
Prevent monitor error getting vcenter VMs
(cherry picked from commit c01cfbce3f9d94598f835326ba8494810449d997)
This commit is contained in:
parent
a45c0a4078
commit
015f5aad69
@ -689,24 +689,30 @@ class VCenterHost < ::OpenNebula::Host
|
||||
def monitor_vms
|
||||
str_info = ""
|
||||
@resource_pool.vm.each { |v|
|
||||
name = v.name
|
||||
number = -1
|
||||
number = name.split('-').last if (name =~ /^one-\d*$/)
|
||||
begin
|
||||
name = v.name
|
||||
number = -1
|
||||
number = name.split('-').last if (name =~ /^one-\d*$/)
|
||||
|
||||
vm = VCenterVm.new(@client, v)
|
||||
vm.monitor
|
||||
vm = VCenterVm.new(@client, v)
|
||||
vm.monitor
|
||||
|
||||
next if !vm.vm.config
|
||||
next if !vm.vm.config
|
||||
|
||||
str_info << "\nVM = ["
|
||||
str_info << "ID=#{number},"
|
||||
str_info << "DEPLOY_ID=\"#{vm.vm.config.uuid}\","
|
||||
str_info << "VM_NAME=\"#{name}\","
|
||||
if number == -1
|
||||
vm_template_to_one = Base64.encode64(vm.vm_to_one).gsub("\n","")
|
||||
str_info << "IMPORT_TEMPLATE=\"#{vm_template_to_one}\","
|
||||
str_info << "\nVM = ["
|
||||
str_info << "ID=#{number},"
|
||||
str_info << "DEPLOY_ID=\"#{vm.vm.config.uuid}\","
|
||||
str_info << "VM_NAME=\"#{name}\","
|
||||
|
||||
if number == -1
|
||||
vm_template_to_one =
|
||||
Base64.encode64(vm.vm_to_one).gsub("\n","")
|
||||
str_info << "IMPORT_TEMPLATE=\"#{vm_template_to_one}\","
|
||||
end
|
||||
|
||||
str_info << "POLL=\"#{vm.info}\"]"
|
||||
rescue
|
||||
end
|
||||
str_info << "POLL=\"#{vm.info}\"]"
|
||||
}
|
||||
|
||||
return str_info
|
||||
|
Loading…
x
Reference in New Issue
Block a user