Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ nix build .#tests.x86_64-linux.<test-name>.driverInteractive
./result/bin/nixos-test-driver
```

#### Dashboard access

The NixOS tests configure some port forwarding in order to allow access to the
OpenStack dashboard. The port forwarding can be configured via
`openstack-testing.dashboardHostPort` and the default host port used is `8080`.
While a NixOS test is running, the dashboard can be accessed via
`127.0.0.1:8080` or the configured host port.

## Scope

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.
Expand Down
5 changes: 5 additions & 0 deletions modules/compute/nova.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ let
username = nova
password = nova

[serial_console]
enabled = true
serialproxy_host = 0.0.0.0
proxyclient_address = $my_ip

[vnc]
enabled = true
server_listen = 0.0.0.0
Expand Down
28 changes: 28 additions & 0 deletions modules/controller/nova.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ let
username = nova
password = nova

[serial_console]
enabled = true

[vnc]
enabled = true
server_listen = $my_ip
Expand Down Expand Up @@ -299,5 +302,30 @@ in
TimeoutStopSec = 15;
};
};

systemd.services.nova-serialproxy = {
description = "OpenStack Nova serial proxy";
after = [
"nova.service"
"mysql.service"
"keystone.service"
"rabbitmq.service"
"network-online.target"
];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
path = [ cfg.novaPackage ];
serviceConfig = {
User = "nova";
Group = "nova";
Type = "simple";
ExecStart = pkgs.writeShellScript "nova-serialproxy.sh" ''
nova-serialproxy --config-file ${cfg.config}
'';
Restart = "on-failure";
LimitNOFILE = 65535;
TimeoutStopSec = 15;
};
};
};
}
51 changes: 50 additions & 1 deletion modules/testing/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,52 @@ let
environment.variables = adminEnv;
};
};

portForwarding =
{ config, lib, ... }:
with lib;
let
cfg = config.openstack-testing;
in
{
options.openstack-testing = {
enable = mkEnableOption "Enable port forwarding." // {
default = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do we do this elswhere? If not, I'd prefer to have a enable = true; somewhere

};
dashboardHostPort = mkOption {
default = 8080;
type = types.port;
description = ''
Host port to make the OpenStack dashboard accessible when running
the OpenStack controller in a VM. Dashboard can be accessed via:
localhost:<dashboardHostPort>
'';
};
serialProxyHostPort = mkOption {
default = 6083;
type = types.port;
description = ''
Host port to make the web console feature available for the
OpenStack dashboard. Changing the value might requires to change
the configuration of the dashboard.
'';
};
};
config = mkIf cfg.enable {
virtualisation.forwardPorts = [
{
from = "host";
host.port = cfg.dashboardHostPort;
guest.port = 80;
}
{
from = "host";
host.port = cfg.serialProxyHostPort;
guest.port = 6083;
}
];
};
};
in
{
testController =
Expand All @@ -49,7 +95,10 @@ in
};
in
{
imports = [ common ];
imports = [
common
portForwarding
];

virtualisation = {
cores = 4;
Expand Down