Skip to content

nixos/ceph: Add a service module that enables the configuration of ceph through nixos - #35299

Merged
Mic92 merged 8 commits into
NixOS:masterfrom
lejonet:ceph
Mar 1, 2018
Merged

Mic92 merged 8 commits into
NixOS:masterfrom
lejonet:ceph

Conversation

@lejonet

@lejonet lejonet commented Feb 21, 2018 •

Copy link
Copy Markdown
Contributor

All 5 daemon types can be enabled and configured through the module and the module both creates tho ceph.conf required but also creates and enables specific services for each daemon, based on the systemd service files that upstream provides.

Motivation for this change

In addition to the ceph package being broken, there isn't any module to configure a ceph cluster through nixos, which I'm aiming to fix.
I've successfully setup and am running a ceph cluster, on nixos, configured soley through this module.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

…ph through nixos

All 5 daemon types can be enabled and configured through the module and the module both creates tho ceph.conf required
but also creates and enables specific services for each daemon, based on the systemd service files that upstream
provides.
@GrahamcOfBorg GrahamcOfBorg added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Feb 21, 2018
@lejonet

lejonet commented Feb 26, 2018

Copy link
Copy Markdown
Contributor Author

@Mic92 I've now added a testcase, as requested

@grahamc

grahamc commented Feb 26, 2018 •

Copy link
Copy Markdown
Member

Comment thread nixos/tests/ceph.nix Outdated
@@ -0,0 +1,147 @@
{ system ? builtins.currentSystem }:

with import ../lib/testing.nix { inherit system; };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added myself to the maintainers list, at L145, I should probably restructure the test after that mesos test, I just did it this way because I used networking.nix as a template.

[ "0" "1" ];
'';
description = ''
A list of rados gateway daemons that should have a service created.

@grahamc grahamc Feb 26, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A very minor nit is that "should have a service created" sounds imperative. Instead, these are describing not what should happen but what services will exist, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually had a hard time wording that and just decided to write something at the time and continue with the rest of the module, honestly.

I'm open to suggestions of better wording, the wording isn't just imperative, it sounds wonky.

@lejonet

lejonet commented Feb 26, 2018

Copy link
Copy Markdown
Contributor Author

@grahamc Test added to the main list in release.nix: 4f91fc4

@lejonet

lejonet commented Feb 28, 2018

Copy link
Copy Markdown
Contributor Author

@Mic92 I've now restructured the test to the structure of the mesos test with commit cc84fe5

@Mic92

Mic92 commented Mar 1, 2018

Copy link
Copy Markdown
Member

@GrahamcOfBorg test ceph

@GrahamcOfBorg

Copy link
Copy Markdown

Failure on x86_64-linux (full log)

Partial log (click to expand)

error: while evaluating anonymous function at /var/lib/gc-of-borg/.nix-test-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/ogden/nixos/release.nix:19:72, called from /var/lib/gc-of-borg/.nix-test-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/ogden/lib/attrsets.nix:282:43:
while evaluating ‘hydraJob’ at /var/lib/gc-of-borg/.nix-test-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/ogden/lib/customisation.nix:168:14, called from /var/lib/gc-of-borg/.nix-test-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/ogden/nixos/release.nix:19:80:
while evaluating the attribute ‘meta’ at /var/lib/gc-of-borg/.nix-test-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/ogden/lib/customisation.nix:173:24:
while evaluating the attribute ‘maintainers’ at /var/lib/gc-of-borg/.nix-test-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/ogden/nixos/tests/ceph.nix:4:5:
undefined variable ‘lejonet’ at /var/lib/gc-of-borg/.nix-test-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/ogden/nixos/tests/ceph.nix:4:21

@GrahamcOfBorg

Copy link
Copy Markdown

Success on aarch64-linux (full log)

Partial log (click to expand)

@Mic92

Mic92 commented Mar 1, 2018

Copy link
Copy Markdown
Member

Now ceph should be built already.

Comment thread nixos/tests/ceph.nix
import ./make-test.nix ({pkgs, ...}: rec {
name = "All-in-one-basic-ceph-cluster";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ lejonet ];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in the name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatcha mean?

@Mic92 Mic92 Mar 1, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That handle (lejonet) does not exists in lib/maintainers.nix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: 29e78ce

LimitNOFILE = 1048576;
LimitNPROC = 1048576;
Environment = "CLUSTER=${clusterName}";
ExecReload = "/bin/kill -HUP $MAINPID";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be ${coreutils}/bin/kill -HUP $MAINPID

@Mic92
Mic92 merged commit 565f22d into NixOS:master Mar 1, 2018
@grahamc

grahamc commented Mar 1, 2018

Copy link
Copy Markdown
Member

Did we ever verify that the test passed?

@Mic92

Mic92 commented Mar 1, 2018

Copy link
Copy Markdown
Member

@grahamc I only executed them locally.

@Mic92

Mic92 commented Mar 1, 2018

Copy link
Copy Markdown
Member

@grahamc the build bot would have had a timeout because ceph was not yet build. I tested it on a slightly older head (older in hours).

@nh2

nh2 commented Aug 8, 2024

Copy link
Copy Markdown
Contributor
    $aio->mustFail(
      "ceph osd pool ls | grep 'aio-test'",
      "ceph osd pool delete aio-other-test aio-other-test --yes-i-really-really-mean-it"

@lejonet Why do we expect that the above two commands fail?

In #330226 it fails with

monA # Error EPERM: pool deletion is disabled; you must first set the mon_allow_pool_delete config option to true before you can destroy a pool

but I'm not sure that's what you wanted to test.

@nh2 nh2 mentioned this pull request Aug 8, 2024
3 of 13 tasks
@lejonet

lejonet commented Aug 8, 2024

Copy link
Copy Markdown
Contributor Author
    $aio->mustFail(
      "ceph osd pool ls | grep 'aio-test'",
      "ceph osd pool delete aio-other-test aio-other-test --yes-i-really-really-mean-it"

@lejonet Why do we expect that the above two commands fail?

In #330226 it fails with

monA # Error EPERM: pool deletion is disabled; you must first set the mon_allow_pool_delete config option to true before you can destroy a pool

but I'm not sure that's what you wanted to test.

The reason why those two commands were expected to fail was 1. The aio-test pool was renamed to aio-other-test and thus there shouldn't be a aio-test anymore and 2. To verify that you can't remove a pool.

It can definitively be argued that this test doesn't need to test that, as that is pure ceph functionality and hopefully the ceph team has done those tests but for the sake of completeness I threw them into the test both because it goes quick to run those commands and we can then be sure that ceph functions as intended.

@nh2

nh2 commented Aug 8, 2024

Copy link
Copy Markdown
Contributor

@lejonet Ah OK, then it looks correct. It just not clear without comment whether pool deletion should fail because of mon_allow_pool_delete (I wasn't sure if that safeguard already existed when the test was written).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants