all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Michael Köppl" <m.koeppl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH e2e-tests 26/38] tests: ceph: verify setting up a hyper-converged cluster
Date: Wed,  4 Nov 2026 20:03:33 +0100	[thread overview]
Message-ID: <20261104190345.2573464-27-m.koeppl@proxmox.com> (raw)
In-Reply-To: <20261104190345.2573464-1-m.koeppl@proxmox.com>

Set up Ceph on the main cluster through the API with dedicated
public and cluster networks, as the setup wizard requires a public
network and the documentation recommends separating Ceph traffic.

Check that the configuration on pmxcfs has the networks and is linked
to from /etc/ceph on every node, that the monitors form a quorum on
the public network, and that the OSDs use the public network for
clients and the cluster network for replication. Also check the
managers and creating a pool with an RBD storage.

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
 tests/ceph/test_ceph_cluster_setup.pl | 206 ++++++++++++++++++++++++++
 tests/testcases.ron                   |  11 ++
 2 files changed, 217 insertions(+)
 create mode 100755 tests/ceph/test_ceph_cluster_setup.pl

diff --git a/tests/ceph/test_ceph_cluster_setup.pl b/tests/ceph/test_ceph_cluster_setup.pl
new file mode 100755
index 0000000..5bd47d3
--- /dev/null
+++ b/tests/ceph/test_ceph_cluster_setup.pl
@@ -0,0 +1,206 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+C<test_ceph_cluster_setup> - Set up a hyper-converged Ceph cluster on 3 nodes.
+
+=head1 DESCRIPTION
+
+This testcase sets up Ceph on the cluster nodes. It gives every node an address
+in a dedicated Ceph public and cluster network and writes the initial
+configuration with these networks. It creates a monitor and a manager on every
+node and an OSD on every Ceph disk.
+
+It verifies that the configuration on pmxcfs has the networks and is linked to
+from /etc/ceph on every node, that the monitors form a quorum and use the public
+network, that one manager is active with the others on standby, and that all
+OSDs are up and in and use the public network for clients and the cluster
+network for replication. Finally, it creates a pool together with an RBD
+storage and verifies that the storage is active on every node and the cluster
+reports HEALTH_OK.
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use JSON;
+
+use lib '.';
+use Proxmox::Test::Ceph qw(
+    CEPH_CLUSTER_NETWORK
+    CEPH_PUBLIC_NETWORK
+    ceph_disks
+    ceph_osds
+    ceph_status
+    check_storage_active
+    create_managers
+    create_monitors
+    create_osds
+    create_pool
+    init_ceph
+    setup_ceph_network
+    wait_for_ceph
+);
+use Proxmox::Test::Helper qw(get_pve_instances);
+use Proxmox::Test::Testcase;
+use Proxmox::Test::Util qw(poll_until);
+
+my $pve_instances = get_pve_instances();
+die "not enough PVE instances" if scalar($pve_instances->@*) < 3;
+
+my $first = $pve_instances->[0];
+my $monitors = scalar($pve_instances->@*);
+my $pool = 'e2e-setup';
+my $osds = 0;
+$osds += scalar(ceph_disks($_)->@*) for $pve_instances->@*;
+
+my $public_network = CEPH_PUBLIC_NETWORK;
+my $cluster_network = CEPH_CLUSTER_NETWORK;
+my $addresses;
+
+# Commands like 'ceph' find the configuration on pmxcfs through this link.
+my $check_config_link = sub {
+    my ($instance) = @_;
+
+    my ($target) = eval { $instance->run_command('readlink /etc/ceph/ceph.conf') };
+    is(
+        $target,
+        "/etc/pve/ceph.conf\n",
+        "/etc/ceph/ceph.conf links to the config on pmxcfs on '"
+            . $instance->get_nodename() . "'",
+    );
+};
+
+Proxmox::Test::Testcase->new('ceph_cluster_setup')->with([{}])->step(
+    'set up Ceph networks',
+    sub {
+        $addresses = setup_ceph_network($pve_instances);
+        pass('nodes reach each other in the Ceph public and cluster network');
+    },
+)->step(
+    'initialize Ceph',
+    sub {
+        init_ceph(
+            $pve_instances,
+            network => $public_network,
+            'cluster-network' => $cluster_network,
+        );
+
+        my $node = $first->get_nodename();
+        my $conf = $first->client()->get("/nodes/$node/ceph/cfg/raw", {});
+        like($conf, qr/^\s*fsid\s*=\s*[0-9a-f-]{36}\s*$/m, 'ceph.conf has a cluster fsid');
+        like(
+            $conf,
+            qr/^\s*public_network\s*=\s*\Q$public_network\E\s*$/m,
+            'ceph.conf has the public network',
+        );
+        like(
+            $conf,
+            qr/^\s*cluster_network\s*=\s*\Q$cluster_network\E\s*$/m,
+            'ceph.conf has the cluster network',
+        );
+
+        $check_config_link->($first);
+    },
+)->step(
+    'create monitors',
+    sub {
+        create_monitors($pve_instances);
+
+        my @quorum = sort(ceph_status($first)->{quorum_names}->@*);
+        my @nodes = sort map { $_->get_nodename() } $pve_instances->@*;
+        is_deeply(\@quorum, \@nodes, 'every node has a monitor in the quorum');
+
+        my $node = $first->get_nodename();
+        my $monitor_list = $first->client()->get("/nodes/$node/ceph/mon", {});
+        for my $instance ($pve_instances->@*) {
+            my $name = $instance->get_nodename();
+            my ($monitor) = grep { $_->{name} eq $name } $monitor_list->@*;
+            like(
+                ($monitor // {})->{addr} // '',
+                qr/^\Q$addresses->{$name}->{public}\E:/,
+                "monitor on '$name' uses its address in the public network",
+            );
+
+            # The nodes other than the one that initialized Ceph should by now also have the link.
+            $check_config_link->($instance);
+        }
+    },
+)->step(
+    'create managers',
+    sub {
+        create_managers($pve_instances);
+
+        # A new manager is not immediately registered as standby
+        my $mgrmap;
+        eval {
+            poll_until(
+                sub {
+                    $mgrmap = ceph_status($first)->{mgrmap};
+                    return $mgrmap->{available} && $mgrmap->{num_standbys} == $monitors - 1;
+                },
+                timeout => 60,
+                interval => 2,
+                description => 'one active and ' . ($monitors - 1) . ' standby managers',
+            );
+        };
+        diag("manager map: " . JSON::encode_json($mgrmap // {})) if $@;
+        ok($mgrmap->{available}, 'a manager is active');
+        is($mgrmap->{num_standbys}, $monitors - 1, 'the other managers are on standby');
+    },
+)->step(
+    'create OSDs',
+    sub {
+        is(create_osds($pve_instances), $osds, "created $osds OSDs");
+        wait_for_ceph($first, monitors => $monitors, osds => $osds);
+        pass("all $osds OSDs are up and in");
+
+        for my $instance ($pve_instances->@*) {
+            my $name = $instance->get_nodename();
+            my $node_osds = ceph_osds($instance);
+            is(
+                scalar($node_osds->@*),
+                scalar(ceph_disks($instance)->@*),
+                "OSD tree lists an OSD for every Ceph disk under '$name'",
+            );
+
+            for my $osd ($node_osds->@*) {
+                my $metadata =
+                    $instance->client()->get("/nodes/$name/ceph/osd/$osd->{id}/metadata", {})
+                    ->{osd};
+                like(
+                    $metadata->{front_addr} // '',
+                    qr/\b\Q$addresses->{$name}->{public}\E:/,
+                    "osd.$osd->{id} serves clients in the public network",
+                );
+                like(
+                    $metadata->{back_addr} // '',
+                    qr/\b\Q$addresses->{$name}->{cluster}\E:/,
+                    "osd.$osd->{id} replicates in the cluster network",
+                );
+            }
+        }
+    },
+)->step(
+    'create pool with RBD storage',
+    sub {
+        create_pool($first, $pool, add_storages => 1);
+
+        my $storage = $first->client()->get("/storage/$pool", {});
+        is($storage->{type}, 'rbd', "RBD storage '$pool' was added");
+        is($storage->{pool}, $pool, "storage '$pool' uses the new pool");
+
+        check_storage_active($_, $pool) for $pve_instances->@*;
+    },
+)->step(
+    'verify cluster health',
+    sub {
+        wait_for_ceph($first, monitors => $monitors, osds => $osds, health_ok => 1);
+        pass('the Ceph cluster reports HEALTH_OK');
+    },
+)->run();
+
+done_testing();
diff --git a/tests/testcases.ron b/tests/testcases.ron
index fba3e06..47c06b0 100644
--- a/tests/testcases.ron
+++ b/tests/testcases.ron
@@ -392,6 +392,17 @@ TestcaseConfig(
             ],
             tag: "sdn",
         ),
+        Testcase(
+            name: "ceph_cluster_setup",
+            run: "./tests/ceph/test_ceph_cluster_setup.pl",
+            timeout: 1800,
+            instances: [
+                "pve1-cluster",
+                "pve2-cluster",
+                "pve3-cluster",
+            ],
+            tag: "ceph",
+        ),
     ],
     rollback_between_tests: Some("pre-test"),
 )
-- 
2.47.3





  parent reply	other threads:[~2026-11-04 19:07 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 19:03 [PATCH e2e-tests/test-tools 00/38] tests: add tests for guests, Ceph, PBS and cluster workflows Michael Köppl
2026-11-04 19:03 ` [PATCH test-tools 01/38] ansible: rename snd_test bridge to tt_test as multi-purpose bridge Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 02/38] plans: rename sdn_test bridge to tt_test Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 03/38] debian: add missing jq dependency Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 04/38] test framework: move the default container template to the helper Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 05/38] lib: instance: add helper to check if an address answers ping Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 06/38] lib: pveinstance: look up disks by their SCSI serial Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 07/38] lib: pveinstance: add helper to find a task started by another task Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 08/38] lib: pveinstance: add helpers to start and stop guests Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 09/38] lib: pveinstance: add helper to run commands in containers Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 10/38] lib: pveinstance: add helper to wait for qmeventd's cleanup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 11/38] lib: pveinstance: add helper to check if guest exists Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 12/38] lib: add helpers to use a PBS datastore as PVE storage Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 13/38] scripts: retry container template download, fail if it fails Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 14/38] tests: container: verify lifecycle and guest setup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 15/38] tests: container: verify volume and bind mountpoints Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 16/38] tests: container: verify snapshots, clones, templates Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 17/38] tests: container: verify device passthrough Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 18/38] plans,scripts: build a minimal OCI image onto pve1 Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 19/38] tests: container: verify application containers from OCI images Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 20/38] tests: vm: verify snapshots, clones, templates Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 21/38] tests: vm: verify adding, resizing, and removing disks Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 22/38] plans,scripts: download a Debian cloud image onto pve1 Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 23/38] tests: vm: verify lifecycle operations and cloud-init guest setup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 24/38] plans,scripts: install Ceph Tentacle on the cluster nodes Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 25/38] test framework: add Ceph test helpers Michael Köppl
2026-11-06 12:24   ` Kefu Chai
2026-11-06 13:04     ` Michael Köppl
2026-11-04 19:03 ` Michael Köppl [this message]
2026-11-06 12:50   ` [PATCH e2e-tests 26/38] tests: ceph: verify setting up a hyper-converged cluster Kefu Chai
2026-11-06 13:05     ` Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 27/38] tests: ceph: verify guests on RBD storage Michael Köppl
2026-11-06 13:01   ` Kefu Chai
2026-11-06 13:07     ` Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 28/38] tests: ceph: verify setting up, using and destroying a CephFS Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 29/38] tests: ceph: verify replacing an OSD Michael Köppl
2026-11-06 13:14   ` Kefu Chai
2026-11-04 19:03 ` [PATCH e2e-tests 30/38] tests: ceph: drop the outdated Ceph setup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 31/38] tests: pbs: verify container backup and restore Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 32/38] tests: backup: verify VM backup and restore, locally and on PBS Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 33/38] tests: pbs: verify single file restore from a container backup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 34/38] tests: storage: verify moving guest volumes between storages Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 35/38] tests: migration: verify container migration between nodes Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 36/38] tests: migration: verify VM migration with local disks Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 37/38] tests: ha: verify moving guests off a node for maintenance Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 38/38] tests: migration: verify migrating guests in bulk Michael Köppl
2026-11-06 13:25 ` [PATCH e2e-tests/test-tools 00/38] tests: add tests for guests, Ceph, PBS and cluster workflows Kefu Chai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261104190345.2573464-27-m.koeppl@proxmox.com \
    --to=m.koeppl@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal