mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-13 12:58:17 +03:00
F #4913: Store in tmp file the host where a VM is deployed so VNC connections can establish even if the VM hasn't been monitored yet.
This commit is contained in:
parent
7b801cddbc
commit
b6a306809a
@ -99,6 +99,8 @@ VNC_STATES = [
|
||||
#64 #DISK_RESIZE_UNDEPLOYED
|
||||
]
|
||||
|
||||
VNC_ESX_HOST_FOLDER = "/tmp"
|
||||
|
||||
class OpenNebulaVNC
|
||||
|
||||
attr_reader :proxy_port
|
||||
@ -211,8 +213,18 @@ class OpenNebulaVNC
|
||||
vnc_port = vm_resource['TEMPLATE/GRAPHICS/PORT']
|
||||
vnc_pw = vm_resource['TEMPLATE/GRAPHICS/PASSWD']
|
||||
|
||||
if vm_resource['MONITORING/VCENTER_ESX_HOST'] # It is behind a vCenter
|
||||
host = vm_resource['MONITORING/VCENTER_ESX_HOST']
|
||||
# If it is a vCenter VM
|
||||
if vm_resource['USER_TEMPLATE/HYPERVISOR'] == "vcenter"
|
||||
if vm_resource['MONITORING/VCENTER_ESX_HOST']
|
||||
host = vm_resource['MONITORING/VCENTER_ESX_HOST']
|
||||
else
|
||||
# F#4242 get ESX host from file if it hasn't been monitored yet
|
||||
begin
|
||||
host = File.read(File.join(VNC_ESX_HOST_FOLDER, "vcenter_vnc_#{vm_resource["/VM/ID"]}"))
|
||||
rescue
|
||||
return error(400,"Could not determine the vCenter ESX host where the VM is running. Wait till the VCENTER_ESX_HOST attribute is retrieved once the host has been monitored")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Generate token random_str: host:port
|
||||
|
Loading…
x
Reference in New Issue
Block a user