Skip to content

Commit b6963da

Browse files
authored
Merge pull request #17 from cobaltcore-dev/serial-proxy
Horizon dashboard and web serial console
2 parents d4b10a8 + 277cac4 commit b6963da

4 files changed

Lines changed: 91 additions & 1 deletion

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ nix build .#tests.x86_64-linux.<test-name>.driverInteractive
7979
./result/bin/nixos-test-driver
8080
```
8181

82+
#### Dashboard access
83+
84+
The NixOS tests configure some port forwarding in order to allow access to the
85+
OpenStack dashboard. The port forwarding can be configured via
86+
`openstack-testing.dashboardHostPort` and the default host port used is `8080`.
87+
While a NixOS test is running, the dashboard can be accessed via
88+
`127.0.0.1:8080` or the configured host port.
89+
8290
## Scope
8391

8492
OpenStack is a very large and super actively maintained project. We are aware that we cannot keep track of all its development or offer every single configuration option via NixOS modules.

modules/compute/nova.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ let
9191
username = nova
9292
password = nova
9393
94+
[serial_console]
95+
enabled = true
96+
serialproxy_host = 0.0.0.0
97+
proxyclient_address = $my_ip
98+
9499
[vnc]
95100
enabled = true
96101
server_listen = 0.0.0.0

modules/controller/nova.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ let
5050
username = nova
5151
password = nova
5252
53+
[serial_console]
54+
enabled = true
55+
5356
[vnc]
5457
enabled = true
5558
server_listen = $my_ip
@@ -299,5 +302,30 @@ in
299302
TimeoutStopSec = 15;
300303
};
301304
};
305+
306+
systemd.services.nova-serialproxy = {
307+
description = "OpenStack Nova serial proxy";
308+
after = [
309+
"nova.service"
310+
"mysql.service"
311+
"keystone.service"
312+
"rabbitmq.service"
313+
"network-online.target"
314+
];
315+
wants = [ "network-online.target" ];
316+
wantedBy = [ "multi-user.target" ];
317+
path = [ cfg.novaPackage ];
318+
serviceConfig = {
319+
User = "nova";
320+
Group = "nova";
321+
Type = "simple";
322+
ExecStart = pkgs.writeShellScript "nova-serialproxy.sh" ''
323+
nova-serialproxy --config-file ${cfg.config}
324+
'';
325+
Restart = "on-failure";
326+
LimitNOFILE = 65535;
327+
TimeoutStopSec = 15;
328+
};
329+
};
302330
};
303331
}

modules/testing/default.nix

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,52 @@ let
3838
environment.variables = adminEnv;
3939
};
4040
};
41+
42+
portForwarding =
43+
{ config, lib, ... }:
44+
with lib;
45+
let
46+
cfg = config.openstack-testing;
47+
in
48+
{
49+
options.openstack-testing = {
50+
enable = mkEnableOption "Enable port forwarding." // {
51+
default = true;
52+
};
53+
dashboardHostPort = mkOption {
54+
default = 8080;
55+
type = types.port;
56+
description = ''
57+
Host port to make the OpenStack dashboard accessible when running
58+
the OpenStack controller in a VM. Dashboard can be accessed via:
59+
localhost:<dashboardHostPort>
60+
'';
61+
};
62+
serialProxyHostPort = mkOption {
63+
default = 6083;
64+
type = types.port;
65+
description = ''
66+
Host port to make the web console feature available for the
67+
OpenStack dashboard. Changing the value might requires to change
68+
the configuration of the dashboard.
69+
'';
70+
};
71+
};
72+
config = mkIf cfg.enable {
73+
virtualisation.forwardPorts = [
74+
{
75+
from = "host";
76+
host.port = cfg.dashboardHostPort;
77+
guest.port = 80;
78+
}
79+
{
80+
from = "host";
81+
host.port = cfg.serialProxyHostPort;
82+
guest.port = 6083;
83+
}
84+
];
85+
};
86+
};
4187
in
4288
{
4389
testController =
@@ -49,7 +95,10 @@ in
4995
};
5096
in
5197
{
52-
imports = [ common ];
98+
imports = [
99+
common
100+
portForwarding
101+
];
53102

54103
virtualisation = {
55104
cores = 4;

0 commit comments

Comments
 (0)