From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D83FB1FF0DA for ; Thu, 19 Nov 2026 20:20:23 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 5B9B421793; Thu, 19 Nov 2026 20:19:58 +0100 (CET) From: Thomas Lamprecht 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 Message-ID: <20261119191914.2336934-3-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261119191914.2336934-1-t.lamprecht@proxmox.com> References: <20261119191914.2336934-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795115959173 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.157 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_SHORT 0.001 Use of a URL Shortener for very short URL RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: IL5DTGMXLFKCSIEB4SBSV5J7J75OY4QE X-Message-ID-Hash: IL5DTGMXLFKCSIEB4SBSV5J7J75OY4QE X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 Reviewed-by: Dominik Csapak Tested-by: Dominik Csapak --- 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 +#include #include #include +#include #include #include #include @@ -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 . + + Author: Thomas Lamprecht + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include +#include +#include +#include +#include + +#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 . + + Author: Thomas Lamprecht + +*/ + +#ifndef _PVE_CLUSTER_ID_H_ +#define _PVE_CLUSTER_ID_H_ + +#include + +#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