summaryrefslogtreecommitdiffstats
path: root/nixos/tests/ceph-multi-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-multi-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-multi-node.nix')
-rw-r--r--nixos/tests/ceph-multi-node.nix15
1 files changed, 3 insertions, 12 deletions
diff --git a/nixos/tests/ceph-multi-node.nix b/nixos/tests/ceph-multi-node.nix
index 13d0851366eb..c34b134de531 100644
--- a/nixos/tests/ceph-multi-node.nix
+++ b/nixos/tests/ceph-multi-node.nix
@@ -114,18 +114,6 @@ let
$osd0->waitForUnit("network.target");
$osd1->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}",
- );
- $osd0->mustSucceed(
- "mkdir -p /var/lib/ceph/osd/ceph-${cfg.osd0.name}",
- );
- $osd1->mustSucceed(
- "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 *'",
@@ -133,6 +121,7 @@ let
"sudo -u ceph ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/ceph.client.admin.keyring",
"monmaptool --create --add ${cfg.monA.name} ${cfg.monA.ip} --fsid ${cfg.clusterId} /tmp/monmap",
"sudo -u ceph ceph-mon --mkfs -i ${cfg.monA.name} --monmap /tmp/monmap --keyring /tmp/ceph.mon.keyring",
+ "sudo -u ceph mkdir -p /var/lib/ceph/mgr/ceph-${cfg.monA.name}/",
"sudo -u ceph touch /var/lib/ceph/mon/ceph-${cfg.monA.name}/done",
"systemctl start ceph-mon-${cfg.monA.name}"
);
@@ -159,12 +148,14 @@ let
# Bootstrap both OSDs
$osd0->mustSucceed(
"mkfs.xfs /dev/vdb",
+ "mkdir -p /var/lib/ceph/osd/ceph-${cfg.osd0.name}",
"mount /dev/vdb /var/lib/ceph/osd/ceph-${cfg.osd0.name}",
"ceph-authtool --create-keyring /var/lib/ceph/osd/ceph-${cfg.osd0.name}/keyring --name osd.${cfg.osd0.name} --add-key ${cfg.osd0.key}",
"echo '{\"cephx_secret\": \"${cfg.osd0.key}\"}' | ceph osd new ${cfg.osd0.uuid} -i -",
);
$osd1->mustSucceed(
"mkfs.xfs /dev/vdb",
+ "mkdir -p /var/lib/ceph/osd/ceph-${cfg.osd1.name}",
"mount /dev/vdb /var/lib/ceph/osd/ceph-${cfg.osd1.name}",
"ceph-authtool --create-keyring /var/lib/ceph/osd/ceph-${cfg.osd1.name}/keyring --name osd.${cfg.osd1.name} --add-key ${cfg.osd1.key}",
"echo '{\"cephx_secret\": \"${cfg.osd1.key}\"}' | ceph osd new ${cfg.osd1.uuid} -i -"