-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Websocket proxy worker for HTM5 consoles #7078
Changes from all commits
5ee925a
ca993c9
c8f6ec5
5aec6be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ GlobalVars: | |
- $kube_log | ||
- $scvmm_log | ||
- $vim_log | ||
- $websocket_log | ||
# In Automate methods | ||
- $evm | ||
# | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,11 @@ def validate_remote_console_acquire_ticket(protocol, options = {}) | |
raise(MiqException::RemoteConsoleNotSupportedError, "#{protocol} remote console requires the vm to be running.") if options[:check_if_running] && state != "on" | ||
end | ||
|
||
def remote_console_acquire_ticket(protocol, proxy_miq_server = nil) | ||
send("remote_console_#{protocol.to_s.downcase}_acquire_ticket", proxy_miq_server) | ||
def remote_console_acquire_ticket(userid, protocol) | ||
send("remote_console_#{protocol.to_s.downcase}_acquire_ticket", userid) | ||
end | ||
|
||
def remote_console_acquire_ticket_queue(protocol, userid, proxy_miq_server = nil) | ||
def remote_console_acquire_ticket_queue(protocol, userid) | ||
task_opts = { | ||
:action => "acquiring Vm #{name} #{protocol.to_s.upcase} remote console ticket for user #{userid}", | ||
:userid => userid | ||
|
@@ -29,7 +29,7 @@ def remote_console_acquire_ticket_queue(protocol, userid, proxy_miq_server = nil | |
:priority => MiqQueue::HIGH_PRIORITY, | ||
:role => 'ems_operations', | ||
:zone => my_zone, | ||
:args => [protocol, proxy_miq_server] | ||
:args => [userid, protocol] | ||
} | ||
|
||
MiqTask.generic_action_with_callback(task_opts, queue_opts) | ||
|
@@ -39,7 +39,7 @@ def remote_console_acquire_ticket_queue(protocol, userid, proxy_miq_server = nil | |
# MKS | ||
# | ||
|
||
def remote_console_mks_acquire_ticket(_proxy_miq_server = nil) | ||
def remote_console_mks_acquire_ticket | ||
validate_remote_console_acquire_ticket("mks", :check_if_running => false) | ||
ext_management_system.vm_remote_console_mks_acquire_ticket(self) | ||
end | ||
|
@@ -48,7 +48,7 @@ def remote_console_mks_acquire_ticket(_proxy_miq_server = nil) | |
# VMRC | ||
# | ||
|
||
def remote_console_vmrc_acquire_ticket(_proxy_miq_server = nil) | ||
def remote_console_vmrc_acquire_ticket(_userid = nil) | ||
validate_remote_console_acquire_ticket("vmrc") | ||
ext_management_system.remote_console_vmrc_acquire_ticket | ||
end | ||
|
@@ -63,25 +63,10 @@ def validate_remote_console_vmrc_support | |
# VNC | ||
# | ||
|
||
def remote_console_vnc_acquire_ticket(proxy_miq_server = nil) | ||
def remote_console_vnc_acquire_ticket(userid) | ||
validate_remote_console_acquire_ticket("vnc") | ||
|
||
if proxy_miq_server | ||
proxy_miq_server = MiqServer.extract_objects(proxy_miq_server) | ||
config = proxy_miq_server.get_config.config | ||
|
||
proxy_address = config.fetch_path(:server, :vnc_proxy_address) | ||
proxy_address = nil if proxy_address.blank? | ||
proxy_port = config.fetch_path(:server, :vnc_proxy_port) | ||
proxy_port = nil if proxy_port.blank? | ||
proxy_port &&= proxy_port.to_i | ||
else | ||
proxy_address = proxy_port = nil | ||
end | ||
|
||
host_address = proxy_address ? host.guid : host.address | ||
password = SecureRandom.base64[0, 8] # Random password from the Base64 character set | ||
|
||
password = SecureRandom.base64[0, 8] # Random password from the Base64 character set | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @martinpovolny on this removal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Fryguy : the removal originates in our previous discussion about this |
||
host_port = host.reserve_next_available_vnc_port | ||
|
||
# Determine if any Vms on this Host already have this port, and if so, disable them | ||
|
@@ -101,6 +86,16 @@ def remote_console_vnc_acquire_ticket(proxy_miq_server = nil) | |
end | ||
update_attributes(:vnc_port => host_port) | ||
|
||
return password, host_address, host_port, proxy_address, proxy_port | ||
SystemConsole.where(:vm_id => id).each(&:destroy) | ||
SystemConsole.create!( | ||
:user => User.find_by(:userid => userid), | ||
:vm_id => id, | ||
:host_name => host.address, | ||
:port => host_port, | ||
:ssl => false, | ||
:protocol => 'vnc', | ||
:secret => password, | ||
:url_secret => SecureRandom.hex | ||
).connection_params | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you call queue_object_action in the api controller code, does it go here or directly to the remote_console_acquire_ticket method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martinpovolny that's a question to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fryguy : yes, that's my understanding. See
app/controllers/api_controller/action.rb