summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2019-11-02 15:15:33 +0100
committerFlorian Klink <flokli@flokli.de>2019-11-09 15:27:45 +0100
commit64c9c083028671f6c0f3a67446932e45984e2d87 (patch)
treeeccd3bc8675b0b9185b50272ba337bc85f95e5aa
parent8e639f142f61fd4643acd27ae3be527ba4039a62 (diff)
downloadnixpkgs-64c9c083028671f6c0f3a67446932e45984e2d87.tar
nixpkgs-64c9c083028671f6c0f3a67446932e45984e2d87.tar.gz
nixpkgs-64c9c083028671f6c0f3a67446932e45984e2d87.tar.bz2
nixpkgs-64c9c083028671f6c0f3a67446932e45984e2d87.tar.lz
nixpkgs-64c9c083028671f6c0f3a67446932e45984e2d87.tar.xz
nixpkgs-64c9c083028671f6c0f3a67446932e45984e2d87.tar.zst
nixpkgs-64c9c083028671f6c0f3a67446932e45984e2d87.zip
nixos/ceph: create /etc/ceph and /var/lib/ceph via tmpfiles
We seem to be relying on those being present during runtime anyways.
-rw-r--r--nixos/modules/services/network-filesystems/ceph.nix2
-rw-r--r--nixos/tests/ceph-multi-node.nix13
-rw-r--r--nixos/tests/ceph-single-node.nix7
3 files changed, 6 insertions, 16 deletions
diff --git a/nixos/modules/services/network-filesystems/ceph.nix b/nixos/modules/services/network-filesystems/ceph.nix
index 656a2d21b86..887a6ff925d 100644
--- a/nixos/modules/services/network-filesystems/ceph.nix
+++ b/nixos/modules/services/network-filesystems/ceph.nix
@@ -401,7 +401,9 @@ in
         mkMerge targets;
 
     systemd.tmpfiles.rules = [
+      "d /etc/ceph - ceph ceph - -"
       "d /run/ceph 0770 ceph ceph -"
+      "d /var/lib/ceph - ceph ceph - -"
     ];
   };
 }
diff --git a/nixos/tests/ceph-multi-node.nix b/nixos/tests/ceph-multi-node.nix
index 6698aac3f27..13d0851366e 100644
--- a/nixos/tests/ceph-multi-node.nix
+++ b/nixos/tests/ceph-multi-node.nix
@@ -118,21 +118,12 @@ let
     $monA->mustSucceed(
       "mkdir -p /var/lib/ceph/mgr/ceph-${cfg.monA.name}",
       "mkdir -p /var/lib/ceph/mon/ceph-${cfg.monA.name}",
-      "chown ceph:ceph -R /var/lib/ceph/",
-      "mkdir -p /etc/ceph",
-      "chown ceph:ceph -R /etc/ceph"
     );
     $osd0->mustSucceed(
       "mkdir -p /var/lib/ceph/osd/ceph-${cfg.osd0.name}",
-      "chown ceph:ceph -R /var/lib/ceph/",
-      "mkdir -p /etc/ceph",
-      "chown ceph:ceph -R /etc/ceph"
     );
     $osd1->mustSucceed(
       "mkdir -p /var/lib/ceph/osd/ceph-${cfg.osd1.name}",
-      "chown ceph:ceph -R /var/lib/ceph/",
-      "mkdir -p /etc/ceph",
-      "chown ceph:ceph -R /etc/ceph"
     );
 
     # Bootstrap ceph-mon daemon
@@ -216,7 +207,7 @@ let
       "systemctl stop ceph-mgr-${cfg.monA.name}",
       "systemctl stop ceph-mon-${cfg.monA.name}"
     );
-    
+
     $monA->succeed("systemctl start ceph.target");
     $monA->waitForUnit("ceph-mon-${cfg.monA.name}");
     $monA->waitForUnit("ceph-mgr-${cfg.monA.name}");
@@ -224,7 +215,7 @@ let
     $osd0->waitForUnit("ceph-osd-${cfg.osd0.name}");
     $osd1->succeed("systemctl start ceph.target");
     $osd1->waitForUnit("ceph-osd-${cfg.osd1.name}");
-    
+
     $monA->succeed("ceph -s | grep 'mon: 1 daemons'");
     $monA->waitUntilSucceeds("ceph -s | grep 'quorum ${cfg.monA.name}'");
     $monA->waitUntilSucceeds("ceph osd stat | grep -e '2 osds: 2 up[^,]*, 2 in'");
diff --git a/nixos/tests/ceph-single-node.nix b/nixos/tests/ceph-single-node.nix
index 10b77cff5a3..cb37b4b43bc 100644
--- a/nixos/tests/ceph-single-node.nix
+++ b/nixos/tests/ceph-single-node.nix
@@ -83,9 +83,6 @@ let
       "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}",
-      "mkdir -p /etc/ceph",
-      "chown ceph:ceph -R /etc/ceph",
-      "chown ceph:ceph -R /var/lib/ceph/",
     );
 
     # Bootstrap ceph-mon daemon
@@ -166,13 +163,13 @@ let
       "systemctl stop ceph-mgr-${cfg.monA.name}",
       "systemctl stop ceph-mon-${cfg.monA.name}"
     );
-    
+
     $monA->succeed("systemctl start ceph.target");
     $monA->waitForUnit("ceph-mon-${cfg.monA.name}");
     $monA->waitForUnit("ceph-mgr-${cfg.monA.name}");
     $monA->waitForUnit("ceph-osd-${cfg.osd0.name}");
     $monA->waitForUnit("ceph-osd-${cfg.osd1.name}");
-    
+
     $monA->succeed("ceph -s | grep 'mon: 1 daemons'");
     $monA->waitUntilSucceeds("ceph -s | grep 'quorum ${cfg.monA.name}'");
     $monA->waitUntilSucceeds("ceph osd stat | grep -e '2 osds: 2 up[^,]*, 2 in'");