Feature #13887
openConfigure noVNC ports via web interface
Description
I maintain instructional VMware VMs for a systems admin class (27 students run 4 VMs each). The class takes place in an Ubuntu 14.04 lab and ever since VMWare dropped their VMware Remote Console support for Linux, students connect through Foreman. That gives them convenient power controls and a console. The problem is as students connect to their 100+ VMs at once, websockify quickly runs out of available ports and the web GUI returns a variety of errors, primarily:
Failed to set console: execution expired
I can replicate the problem myself when I open a tab to each VM in my browser. After about 9 simultaneous console connections, the error starts appearing on subsequent tabs.
To fix this, I made these changes:
/usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb -
def unused_vnc_port(ip) #10.times do # port = 5901 + rand(64) 50.times do port = 47000 + rand(2000) unused = (TCPSocket.connect(ip, port).close rescue true) return port if unused end raise "no unused port found" end
and /usr/share/foreman/lib/ws_proxy.rb -
# Allowed ports to communicate with our web sockets proxy #PORTS = 5910..5930 PORTS = 37000..39000
After making those changes and updating the network and hypervisor firewalls, I was able to open 89 simultaneous tabs running separate consoles. The hypervisors are VMware ESXi 5.1.0 and the VMs run a mix of Ubuntu 14.04, Windows 7 and Windows 2012. The Foreman server runs Ubuntu 14.04 with Foreman 1.10.2-1 via Apache/Passenger.
My feature request is to allow both port ranges to be modified and expanded in the web GUI settings menu rather than editing the code directly. I currently have a dpkg hold on 10 Foreman-related Ubuntu packages to prevent them from updating and breaking my changes.