Skip to content

Commit 26b2836

Browse files
committed
XXX: cinder disk encryption works
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de> On-behalf-of: SAP stefan.kober@sap.com
1 parent e8d2f3b commit 26b2836

8 files changed

Lines changed: 94 additions & 2 deletions

File tree

flake.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
url = "github:cachix/pre-commit-hooks.nix";
88
inputs.nixpkgs.follows = "nixpkgs";
99
};
10+
nova-src = {
11+
url = "git+file:/home/skober/repos/nova";
12+
# url = "git+ssh://git@gitlab.cyberus-technology.de/cyberus/cloud/openstack-nova.git";
13+
# url = "git+https://github.com/sapcc/nova?ref=stable/2023.2-m3";
14+
flake = false;
15+
};
16+
1017
};
1118

1219
outputs =
@@ -15,13 +22,30 @@
1522
nixpkgs,
1623
flake-utils,
1724
pre-commit-hooks-nix,
25+
nova-src,
1826
...
1927
}:
2028
flake-utils.lib.eachSystem [ "x86_64-linux" ] (
2129
system:
2230
let
2331
pkgs = import nixpkgs { inherit system; };
2432
pre-commit-hooks-run = pre-commit-hooks-nix.lib.${system}.run;
33+
# The PBR setup does not work on the plain source code because no
34+
# package version can be determined.
35+
# We add a PKG-INFO file with the missing information to make it work.
36+
# We use the version info of the original Nova package from
37+
# openstack-nix.
38+
fixedNovaSrc = pkgs.runCommand "add-package-info" { } ''
39+
mkdir -p $out
40+
41+
cp -r ${nova-src}/. $out
42+
43+
cat >$out/PKG-INFO <<EOL
44+
Metadata-Version: 2.1
45+
Name: nova
46+
Version: 30.0.0
47+
EOL
48+
'';
2549
in
2650
rec {
2751
formatter = pkgs.nixfmt-rfc-style;
@@ -45,13 +69,21 @@
4569
};
4670

4771
packages = import ./packages { inherit (pkgs) callPackage python3Packages; };
72+
novaPkg = packages.nova.overrideAttrs (_: {
73+
src = fixedNovaSrc;
74+
doInstallCheck = false;
75+
});
76+
77+
packages2 = packages // {
78+
nova = novaPkg;
79+
};
4880

4981
checks = import ./checks { inherit pkgs pre-commit-hooks-run; };
5082

5183
nixosModules = import ./modules { openstackPkgs = packages; };
5284

5385
tests = import ./tests/default.nix {
54-
inherit pkgs nixosModules;
86+
inherit pkgs nixosModules novaPkg;
5587
inherit (lib) generateRootwrapConf;
5688
};
5789
}

modules/compute/nova.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ let
2727
compute_driver = libvirt.LibvirtDriver
2828
my_ip = 10.0.0.39
2929
transport_url = rabbit://openstack:openstack@controller
30+
debug = true
3031
3132
[api]
3233
auth_strategy = keystone
@@ -53,6 +54,9 @@ let
5354
5455
[libvirt]
5556
virt_type = kvm
57+
images_type = default
58+
images_format = raw
59+
force_raw_images = true
5660
5761
[neutron]
5862
auth_url = http://controller:5000
@@ -201,6 +205,7 @@ in
201205
environment.systemPackages = with pkgs; [
202206
openiscsi
203207
nfs-utils
208+
cryptsetup
204209
];
205210

206211
systemd.services.nova-compute = {
@@ -220,6 +225,7 @@ in
220225
lvm2
221226
openiscsi
222227
nfs-utils
228+
cryptsetup
223229
]
224230
++ cfg.extraPkgs;
225231
environment.PYTHONPATH = "${nova_env}/${pkgs.python3.sitePackages}";

modules/controller/cinder.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ let
1717
auth_strategy = keystone
1818
my_ip = controller
1919
verify_glance_signatures = disabled
20+
image_conversion_disable = false
21+
volume_format = raw
2022
2123
[database]
2224
connection = mysql+pymysql://cinder:cinder@controller/cinder
@@ -31,9 +33,14 @@ let
3133
project_name = service
3234
username = cinder
3335
password = cinder
36+
service_token_roles_required = true
37+
service_token_roles = admin
3438
3539
[oslo_concurrency]
3640
lock_path = /var/lib/cinder/tmp
41+
42+
[key_manager]
43+
backend = barbican
3744
'';
3845
in
3946
{
@@ -94,6 +101,11 @@ in
94101
argument = "${cinder}/etc/cinder/api-paste.ini";
95102
};
96103
};
104+
"/etc/cinder/resource_filters.json" = {
105+
L = {
106+
argument = "${cinder}/etc/cinder/resource_filters.json";
107+
};
108+
};
97109
"/etc/cinder/cinder.conf" = {
98110
L = {
99111
argument = "${cinderConf}";

modules/storage/cinder-storage-node.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ let
8989
rootwrap_config = ${rootwrapConf}
9090
glance_api_servers = http://controller:9292
9191
verify_glance_signatures = disabled
92+
image_conversion_disable = false
9293
log_dir = /var/log/cinder
94+
volume_format = raw
9395
9496
[database]
9597
connection = mysql+pymysql://cinder:cinder@controller/cinder
@@ -104,6 +106,8 @@ let
104106
project_name = service
105107
username = cinder
106108
password = cinder
109+
service_token_roles_required = true
110+
service_token_roles = admin
107111
108112
[oslo_concurrency]
109113
lock_path = /var/lib/cinder/tmp
@@ -112,6 +116,10 @@ let
112116
volume_driver = cinder.volume.drivers.nfs.NfsDriver
113117
nfs_shares_config = /etc/cinder/nfs_shares
114118
nfs_mount_options = vers=3
119+
volume_backend_name = NFS
120+
volume_format = raw
121+
nfs_sparsed_volumes = false
122+
nfs_qcow2_volumes = false
115123
'';
116124

117125
cinderTgtConf = pkgs.writeText "cinder.conf" ''

packages/nova.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ let
7777
pyyaml
7878
requests
7979
requests-mock
80+
requests-unixsocket
8081
retrying
8182
rfc3986
8283
routes
@@ -125,6 +126,7 @@ python3Packages.buildPythonPackage (rec {
125126
lxml
126127
microversion-parse
127128
netaddr
129+
requests-unixsocket
128130
netifaces
129131
openstacksdk
130132
os-brick

tests/default.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
pkgs,
33
nixosModules,
44
generateRootwrapConf,
5+
novaPkg,
56
}:
67
let
78
tests = {
8-
openstack-default-setup = pkgs.callPackage ./openstack-default-setup.nix { inherit nixosModules; };
9+
openstack-default-setup = pkgs.callPackage ./openstack-default-setup.nix {
10+
inherit nixosModules novaPkg;
11+
};
912
openstack-live-migration = pkgs.callPackage ./openstack-live-migration.nix {
1013
inherit nixosModules generateRootwrapConf;
1114
};

tests/openstack-default-setup.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
pkgs,
33
nixosModules,
4+
novaPkg,
45
}:
56
pkgs.nixosTest {
67
name = "OpenStack default setup test";
@@ -11,6 +12,12 @@ pkgs.nixosTest {
1112
imports = [
1213
nixosModules.controllerModule
1314
nixosModules.testModules.testController
15+
(
16+
{ ... }:
17+
{
18+
config.nova.novaPackage = novaPkg;
19+
}
20+
)
1421
];
1522
};
1623

@@ -20,6 +27,12 @@ pkgs.nixosTest {
2027
imports = [
2128
nixosModules.computeModule
2229
nixosModules.testModules.testCompute
30+
(
31+
{ ... }:
32+
{
33+
config.nova.novaPackage = novaPkg;
34+
}
35+
)
2336
];
2437
};
2538

0 commit comments

Comments
 (0)