From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH cluster/guest-common/qemu-server/container/manager/docs v5 00/41] fix #7846: guest identity (uid) and cluster ID
Date: Thu, 19 Nov 2026 20:18:32 +0100 [thread overview]
Message-ID: <20261119191914.2336934-1-t.lamprecht@proxmox.com> (raw)
A VMID can be reused for another guest, and a guest can get another
VMID or move to another cluster through a restore or a remote
migration. So backup software and other tools cannot tell whether they
still look at the same guest, see [0].
This series gives every VM and container a guest identity in the
read-only 'meta' property: a random uid (100 bits as 20 base32
characters) and the time the guest was registered in the cluster. Create
and clone get a new uid. Config changes, migration, rollback, backup and
restore keep it, also under another VMID or in another cluster, as long
as no other guest there has it. Each cluster or standalone node also
gets a cluster ID in the same format, generated and protected by pmxcfs.
The docs patches describe the details.
The uid is a plain random nonce: 100 bits make a duplicate practically
impossible and fit into a 128-bit value with room to spare, and 20
base32 characters stay short and need no quoting. The registration time
is separate from the creation time, which clones, restores and remote
migrations copy along. It changes when a guest gets registered again, so
tools can tell such a guest from the one they knew.
Three behavior changes come with it:
* Restoring over an existing guest whose uid differs from the one of
the backup is refused unless 'allow-identity-mismatch' is set. 'force'
alone does not override this.
* A migration to another cluster is refused if another guest there
already has the uid, unless 'allow-new-uid' is set. The check runs
before anything is transferred. PDM does not know the option yet.
* Older versions drop the whole 'meta' property of a guest that has an
identity. So migration and clone to such nodes is refused, and remote
migration bumps the tunnel version. This also hits moves by the HA
stack, which stops a container or a relocated VM before the migration
gets refused. Making the HA stack aware of the node versions, so that
for example the maintenance mode does not pick such nodes, is a
separate follow-up.
The patches are in dependency order: guest-common needs the pve-cluster
of this series, qemu-server and container need guest-common, and manager
needs all of them. manager also has to depend on the qemu-server and
container versions with this series, as the migration guard takes the
pve-manager version of a node as proof that the node keeps the identity.
MIN_PVE_MANAGER_VERSION in guest-common is a stand-in for that version.
Tested with the affected tests of the repositories for every patch and
their full suites at the end, pmxcfs with corosync in network
namespaces, and end to end on a nested three-node cluster that was
upgraded node by node, with remote migrations to a standalone node.
changes v4 -> v5, thanks again to Dominik for the review and the
tests:
* no lock of its own for the guest identity anymore, as Dominik noted
too. A config write reads the stored identity and writes the config
under the config lock of its caller, like every config change
(patches 9, 10, 11). The lock was there because the container
post-stop hook wrote the config without the config lock. That is a
bug of the hook and fixed by an independent patch before the series,
as is the same for the disk of a template in 'qm importdisk'.
This was actually quite nasty pre-existing hole that was found
here, nice.
* remote migration from a cluster without guest identities: the task
on the target logs the new uid of the guest, and that a migration
back to such a cluster gets refused (patches 12, 18, 26)
* new test for the cluster-wide bulk migration check (patch 34)
* 'adopt' is the one word for getting the uid of a backup or of the
source guest now, also in option descriptions, docs and subjects,
where it was 'take over' before; the task logs already said 'adopt'
* docs: the section about failed restores is a list of what can be
left behind and numbered steps to clean up now (patch 36)
* clearer wording of some comments, option descriptions and commit
messages
I added Dominik's Reviewed-by and Tested-by from v4 on all patches but
9, 10, 11, whose code changed with the removal of the lock, and
36, whose text got rewritten.
changes v3 -> v4, thanks a lot (!) to Dominik for the review and the
tests:
* cluster ID: pmxcfs checks after each sync and then every ten seconds
while in sync, by the current state alone, instead of on single
events, which missed failed sends (the confdb listener patch is
gone); a standalone node that cannot store its ID starts without one
* failed restores: independent fixes before the series put the previous
firewall config back, keep a guest whose cleanup was incomplete at
its VMID and locked, for VMs as for containers, and do not create a
guest for a caller that may only overwrite one
* shared code: pve-guest-common has one helper for the start of a
restore, both overrides as standard options and the wait for a volume
transfer in the tunnel cleanup
* tests of existing behavior moved to independent commits before the
series, so both remote migration test patches left it
* new, suggested by Dominik: the uid as variable of the backup notes
template (patches 13, 35, 41) and the cluster ID in the datacenter
summary (patch 30)
* cluster-wide bulk migration between two older nodes works again, and
the stand-in for the minimum pve-manager version is 9.2.33, as 9.2.31
and 9.2.32 got released without this series
I added Dominik's Reviewed-by and Tested-by from v3 on the patches that
did not change or only got polish since.
changes v2 -> v3:
* remote migration: a guest without uid gets one before the source
sends it, so source and target no longer end up with unrelated uids;
the identity command moved to pve-guest-common for both guest types
(new patch 13)
* restore: keep the guest if a restored volume or firewall config
cannot be removed, fail if a container backup changes between its
check and its extraction, and let the cleanup follow the reservation
* reserving a VMID refuses an existing config that fails to load
instead of replacing it
* cluster ID: generate it right away when the configured nodes change
(new patch 5)
* feature API without version lookups for snapshot requests, and the
cluster-wide bulk migration refuses its target up front
* docs: failed restores, uid conflicts on migration, qm.conf(5) and
pct.conf(5)
* more independent fixes that the series builds on were applied on
their own: failed and concurrent restores and creates, the schema of
the migration preconditions, the lock of a VMA restore, a node list
cut short in pmxcfs
changes v1 -> v2, thanks to Dominik for the review:
* rebase onto current master (tracking of used guest IDs, dfsm rework)
* remote migration takes the uid over at its start and refuses a uid
that is in use in the target cluster, unless 'allow-new-uid' is set
* qemu-server and container share the restore checks and messages
through pve-guest-common, with fewer special cases
* IDs take each character from one random byte, without an encoder
* the clone dialog does not offer nodes that would drop the identity,
and a bulk migration checks its target once (patch 35)
* independent fixes moved out of the series and got applied on their
own: the IPC client error, the order of removing firewall and guest
config, and the cleanup of a remote migration target after failures
* comments, commit messages and docs give the reasons for the format,
for rtime next to ctime and for the separate lock
Details are in the notes below the "---" of each patch.
v4: https://lore.proxmox.com/pve-devel/20261119103551.1666964-1-t.lamprecht@proxmox.com/
v3: https://lore.proxmox.com/pve-devel/20261118043817.1659212-1-t.lamprecht@proxmox.com/
v2: https://lore.proxmox.com/pve-devel/20261117223945.862914-1-t.lamprecht@proxmox.com/
v1: https://lore.proxmox.com/pve-devel/20261116004703.2908294-1-t.lamprecht@proxmox.com/
[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=7846
cluster:
Thomas Lamprecht (7):
pmxcfs: reject changes to the cluster ID file from user space
pmxcfs: generate a cluster ID on standalone nodes
pmxcfs: dfsm: add a callback that runs once all members are in sync
pmxcfs: quorum: record the corosync membership
pmxcfs: dcdb: generate the cluster ID once the cluster is in sync
cluster: add helper to read the cluster ID
pmxcfs: allow removing the cluster ID file in forced local mode
src/PVE/Cluster.pm | 16 +
src/pmxcfs/Makefile | 12 +-
src/pmxcfs/cfs-plug-memdb.c | 46 ++
src/pmxcfs/cfs-utils.c | 8 +
src/pmxcfs/cfs-utils.h | 5 +
src/pmxcfs/check_dcdb.c | 876 ++++++++++++++++++++++++++++++++++++
src/pmxcfs/check_memdb.c | 312 +++++++++++++
src/pmxcfs/cluster-id.c | 142 ++++++
src/pmxcfs/cluster-id.h | 50 ++
src/pmxcfs/dcdb.c | 141 ++++++
src/pmxcfs/dcdb.h | 5 +-
src/pmxcfs/dfsm.c | 70 ++-
src/pmxcfs/dfsm.h | 10 +
src/pmxcfs/memdb.c | 17 +
src/pmxcfs/memdb.h | 4 +
src/pmxcfs/pmxcfs.c | 8 +-
src/pmxcfs/quorum.c | 13 +-
src/pmxcfs/status.c | 44 ++
src/pmxcfs/status.h | 13 +
src/test/Makefile | 6 +-
src/test/test_cluster_id.pl | 46 ++
21 files changed, 1832 insertions(+), 12 deletions(-)
create mode 100644 src/pmxcfs/check_dcdb.c
create mode 100644 src/pmxcfs/cluster-id.c
create mode 100644 src/pmxcfs/cluster-id.h
create mode 100644 src/test/test_cluster_id.pl
guest-common:
Thomas Lamprecht (6):
guest identity: add helpers for the guest uid and registration time
abstract config: assign a guest identity and keep it on config writes
abstract config: let the VMID reservation return the previous state
guest identity: allow adopting a uid that is unused in the cluster
migrate: add shared helpers for the identity command of the migration tunnel
vzdump: notes template: list the uid variable
src/Makefile | 1 +
src/PVE/AbstractConfig.pm | 166 +++-
src/PVE/AbstractMigrate.pm | 42 +
src/PVE/GuestIdentity.pm | 514 +++++++++++
src/PVE/VZDump/Common.pm | 6 +-
src/tests/Makefile | 10 +-
src/tests/config-identity-tests.pl | 1341 ++++++++++++++++++++++++++++
src/tests/guest-identity-tests.pl | 474 ++++++++++
8 files changed, 2545 insertions(+), 9 deletions(-)
create mode 100644 src/PVE/GuestIdentity.pm
create mode 100755 src/tests/config-identity-tests.pl
create mode 100755 src/tests/guest-identity-tests.pl
qemu-server:
Thomas Lamprecht (6):
api: restore: release the VMID if a restore to an unused VMID fails
api: migrate, clone: refuse targets that would drop the guest identity
fix #7846: config: add a guest identity to the 'meta' property
restore: adopt the guest uid from the backup where possible
api: remote migration: adopt the guest uid from the source
api: status: return the guest uid
src/PVE/API2/Qemu.pm | 108 ++-
src/PVE/CLI/qm.pm | 1 +
src/PVE/CLI/qmrestore.pm | 5 +-
src/PVE/QemuConfig.pm | 7 +
src/PVE/QemuMigrate.pm | 18 +-
src/PVE/QemuServer.pm | 166 +++-
src/PVE/QemuServer/MetaInfo.pm | 2 +
src/test/Makefile | 5 +-
src/test/QemuServerTest/FakeCFS.pm | 84 +-
.../q35-windows-pinning-identity-only.conf | 6 +
...q35-windows-pinning-identity-only.conf.cmd | 26 +
.../meta-identity-invalid.conf | 6 +
.../meta-identity-invalid.conf.strict.error | 2 +
.../meta-identity-invalid.conf | 7 +
.../parse-config-input/meta-identity.conf | 20 +
src/test/restore-config-expected/150.conf | 9 +
src/test/restore-config-input/150.conf | 10 +
src/test/run_api_tests.pl | 198 +++++
src/test/run_guest_identity_tests.pl | 630 +++++++++++++++
src/test/run_parse_config_tests.pl | 2 +-
src/test/run_qemu_restore_config_tests.pl | 754 +++++++++++++++++-
.../create/qemu-server/401.conf | 31 +
.../create/qemu-server/402.conf | 31 +
.../rollback/qemu-server/401.conf | 36 +
.../rollback/qemu-server/402.conf | 35 +
.../create/qemu-server/401.conf | 13 +
.../create/qemu-server/402.conf | 13 +
.../rollback/qemu-server/401.conf | 35 +
.../rollback/qemu-server/402.conf | 34 +
src/test/snapshot-test.pm | 82 +-
30 files changed, 2300 insertions(+), 76 deletions(-)
create mode 100644 src/test/cfg2cmd/q35-windows-pinning-identity-only.conf
create mode 100644 src/test/cfg2cmd/q35-windows-pinning-identity-only.conf.cmd
create mode 100644 src/test/parse-config-expected/meta-identity-invalid.conf
create mode 100644 src/test/parse-config-expected/meta-identity-invalid.conf.strict.error
create mode 100644 src/test/parse-config-input/meta-identity-invalid.conf
create mode 100644 src/test/parse-config-input/meta-identity.conf
create mode 100644 src/test/restore-config-expected/150.conf
create mode 100644 src/test/restore-config-input/150.conf
create mode 100755 src/test/run_guest_identity_tests.pl
create mode 100644 src/test/snapshot-expected/create/qemu-server/401.conf
create mode 100644 src/test/snapshot-expected/create/qemu-server/402.conf
create mode 100644 src/test/snapshot-expected/rollback/qemu-server/401.conf
create mode 100644 src/test/snapshot-expected/rollback/qemu-server/402.conf
create mode 100644 src/test/snapshot-input/create/qemu-server/401.conf
create mode 100644 src/test/snapshot-input/create/qemu-server/402.conf
create mode 100644 src/test/snapshot-input/rollback/qemu-server/401.conf
create mode 100644 src/test/snapshot-input/rollback/qemu-server/402.conf
container:
Thomas Lamprecht (8):
restore: decide by the reservation whether the container is new
config: add read-only meta property with the creation time
fix #7846: config: add a guest identity to the 'meta' property
api: migrate, clone: refuse targets that would drop the guest identity
restore: adopt the guest uid from the backup where possible
restore: refuse overwriting a container with another guest's backup
api: remote migration: adopt the guest uid from the source
api: status: return the guest uid
src/PVE/API2/LXC.pm | 136 +++-
src/PVE/API2/LXC/Config.pm | 8 +
src/PVE/API2/LXC/Status.pm | 6 +
src/PVE/CLI/pct.pm | 2 +
src/PVE/LXC/Config.pm | 42 +-
src/PVE/LXC/Create.pm | 26 +-
src/PVE/LXC/Migrate.pm | 8 +-
src/test/config_tests.pl | 26 +-
src/test/lifecycle_tests.pl | 1479 +++++++++++++++++++++++++++++++++++
9 files changed, 1702 insertions(+), 31 deletions(-)
manager:
Thomas Lamprecht (8):
api: cluster resources: add guest uid and registration time
api: cluster status: add cluster ID
ui: datacenter summary: show the cluster ID
ui: restore: allow overwriting a guest with a backup of another guest
ui: migrate: refuse target nodes that would drop the guest identity
ui: guest summary: show the guest identity
api: bulk migrate: refuse targets that would drop the guest identity
vzdump: notes template: add the guest uid as variable
PVE/API2/Cluster.pm | 24 +++-
PVE/API2/Cluster/BulkAction/Guest.pm | 17 +++
PVE/API2/Nodes.pm | 3 +
PVE/VZDump.pm | 12 +-
test/BulkMigrate_test.pl | 102 ++++++++++++++
test/ClusterResources_test.pl | 171 +++++++++++++++++++++++
test/ClusterStatus_test.pl | 114 +++++++++++++++
test/Makefile | 14 +-
www/manager6/Makefile | 1 +
www/manager6/Utils.js | 2 +-
www/manager6/dc/Health.js | 6 +
www/manager6/panel/GuestIdentity.js | 120 ++++++++++++++++
www/manager6/panel/GuestStatusView.js | 3 +
www/manager6/panel/TemplateStatusView.js | 3 +
www/manager6/window/Migrate.js | 29 ++++
www/manager6/window/Restore.js | 18 +++
16 files changed, 635 insertions(+), 4 deletions(-)
create mode 100755 test/BulkMigrate_test.pl
create mode 100755 test/ClusterResources_test.pl
create mode 100755 test/ClusterStatus_test.pl
create mode 100644 www/manager6/panel/GuestIdentity.js
docs:
Thomas Lamprecht (6):
vzdump: restore: describe what a failed restore can leave behind
vzdump: describe the guest identity of VMs and containers
pvecm: document the cluster ID and how to get a new one
qm: configuration: describe the read-only meta property
pct: configuration: describe the read-only meta property
vzdump: notes: document the uid template variable
pct.adoc | 35 +++++
pct.conf.adoc | 3 +
pmxcfs.adoc | 1 +
pvecm.adoc | 106 +++++++++++++++
qm.adoc | 38 ++++++
qm.conf.adoc | 3 +
vzdump.adoc | 354 ++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 540 insertions(+)
Summary over all repositories:
91 files changed, 9554 insertions(+), 132 deletions(-)
--
2.47.3
next 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 Thomas Lamprecht [this message]
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 ` [PATCH cluster v5 02/41] pmxcfs: generate a cluster ID on standalone nodes Thomas Lamprecht
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-1-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 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.