summaryrefslogtreecommitdiffstats
path: root/nixos/tests/ceph-single-node.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2019-11-02 15:01:39 +0100
committerFlorian Klink <flokli@flokli.de>2019-11-09 16:02:53 +0100
commit67e0777f6258ded0029bbfeec65fbedf36d6d4c8 (patch)
tree860691a2146e37864ed774a4849ffd822c6999dd /nixos/tests/ceph-single-node.nix
parent64c9c083028671f6c0f3a67446932e45984e2d87 (diff)
nixos/ceph: run unprivileged, use StateDirectory and tmpfiles, don't pass extraServiceConfig
Don't pass user and group to ceph, and rely on it to drop ceps, but let systemd handle running it as the appropriate user. This also inlines the extraServiceConfig into the makeService function, as we have conditionals depending on daemonType there anyways. Use StateDirectory to create directories in /var/lib/ceph/${daemonType}/${clusterName}-${daemonId}. There previously was a condition on daemonType being one of mds,mon,rgw or mgr. We only instantiate makeServices with these types, and "osd" was special. In the osd case, test examples suggest it'd be in something like /var/lib/ceph/osd/ceph-${cfg.osd0.name} - so it's not special at all, but exactly like the pattern for the others. During initialization, we also need these folders, before the unit is started up. Move the mkdir -p commands in the vm tests to the line immediately before they're required.
Diffstat (limited to 'nixos/tests/ceph-single-node.nix')
-rw-r--r--nixos/tests/ceph-single-node.nix13
1 files changed, 4 insertions, 9 deletions
diff --git a/nixos/tests/ceph-single-node.nix b/nixos/tests/ceph-single-node.nix
index cb37b4b43bcd..5938300ebb4a 100644
--- a/nixos/tests/ceph-single-node.nix
+++ b/nixos/tests/ceph-single-node.nix
@@ -77,14 +77,6 @@ let
$monA->waitForUnit("network.target");
- # Create the ceph-related directories
- $monA->mustSucceed(
- "mkdir -p /var/lib/ceph/mgr/ceph-${cfg.monA.name}",
- "mkdir -p /var/lib/ceph/mon/ceph-${cfg.monA.name}",
- "mkdir -p /var/lib/ceph/osd/ceph-${cfg.osd0.name}",
- "mkdir -p /var/lib/ceph/osd/ceph-${cfg.osd1.name}",
- );
-
# Bootstrap ceph-mon daemon
$monA->mustSucceed(
"sudo -u ceph ceph-authtool --create-keyring /tmp/ceph.mon.keyring --gen-key -n mon. --cap mon 'allow *'",
@@ -101,8 +93,9 @@ let
# Can't check ceph status until a mon is up
$monA->succeed("ceph -s | grep 'mon: 1 daemons'");
- # Start the ceph-mgr daemon, it has no deps and hardly any setup
+ # Start the ceph-mgr daemon, after copying in the keyring
$monA->mustSucceed(
+ "sudo -u ceph mkdir -p /var/lib/ceph/mgr/ceph-${cfg.monA.name}/",
"ceph auth get-or-create mgr.${cfg.monA.name} mon 'allow profile mgr' osd 'allow *' mds 'allow *' > /var/lib/ceph/mgr/ceph-${cfg.monA.name}/keyring",
"systemctl start ceph-mgr-${cfg.monA.name}"
);
@@ -114,7 +107,9 @@ let
$monA->mustSucceed(
"mkfs.xfs /dev/vdb",
"mkfs.xfs /dev/vdc",
+ "mkdir -p /var/lib/ceph/osd/ceph-${cfg.osd0.name}",
"mount /dev/vdb /var/lib/ceph/osd/ceph-${cfg.osd0.name}",
+ "mkdir -p /var/lib/ceph/osd/ceph-${cfg.osd1.name}",
"mount /dev/vdc /var/lib/ceph/osd/ceph-${cfg.osd1.name}",
"ceph-authtool --create-keyring /var/lib/ceph/osd/ceph-${cfg.osd0.name}/keyring --name osd.${cfg.osd0.name} --add-key ${cfg.osd0.key}",
"ceph-authtool --create-keyring /var/lib/ceph/osd/ceph-${cfg.osd1.name}/keyring --name osd.${cfg.osd1.name} --add-key ${cfg.osd1.key}",