From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH cluster v5 02/41] pmxcfs: generate a cluster ID on standalone nodes
Date: Thu, 19 Nov 2026 20:18:34 +0100 [thread overview]
Message-ID: <20261119191914.2336934-3-t.lamprecht@proxmox.com> (raw)
In-Reply-To: <20261119191914.2336934-1-t.lamprecht@proxmox.com>
Standalone nodes need a cluster ID to distinguish them from other
installations. Generate and store it before the filesystem gets mounted
and before the IPC server starts. Nothing else can read or write the
database at that point.
The ID has 20 random characters of the lowercase RFC 4648 base32
alphabet, followed by a newline. Each character comes from one random
byte of /dev/urandom. These 100 random bits make a duplicate between
installations practically impossible. The ID fits into a 128-bit value
with bits to spare, is short, and has no characters that need quoting.
Keep an existing ID if it is valid, with or without its newline. Replace
any other content of the file, also an empty file that an interrupted
initialization left behind. pmxcfs owns /etc/pve and reserves this path,
so replacing other content found there on an upgrade is intended. If the
path is a directory, log that and leave the directory for an
administrator to remove with rmdir.
If the ID cannot be stored, log the error and continue to start without
an ID. This is how pmxcfs handles any database that cannot be written:
the memdb refuses all later writes until the next start. After such a
failed write, the in-memory tree can already have the new ID while the
database lacks it. Empty the file in memory in that case, because the
next start generates another ID, and readers must not get an ID that
will be replaced. If no random data can be read, nothing was written
yet, so only log an error. In both cases the next start tries again.
Do not generate an ID in forced local mode if corosync.conf exists. Such
a node belongs to a cluster and must not create an ID that conflicts
with the ID of its cluster before it rejoins.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes v4 -> v5:
* commit message: say which point is meant with the in-memory tree that
has the new ID already
changes v3 -> v4:
* a node that cannot store the ID starts without one instead of aborting
the start, and empties the file in memory, so that readers do not get
an ID that the next start replaces
* tests: storing fails when creating the file, when writing the ID and
when replacing invalid content
* commit message: pmxcfs owns the path and replaces other content in a
file there on purpose
* commit message and comments: plainer wording, same content
changes v2 -> v3:
* say in the comment that it is about a failed generation
changes v1 -> v2:
* take each character from a random byte of its own instead of encoding
13 random bytes, which drops the encoder and its test vectors
(Dominik)
* give the reasons for the format in the commit message
src/pmxcfs/Makefile | 2 +-
src/pmxcfs/check_memdb.c | 194 +++++++++++++++++++++++++++++++++++++++
src/pmxcfs/cluster-id.c | 142 ++++++++++++++++++++++++++++
src/pmxcfs/cluster-id.h | 50 ++++++++++
src/pmxcfs/memdb.c | 17 ++++
src/pmxcfs/memdb.h | 4 +
src/pmxcfs/pmxcfs.c | 4 +
7 files changed, 412 insertions(+), 1 deletion(-)
create mode 100644 src/pmxcfs/cluster-id.c
create mode 100644 src/pmxcfs/cluster-id.h
diff --git a/src/pmxcfs/Makefile b/src/pmxcfs/Makefile
index 547f258..cd93e72 100644
--- a/src/pmxcfs/Makefile
+++ b/src/pmxcfs/Makefile
@@ -21,7 +21,7 @@ all: pmxcfs create_pmxcfs_db logtest check_memdb
libpmxcfs.a: logger.o loop.o server.o status.o confdb.o quorum.o dcdb.o dfsm.o
libpmxcfs.a: cfs-plug.o cfs-plug-memdb.o cfs-plug-link.o cfs-plug-func.o
-libpmxcfs.a: cfs-utils.o memdb.o database.o
+libpmxcfs.a: cfs-utils.o memdb.o database.o cluster-id.o
libpmxcfs.a:
$(AR) $(ARFLAGS) $@ $^
diff --git a/src/pmxcfs/check_memdb.c b/src/pmxcfs/check_memdb.c
index caac740..a51433a 100644
--- a/src/pmxcfs/check_memdb.c
+++ b/src/pmxcfs/check_memdb.c
@@ -19,8 +19,10 @@
*/
#include <check.h>
+#include <dirent.h>
#include <errno.h>
#include <glib.h>
+#include <sqlite3.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -28,6 +30,7 @@
#include "cfs-plug-memdb.h"
#include "cfs-utils.h"
+#include "cluster-id.h"
#include "memdb.h"
#include "status.h"
@@ -302,6 +305,181 @@ START_TEST(test_cluster_id_fuse_read_only) {
}
END_TEST
+START_TEST(test_cluster_id_is_valid) {
+ ck_assert(cluster_id_is_valid("abcdefghijklmnopqrst\n", 21));
+ ck_assert(cluster_id_is_valid("uvwxyz234567abcdefgh\n", 21));
+ ck_assert(cluster_id_is_valid("abcdefghijklmnopqrst", 20));
+
+ ck_assert(!cluster_id_is_valid(NULL, 21));
+ ck_assert(!cluster_id_is_valid("", 0));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmno", 15));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmnop", 16));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmnop\n", 17));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmnopqrs\n", 20));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmnopqrstu", 21));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmnopqrstu\n", 22));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmnopqrst\n\n", 22));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmnopqrst ", 21));
+ ck_assert(!cluster_id_is_valid("Abcdefghijklmnopqrst\n", 21));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmnopqrs1\n", 21));
+ ck_assert(!cluster_id_is_valid("abcdefghijklmnopqrs8\n", 21));
+ ck_assert(!cluster_id_is_valid("abcdefgh\0jklmnopqrst\n", 21));
+}
+END_TEST
+
+START_TEST(test_cluster_id_generate) {
+ char id1[CLUSTER_ID_FILE_SIZE], id2[CLUSTER_ID_FILE_SIZE];
+
+ ck_assert(cluster_id_generate(id1));
+ ck_assert(cluster_id_generate(id2));
+
+ ck_assert(cluster_id_is_valid(id1, sizeof(id1)));
+ ck_assert(cluster_id_is_valid(id2, sizeof(id2)));
+ ck_assert(memcmp(id1, id2, sizeof(id1)) != 0);
+}
+END_TEST
+
+START_TEST(test_cluster_id_state) {
+ time_t ctime = 1234;
+
+ ck_assert(cluster_id_state(memdb) == CLUSTER_ID_MISSING);
+
+ ck_assert(memdb_create(memdb, "cluster-id", 0, ctime) == 0);
+ ck_assert(cluster_id_state(memdb) == CLUSTER_ID_INVALID);
+
+ ck_assert(memdb_write(memdb, "cluster-id", 0, ctime, "abcdefghijklmnopqrst\n", 21, 0, 1) == 21);
+ ck_assert(cluster_id_state(memdb) == CLUSTER_ID_VALID);
+
+ ck_assert(memdb_write(memdb, "cluster-id", 0, ctime, "foo", 3, 0, 1) == 3);
+ ck_assert(cluster_id_state(memdb) == CLUSTER_ID_INVALID);
+
+ ck_assert(memdb_delete(memdb, "cluster-id", 0, ctime) == 0);
+ ck_assert(memdb_mkdir(memdb, "cluster-id", 0, ctime) == 0);
+ ck_assert(cluster_id_state(memdb) == CLUSTER_ID_NOT_A_FILE);
+}
+END_TEST
+
+START_TEST(test_cluster_id_standalone) {
+ time_t ctime = 1234;
+ gpointer data;
+ int len;
+
+ cluster_id_ensure_standalone(memdb);
+ len = memdb_read(memdb, "cluster-id", &data);
+ ck_assert(len == CLUSTER_ID_FILE_SIZE);
+ ck_assert(cluster_id_is_valid(data, len));
+
+ /* an existing ID is kept */
+ char id[CLUSTER_ID_FILE_SIZE];
+ memcpy(id, data, sizeof(id));
+ g_free(data);
+
+ cluster_id_ensure_standalone(memdb);
+ ck_assert(memdb_read(memdb, "cluster-id", &data) == CLUSTER_ID_FILE_SIZE);
+ ck_assert(memcmp(data, id, sizeof(id)) == 0);
+ g_free(data);
+
+ /* an empty file is what a crash between creating and writing leaves behind, it gets filled */
+ ck_assert(memdb_delete(memdb, "cluster-id", 0, ctime) == 0);
+ ck_assert(memdb_create(memdb, "cluster-id", 0, ctime) == 0);
+
+ cluster_id_ensure_standalone(memdb);
+ len = memdb_read(memdb, "cluster-id", &data);
+ ck_assert(len == CLUSTER_ID_FILE_SIZE);
+ ck_assert(cluster_id_is_valid(data, len));
+ g_free(data);
+
+ /* so is invalid content */
+ ck_assert(memdb_write(memdb, "cluster-id", 0, ctime, "foo\n", 4, 0, 1) == 4);
+
+ cluster_id_ensure_standalone(memdb);
+ len = memdb_read(memdb, "cluster-id", &data);
+ ck_assert(len == CLUSTER_ID_FILE_SIZE);
+ ck_assert(cluster_id_is_valid(data, len));
+ g_free(data);
+
+ /* a valid ID without newline is kept as is */
+ ck_assert(memdb_write(memdb, "cluster-id", 0, ctime, "abcdefghijklmnopqrst", 20, 0, 1) == 20);
+
+ cluster_id_ensure_standalone(memdb);
+ ck_assert(memdb_read(memdb, "cluster-id", &data) == 20);
+ ck_assert(memcmp(data, "abcdefghijklmnopqrst", 20) == 0);
+ g_free(data);
+
+ /* an ID with only 16 characters is malformed like anything else and gets replaced */
+ ck_assert(memdb_write(memdb, "cluster-id", 0, ctime, "abcdefghijklmnop\n", 17, 0, 1) == 17);
+
+ cluster_id_ensure_standalone(memdb);
+ len = memdb_read(memdb, "cluster-id", &data);
+ ck_assert(len == CLUSTER_ID_FILE_SIZE);
+ ck_assert(cluster_id_is_valid(data, len));
+ g_free(data);
+
+ /* a directory is left for the admin and does not stop the start */
+ ck_assert(memdb_delete(memdb, "cluster-id", 0, ctime) == 0);
+ ck_assert(memdb_mkdir(memdb, "cluster-id", 0, ctime) == 0);
+
+ cluster_id_ensure_standalone(memdb);
+ memdb_tree_entry_t *te = memdb_getattr(memdb, "cluster-id");
+ ck_assert(te != NULL);
+ ck_assert(te->type == DT_DIR);
+ memdb_tree_entry_free(te);
+}
+END_TEST
+
+static void sql_exec(const char *statement) {
+ sqlite3 *db = NULL;
+ ck_assert(sqlite3_open(TESTDB, &db) == SQLITE_OK);
+ ck_assert(sqlite3_exec(db, statement, NULL, NULL, NULL) == SQLITE_OK);
+ ck_assert(sqlite3_close(db) == SQLITE_OK);
+}
+
+/* Storing fails for the rows of the ID file that match the condition. The start goes on without a
+ * readable ID, and the next start with a working database stores one. */
+static void check_standalone_store_failure(const char *condition) {
+ char *trigger = g_strdup_printf(
+ "CREATE TRIGGER fail_cluster_id BEFORE INSERT ON tree WHEN NEW.name = 'cluster-id'%s "
+ "BEGIN SELECT RAISE(FAIL, 'injected failure'); END;",
+ condition
+ );
+ sql_exec(trigger);
+ g_free(trigger);
+
+ cluster_id_ensure_standalone(memdb);
+ ck_assert(memdb->errors);
+ ck_assert(cluster_id_state(memdb) != CLUSTER_ID_VALID);
+
+ gpointer data = NULL;
+ ck_assert(memdb_read(memdb, "cluster-id", &data) <= 0);
+ g_free(data);
+
+ memdb_close(memdb);
+ sql_exec("DROP TRIGGER fail_cluster_id;");
+ memdb = memdb_open(TESTDB);
+ ck_assert(memdb != NULL);
+
+ ck_assert(cluster_id_state(memdb) != CLUSTER_ID_VALID);
+ cluster_id_ensure_standalone(memdb);
+ ck_assert(cluster_id_state(memdb) == CLUSTER_ID_VALID);
+}
+
+START_TEST(test_cluster_id_standalone_create_failure) { check_standalone_store_failure(""); }
+END_TEST
+
+/* creating the empty file works, storing the ID fails */
+START_TEST(test_cluster_id_standalone_write_failure) {
+ check_standalone_store_failure(" AND length(NEW.data) > 0");
+}
+END_TEST
+
+START_TEST(test_cluster_id_standalone_replace_failure) {
+ ck_assert(memdb_create(memdb, "cluster-id", 0, 1234) == 0);
+ ck_assert(memdb_write(memdb, "cluster-id", 0, 1234, "foo\n", 4, 0, 1) == 4);
+
+ check_standalone_store_failure("");
+}
+END_TEST
+
START_TEST(test_truncate_grow) {
const char *fn = "/f1";
time_t ctime = 1234;
@@ -590,6 +768,22 @@ static Suite *memdb_suite(void) {
add_test(s, test_cluster_id_fuse_read_only, "cluster_id_fuse_read_only");
+ add_test(s, test_cluster_id_is_valid, "cluster_id_is_valid");
+
+ add_test(s, test_cluster_id_generate, "cluster_id_generate");
+
+ add_test(s, test_cluster_id_state, "cluster_id_state");
+
+ add_test(s, test_cluster_id_standalone, "cluster_id_standalone");
+
+ add_test(s, test_cluster_id_standalone_create_failure, "cluster_id_standalone_create_failure");
+
+ add_test(s, test_cluster_id_standalone_write_failure, "cluster_id_standalone_write_failure");
+
+ add_test(
+ s, test_cluster_id_standalone_replace_failure, "cluster_id_standalone_replace_failure"
+ );
+
add_test(s, test_indextest1, "indextest1");
add_test(s, test_loaddb1, "loaddb1");
diff --git a/src/pmxcfs/cluster-id.c b/src/pmxcfs/cluster-id.c
new file mode 100644
index 0000000..cd44d62
--- /dev/null
+++ b/src/pmxcfs/cluster-id.c
@@ -0,0 +1,142 @@
+/*
+ Copyright (C) 2026 Proxmox Server Solutions GmbH
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Author: Thomas Lamprecht <t.lamprecht@proxmox.com>
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <glib.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "cfs-utils.h"
+#include "cluster-id.h"
+
+static const char base32_alphabet[] = "abcdefghijklmnopqrstuvwxyz234567";
+
+gboolean cluster_id_generate(char id[CLUSTER_ID_FILE_SIZE]) {
+ guint8 raw[CLUSTER_ID_LEN];
+
+ int fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
+ if (fd == -1) {
+ cfs_critical("unable to open /dev/urandom - %s", g_strerror(errno));
+ return FALSE;
+ }
+
+ ssize_t res = safe_read(fd, (char *)raw, sizeof(raw));
+ int saved_errno = errno;
+ close(fd);
+
+ if (res != (ssize_t)sizeof(raw)) {
+ cfs_critical(
+ "unable to read from /dev/urandom - %s",
+ res < 0 ? g_strerror(saved_errno) : "short read"
+ );
+ return FALSE;
+ }
+
+ /* five bits of a random byte per character, so each one is uniformly distributed */
+ for (int i = 0; i < CLUSTER_ID_LEN; i++) {
+ id[i] = base32_alphabet[raw[i] & 0x1f];
+ }
+ id[CLUSTER_ID_LEN] = '\n';
+
+ return TRUE;
+}
+
+gboolean cluster_id_is_valid(gconstpointer data, size_t len) {
+ const char *id = data;
+
+ if (!id ||
+ !(len == CLUSTER_ID_LEN || (len == CLUSTER_ID_FILE_SIZE && id[CLUSTER_ID_LEN] == '\n'))) {
+ return FALSE;
+ }
+
+ for (int i = 0; i < CLUSTER_ID_LEN; i++) {
+ if (!((id[i] >= 'a' && id[i] <= 'z') || (id[i] >= '2' && id[i] <= '7'))) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+cluster_id_state_t cluster_id_state(memdb_t *memdb) {
+ g_return_val_if_fail(memdb != NULL, CLUSTER_ID_NOT_A_FILE);
+
+ memdb_tree_entry_t *te = memdb_getattr(memdb, CFS_CLUSTER_ID_FN);
+ if (!te) {
+ return CLUSTER_ID_MISSING;
+ }
+
+ gboolean is_file = te->type == DT_REG;
+ memdb_tree_entry_free(te);
+ if (!is_file) {
+ return CLUSTER_ID_NOT_A_FILE;
+ }
+
+ gpointer data = NULL;
+ int len = memdb_read(memdb, CFS_CLUSTER_ID_FN, &data);
+ gboolean valid = len >= 0 && cluster_id_is_valid(data, len);
+ g_free(data);
+
+ return valid ? CLUSTER_ID_VALID : CLUSTER_ID_INVALID;
+}
+
+void cluster_id_ensure_standalone(memdb_t *memdb) {
+ g_return_if_fail(memdb != NULL);
+
+ cluster_id_state_t state = cluster_id_state(memdb);
+ if (state == CLUSTER_ID_VALID) {
+ return;
+ }
+
+ if (state == CLUSTER_ID_NOT_A_FILE) {
+ cfs_message("not generating a cluster ID, '%s' is not a regular file", CFS_CLUSTER_ID_FN);
+ return;
+ }
+
+ /* on failure nothing got written, so the start can go on and the next one tries again */
+ char id[CLUSTER_ID_FILE_SIZE];
+ if (!cluster_id_generate(id)) {
+ return;
+ }
+
+ /* nothing is mounted yet, so no reader can see the file between creating and writing it, and
+ * a crash in between leaves an empty file that the next start fills */
+ guint32 mtime = time(NULL);
+ int res = state == CLUSTER_ID_MISSING ? memdb_create(memdb, CFS_CLUSTER_ID_FN, 0, mtime) : 0;
+ if (res == 0) {
+ res = memdb_write(memdb, CFS_CLUSTER_ID_FN, 0, mtime, id, CLUSTER_ID_FILE_SIZE, 0, TRUE);
+ }
+
+ /* If storing the ID failed, the tree in memory can still have it, and the memdb refuses all
+ * later writes. Empty the file, so that nothing uses an ID that the next start replaces. */
+ if (res != CLUSTER_ID_FILE_SIZE) {
+ memdb_clear_unstored(memdb, CFS_CLUSTER_ID_FN);
+ cfs_critical("unable to store a cluster ID, starting without one - %s", g_strerror(-res));
+ return;
+ }
+
+ cfs_message("generated cluster ID %.*s", CLUSTER_ID_LEN, id);
+}
diff --git a/src/pmxcfs/cluster-id.h b/src/pmxcfs/cluster-id.h
new file mode 100644
index 0000000..9414ed7
--- /dev/null
+++ b/src/pmxcfs/cluster-id.h
@@ -0,0 +1,50 @@
+/*
+ Copyright (C) 2026 Proxmox Server Solutions GmbH
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Author: Thomas Lamprecht <t.lamprecht@proxmox.com>
+
+*/
+
+#ifndef _PVE_CLUSTER_ID_H_
+#define _PVE_CLUSTER_ID_H_
+
+#include <glib.h>
+
+#include "memdb.h"
+
+/* the ID is 20 random characters of the lowercase RFC 4648 base32 alphabet, so 100 random bits,
+ * pmxcfs writes it plus a newline */
+#define CLUSTER_ID_LEN 20
+#define CLUSTER_ID_FILE_SIZE (CLUSTER_ID_LEN + 1)
+
+gboolean cluster_id_generate(char id[CLUSTER_ID_FILE_SIZE]);
+
+gboolean cluster_id_is_valid(gconstpointer data, size_t len);
+
+typedef enum {
+ CLUSTER_ID_VALID,
+ CLUSTER_ID_MISSING,
+ CLUSTER_ID_INVALID,
+ /* a directory, which only rmdir can remove */
+ CLUSTER_ID_NOT_A_FILE,
+} cluster_id_state_t;
+
+cluster_id_state_t cluster_id_state(memdb_t *memdb);
+
+/* generates and stores an ID unless a valid one exists, failures only get logged */
+void cluster_id_ensure_standalone(memdb_t *memdb);
+
+#endif /* _PVE_CLUSTER_ID_H_ */
diff --git a/src/pmxcfs/memdb.c b/src/pmxcfs/memdb.c
index 8862607..b16836a 100644
--- a/src/pmxcfs/memdb.c
+++ b/src/pmxcfs/memdb.c
@@ -961,6 +961,23 @@ int memdb_write(
return memdb_pwrite(memdb, path, writer, mtime, data, count, offset, truncate, FALSE);
}
+void memdb_clear_unstored(memdb_t *memdb, const char *path) {
+ g_return_if_fail(memdb != NULL);
+ g_return_if_fail(path != NULL);
+
+ g_mutex_lock(&memdb->mutex);
+
+ memdb_tree_entry_t *te, *parent;
+ if (memdb->errors && (te = memdb_lookup_path(memdb, path, &parent)) && te->type == DT_REG) {
+ g_free(te->data.value);
+ te->data.value = NULL;
+ te->size = 0;
+ record_memdb_change(path);
+ }
+
+ g_mutex_unlock(&memdb->mutex);
+}
+
memdb_tree_entry_t *memdb_getattr(memdb_t *memdb, const char *path) {
g_return_val_if_fail(memdb != NULL, NULL);
g_return_val_if_fail(path != NULL, NULL);
diff --git a/src/pmxcfs/memdb.h b/src/pmxcfs/memdb.h
index 970ae14..41b7e71 100644
--- a/src/pmxcfs/memdb.h
+++ b/src/pmxcfs/memdb.h
@@ -134,6 +134,10 @@ int memdb_write(
gboolean truncate
);
+/* Empties a file in memory only, once the memdb is in its error state. A failed write can leave
+ * content in the tree that the database lacks, and the memdb refuses all later writes. */
+void memdb_clear_unstored(memdb_t *memdb, const char *path);
+
memdb_tree_entry_t *memdb_getattr(memdb_t *memdb, const char *path);
int memdb_rename(memdb_t *memdb, const char *from, const char *to, guint32 writer, guint32 mtime);
diff --git a/src/pmxcfs/pmxcfs.c b/src/pmxcfs/pmxcfs.c
index b8a212d..1b470b1 100644
--- a/src/pmxcfs/pmxcfs.c
+++ b/src/pmxcfs/pmxcfs.c
@@ -48,6 +48,7 @@
#include "cfs-plug-memdb.h"
#include "cfs-plug.h"
#include "cfs-utils.h"
+#include "cluster-id.h"
#include "confdb.h"
#include "dcdb.h"
#include "dfsm.h"
@@ -912,6 +913,9 @@ int main(int argc, char *argv[]) {
} else {
cfs_debug("using local mode (corosync.conf does not exist)");
cfs_set_quorate(1, TRUE);
+ /* only without a corosync.conf, forced local mode on a cluster node must not generate an ID
+ * of its own */
+ cluster_id_ensure_standalone(memdb);
}
if (conf_data) {
g_free(conf_data);
--
2.47.3
next prev parent reply other threads:[~2026-11-19 19:20 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 19:18 [PATCH cluster/guest-common/qemu-server/container/manager/docs v5 00/41] fix #7846: guest identity (uid) and cluster ID Thomas Lamprecht
2026-11-19 19:18 ` [PATCH cluster v5 01/41] pmxcfs: reject changes to the cluster ID file from user space Thomas Lamprecht
2026-11-19 19:18 ` Thomas Lamprecht [this message]
2026-11-19 19:18 ` [PATCH cluster v5 03/41] pmxcfs: dfsm: add a callback that runs once all members are in sync Thomas Lamprecht
2026-11-19 19:18 ` [PATCH cluster v5 04/41] pmxcfs: quorum: record the corosync membership Thomas Lamprecht
2026-11-19 19:18 ` [PATCH cluster v5 05/41] pmxcfs: dcdb: generate the cluster ID once the cluster is in sync Thomas Lamprecht
2026-11-19 19:18 ` [PATCH cluster v5 06/41] cluster: add helper to read the cluster ID Thomas Lamprecht
2026-11-19 19:18 ` [PATCH cluster v5 07/41] pmxcfs: allow removing the cluster ID file in forced local mode Thomas Lamprecht
2026-11-19 19:18 ` [PATCH guest-common v5 08/41] guest identity: add helpers for the guest uid and registration time Thomas Lamprecht
2026-11-19 19:18 ` [PATCH guest-common v5 09/41] abstract config: assign a guest identity and keep it on config writes Thomas Lamprecht
2026-11-19 19:18 ` [PATCH guest-common v5 10/41] abstract config: let the VMID reservation return the previous state Thomas Lamprecht
2026-11-19 19:18 ` [PATCH guest-common v5 11/41] guest identity: allow adopting a uid that is unused in the cluster Thomas Lamprecht
2026-11-19 19:18 ` [PATCH guest-common v5 12/41] migrate: add shared helpers for the identity command of the migration tunnel Thomas Lamprecht
2026-11-19 19:18 ` [PATCH guest-common v5 13/41] vzdump: notes template: list the uid variable Thomas Lamprecht
2026-11-19 19:18 ` [PATCH qemu-server v5 14/41] api: restore: release the VMID if a restore to an unused VMID fails Thomas Lamprecht
2026-11-19 19:18 ` [PATCH qemu-server v5 15/41] api: migrate, clone: refuse targets that would drop the guest identity Thomas Lamprecht
2026-11-19 19:18 ` [PATCH qemu-server v5 16/41] fix #7846: config: add a guest identity to the 'meta' property Thomas Lamprecht
2026-11-19 19:18 ` [PATCH qemu-server v5 17/41] restore: adopt the guest uid from the backup where possible Thomas Lamprecht
2026-11-19 19:18 ` [PATCH qemu-server v5 18/41] api: remote migration: adopt the guest uid from the source Thomas Lamprecht
2026-11-19 19:18 ` [PATCH qemu-server v5 19/41] api: status: return the guest uid Thomas Lamprecht
2026-11-19 19:18 ` [PATCH container v5 20/41] restore: decide by the reservation whether the container is new Thomas Lamprecht
2026-11-19 19:18 ` [PATCH container v5 21/41] config: add read-only meta property with the creation time Thomas Lamprecht
2026-11-19 19:18 ` [PATCH container v5 22/41] fix #7846: config: add a guest identity to the 'meta' property Thomas Lamprecht
2026-11-19 19:18 ` [PATCH container v5 23/41] api: migrate, clone: refuse targets that would drop the guest identity Thomas Lamprecht
2026-11-19 19:18 ` [PATCH container v5 24/41] restore: adopt the guest uid from the backup where possible Thomas Lamprecht
2026-11-19 19:18 ` [PATCH container v5 25/41] restore: refuse overwriting a container with another guest's backup Thomas Lamprecht
2026-11-19 19:18 ` [PATCH container v5 26/41] api: remote migration: adopt the guest uid from the source Thomas Lamprecht
2026-11-19 19:18 ` [PATCH container v5 27/41] api: status: return the guest uid Thomas Lamprecht
2026-11-19 19:19 ` [PATCH manager v5 28/41] api: cluster resources: add guest uid and registration time Thomas Lamprecht
2026-11-19 19:19 ` [PATCH manager v5 29/41] api: cluster status: add cluster ID Thomas Lamprecht
2026-11-19 19:19 ` [PATCH manager v5 30/41] ui: datacenter summary: show the " Thomas Lamprecht
2026-11-19 19:19 ` [PATCH manager v5 31/41] ui: restore: allow overwriting a guest with a backup of another guest Thomas Lamprecht
2026-11-19 19:19 ` [PATCH manager v5 32/41] ui: migrate: refuse target nodes that would drop the guest identity Thomas Lamprecht
2026-11-19 19:19 ` [PATCH manager v5 33/41] ui: guest summary: show " Thomas Lamprecht
2026-11-19 19:19 ` [PATCH manager v5 34/41] api: bulk migrate: refuse targets that would drop " Thomas Lamprecht
2026-11-19 19:19 ` [PATCH manager v5 35/41] vzdump: notes template: add the guest uid as variable Thomas Lamprecht
2026-11-19 19:19 ` [PATCH docs v5 36/41] vzdump: restore: describe what a failed restore can leave behind Thomas Lamprecht
2026-11-19 19:19 ` [PATCH docs v5 37/41] vzdump: describe the guest identity of VMs and containers Thomas Lamprecht
2026-11-19 19:19 ` [PATCH docs v5 38/41] pvecm: document the cluster ID and how to get a new one Thomas Lamprecht
2026-11-19 19:19 ` [PATCH docs v5 39/41] qm: configuration: describe the read-only meta property Thomas Lamprecht
2026-11-19 19:19 ` [PATCH docs v5 40/41] pct: " Thomas Lamprecht
2026-11-19 19:19 ` [PATCH docs v5 41/41] vzdump: notes: document the uid template variable Thomas Lamprecht
2026-11-20 3:07 ` [PATCH cluster/guest-common/qemu-server/container/manager/docs v5 00/41] fix #7846: guest identity (uid) and cluster ID Thomas Lamprecht
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=20261119191914.2336934-3-t.lamprecht@proxmox.com \
--to=t.lamprecht@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox