Skip to content

Commit 30969d0

Browse files
committed
controller: cinder basic setup
1 parent 58e92b7 commit 30969d0

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

modules/controller/keystone.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ let
3939
catalog.RegionOne.placement.adminURL = http://controller:8778
4040
catalog.RegionOne.placement.internalURL = http://controller:8778
4141
catalog.RegionOne.placement.name = Placement Service
42+
43+
catalog.RegionOne.volumev3.publicURL = http://controller:8776/v3
44+
catalog.RegionOne.volumev3.adminURL = http://controller:8776/v3
45+
catalog.RegionOne.volumev3.internalURL = http://controller:8776/v3
46+
catalog.RegionOne.volumev3.name = Cinder Service
4247
'';
4348

4449
keystoneConf = pkgs.writeText "keystone.conf" ''

modules/controller/openstack-controller.nix

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
glance,
66
placement,
77
horizon,
8+
cinder,
89
}:
910
{
1011
config,
@@ -32,6 +33,8 @@ in
3233
(import ./nova.nix { inherit nova; })
3334
(import ./neutron.nix { inherit neutron; })
3435
(import ./horizon.nix { inherit horizon; })
36+
(import ./cinder.nix { inherit cinder; })
37+
(import ../storage/cinder-storage-node.nix { inherit cinder; })
3538
];
3639

3740
config = {
@@ -60,6 +63,12 @@ in
6063
mysql -N -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';"
6164
mysql -N -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance';"
6265
66+
# Cinder
67+
mysql -N -e "drop database cinder;" || true
68+
mysql -N -e "create database cinder;" || true
69+
mysql -N -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'cinder';"
70+
mysql -N -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinder';"
71+
6372
# Placement
6473
mysql -N -e "drop database placement;" || true
6574
mysql -N -e "create database placement;" || true
@@ -146,6 +155,29 @@ in
146155
};
147156
};
148157

158+
systemd.services.cinder = {
159+
description = "OpenStack Cinder setup";
160+
after = [ "keystone-all.service" ];
161+
wantedBy = [ "multi-user.target" ];
162+
environment = adminEnv;
163+
path = [
164+
pkgs.openstackclient
165+
cinder
166+
];
167+
serviceConfig = {
168+
Type = "oneshot";
169+
User = "cinder";
170+
Group = "cinder";
171+
ExecStart = pkgs.writeShellScript "cinder.sh" ''
172+
set -euxo pipefail
173+
openstack user create --domain default --password cinder cinder || true
174+
openstack role add --project service --user cinder admin || true
175+
openstack role add --user cinder --user-domain default --system all reader || true
176+
cinder-manage --config-file ${config.cinder.config} db sync
177+
'';
178+
};
179+
};
180+
149181
# Placement service can be tested by executing
150182
# curl http://controller:8778
151183
# and receive some json with version info as result.

modules/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
keystone
88
glance
99
horizon
10+
cinder
1011
;
1112
placement = openstackPkgs.openstack-placement;
1213
};

0 commit comments

Comments
 (0)