Skip to main content
Version: 8.0

Relay and Agent

Two small services carry a server's serial console, and its VNC display once you have moved VNC to the relay:

  • The relay runs on the control server, behind its web server. Browsers reach it on the same address and port as the user interface.
  • The agent runs on each hypervisor. Only the control server's relay connects to it.

A browser never reaches a hypervisor. It talks to the control server, the relay there talks to the agent on the right hypervisor, and the agent connects to the server on the hypervisor itself.

Installing the relay​

The agent is installed when a hypervisor is added, and installed and kept up to date by the normal hypervisor update. There is nothing to do on a hypervisor.

The relay needs one update of the control server run as root, because an update started from the user interface does not have the rights to install a service:

vfcli-ctrl update --mgmt-only

A control server on another release channel uses that channel's update command. The notice on the admin dashboard shows the right one.

Until that has been done, the admin dashboard shows a notice saying the relay is not installed. After it, the relay keeps itself up to date: when an update brings a newer relay, the running one takes it over within about half a minute, and sessions that are open carry on.

A customised web server configuration​

The update adds the route to the relay to the control server's web server configuration, /opt/virtfusion/nginx/conf/conf.d/ui.conf. When that file has been changed from the one shipped, the update leaves it alone and says so:

The web server configuration is not the one shipped, so the route to the relay was not added to it

Running the update again does not change this. Add the route yourself, inside the server block that serves the user interface on port 443:

location = /relay {
proxy_pass http://127.0.0.1:8894;
proxy_read_timeout 1900;
proxy_connect_timeout 60;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}

Then check the configuration and reload the web server:

/opt/virtfusion/nginx/sbin/nginx -t
systemctl reload vf-nginx

The serial console, and VNC once moved to the relay, do not work until the route is in place.

Ports​

WherePortWho connects
Control server443Browsers, as for the user interface
Hypervisor8893The control server only

Consoles and VNC use the same address and port as the user interface. No other port needs opening on the control server.

The agent's port​

The agent closes its port on the hypervisor to every address except the control server's. The addresses are the ones in the hypervisor's authentication file, /opt/virtfusion/app/hypervisor/conf/auth.json, and a change to that file is picked up within a few seconds. A port check from anywhere else times out.

Servers on the hypervisor are not affected: a server can use port 8893 itself.

To manage the port with your own firewall, turn this off in /home/vf-data/conf/hv/agent.json on the hypervisor. Create the file if it does not exist:

{
"firewall": false
}

Then restart the agent, which closes the sessions open on that hypervisor:

systemctl restart vf-agent

The Agent card​

Each hypervisor's page has an Agent section:

  • Status shows whether the agent answers, and its version. Check asks it again. When the agent cannot be reached, Install puts it on the hypervisor and starts it.
  • Certificate shows the fingerprint of the agent's certificate. A changed certificate is picked up by itself. If the agent is refused after a hypervisor has been reinstalled, press Re-record.

Sessions​

A session is opened for one server and one user. It is closed when that user's access is removed, or after 30 minutes without activity.

Status, logs and restarting​

On the control server:

systemctl status vf-relay
journalctl -u vf-relay -f

On a hypervisor:

systemctl status vf-agent
journalctl -u vf-agent -f

Each session writes a line when it opens and when it ends. On a hypervisor the line names the server, who opened it, and what the agent connected to.

Neither service normally needs restarting. systemctl restart closes every open session, and so does restarting the control server's web server (vf-nginx). An update does not.

Debug report​

When something does not work on one hypervisor, this prints what its agent reports about itself, beside what the control server knows, as JSON:

vfcli-ctrl agent:debug 24

24 is the hypervisor's ID. The report has two parts:

  • control: the address the agent is reached at, whether the agent and the relay answer, and how far apart the two clocks are. A hypervisor whose clock is wrong by more than a couple of minutes cannot open sessions.
  • agent: the agent's version, the hypervisor's system, which control server addresses it accepts, and each running server with its console and its VNC display.

To look at one server only, give its ID or UUID:

vfcli-ctrl agent:debug 24 --server=1008

The report holds no password and no token, so it can be attached to a support ticket.