fix #5990: vzdump: notes template: add pool variable

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>
This commit is contained in:
dualfroz committed 2026-10-03 01:13:05 +02:00
1 parent 9584686a33
commit bddd179228
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -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},
};
+1 -1
View File
@@ -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 = '';