|
5 | 5 | glance, |
6 | 6 | placement, |
7 | 7 | horizon, |
| 8 | + cinder, |
8 | 9 | }: |
9 | 10 | { |
10 | 11 | config, |
|
32 | 33 | (import ./nova.nix { inherit nova; }) |
33 | 34 | (import ./neutron.nix { inherit neutron; }) |
34 | 35 | (import ./horizon.nix { inherit horizon; }) |
| 36 | + (import ./cinder.nix { inherit cinder; }) |
| 37 | + (import ../storage/cinder-storage-node.nix { inherit cinder; }) |
35 | 38 | ]; |
36 | 39 |
|
37 | 40 | config = { |
|
60 | 63 | mysql -N -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';" |
61 | 64 | mysql -N -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance';" |
62 | 65 |
|
| 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 | +
|
63 | 72 | # Placement |
64 | 73 | mysql -N -e "drop database placement;" || true |
65 | 74 | mysql -N -e "create database placement;" || true |
|
146 | 155 | }; |
147 | 156 | }; |
148 | 157 |
|
| 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 | + |
149 | 181 | # Placement service can be tested by executing |
150 | 182 | # curl http://controller:8778 |
151 | 183 | # and receive some json with version info as result. |
|
0 commit comments