* [PATCH manager 1/3] fix #5990: vzdump: notes template: add pool variable
2026-10-06 7:50 [PATCH manager/guest-common/docs 0/3] fix #5990: vzdump: notes template: add pool variable Michal Fox
@ 2026-10-06 7:50 ` Michal Fox
2026-10-06 7:50 ` [PATCH guest-common 2/3] vzdump: notes template: mention pool variable in description Michal Fox
2026-10-06 7:50 ` [PATCH docs 3/3] vzdump: notes template: document pool variable Michal Fox
2 siblings, 0 replies; 4+ messages in thread
From: Michal Fox @ 2026-10-06 7:50 UTC (permalink / raw)
To: pve-devel
Backups of guests from different teams or users often end up on the
same storage, and the resource pool of the guest is a common way to
tell them apart. But the pool is not part of the backup, and the VMID
alone is not enough to find out later where a backup came from, as
VMIDs can be reused.
Add a {{pool}} variable to the notes template, which is replaced with
the resource pool the guest is a member of at the time of the backup,
or with an empty string if it is not in any pool, and list it in the
hint of the backup dialogs.
Signed-off-by: Michal Fox <me@dualfroz.com>
---
Tested by generating notes with a mocked user.cfg for a guest in a pool
and one without, and by checking the hint in the backup dialogs.
For guests that are not in any pool, the variable is replaced with an
empty string, as there is no obvious placeholder like for the cluster
name. Happy to change that if something else is preferred.
PVE/VZDump.pm | 3 ++-
www/manager6/Utils.js | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index defe9e0a..8fdc36a0 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -111,7 +111,7 @@ my $verify_notes_template = sub {
while ($template =~ /\{\{([^\s{}]+)\}\}/g) {
my $var = $1;
push @problematic, "variable '$var' at char " . (pos($template) - length($var))
- if $var !~ /^(cluster|guestname|node|vmid)$/;
+ if $var !~ /^(cluster|guestname|node|pool|vmid)$/;
}
die "found unknown: " . join(', ', @problematic) . "\n" if scalar(@problematic);
@@ -126,6 +126,7 @@ my $generate_notes = sub {
cluster => PVE::Cluster::get_clinfo()->{cluster}->{name} // 'standalone node',
guestname => $task->{hostname} // "VM $task->{vmid}", # is always set for CTs
node => PVE::INotify::nodename(),
+ pool => cfs_read_file('user.cfg')->{vms}->{ $task->{vmid} } // '',
vmid => $task->{vmid},
};
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 8b99371d..2f0ec004 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -2093,7 +2093,7 @@ Ext.define('PVE.Utils', {
return value.replace(/(\\\\|\\n)/g, (match) => replace[match]);
},
- notesTemplateVars: ['cluster', 'guestname', 'node', 'vmid'],
+ notesTemplateVars: ['cluster', 'guestname', 'node', 'pool', 'vmid'],
renderTags: function (tagstext, overrides) {
let text = '';
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH guest-common 2/3] vzdump: notes template: mention pool variable in description
2026-10-06 7:50 [PATCH manager/guest-common/docs 0/3] fix #5990: vzdump: notes template: add pool variable Michal Fox
2026-10-06 7:50 ` [PATCH manager 1/3] " Michal Fox
@ 2026-10-06 7:50 ` Michal Fox
2026-10-06 7:50 ` [PATCH docs 3/3] vzdump: notes template: document pool variable Michal Fox
2 siblings, 0 replies; 4+ messages in thread
From: Michal Fox @ 2026-10-06 7:50 UTC (permalink / raw)
To: pve-devel
The notes template now also supports a {{pool}} variable, which is
replaced with the resource pool the guest is a member of.
Signed-off-by: Michal Fox <me@dualfroz.com>
---
Only the description changes, the variable itself is handled in
pve-manager (1/3).
src/PVE/VZDump/Common.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/PVE/VZDump/Common.pm b/src/PVE/VZDump/Common.pm
index 67a4cf4..1eee227 100644
--- a/src/PVE/VZDump/Common.pm
+++ b/src/PVE/VZDump/Common.pm
@@ -363,9 +363,9 @@ my $confdesc = {
type => 'string',
description => "Template string for generating notes for the backup(s). It can contain"
. " variables which will be replaced by their values. Currently supported are"
- . " {{cluster}}, {{guestname}}, {{node}}, and {{vmid}}, but more might be added in the"
- . " future. Needs to be a single line, newline and backslash need to be escaped as '\\n'"
- . " and '\\\\' respectively.",
+ . " {{cluster}}, {{guestname}}, {{node}}, {{pool}}, and {{vmid}}, but more might be"
+ . " added in the future. Needs to be a single line, newline and backslash need to be"
+ . " escaped as '\\n' and '\\\\' respectively.",
requires => 'storage',
maxLength => 1024,
optional => 1,
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread