public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager 1/3] fix #5990: vzdump: notes template: add pool variable
Date: Tue,  6 Oct 2026 07:50:49 +0000	[thread overview]
Message-ID: <20261006075051.7-2-me@dualfroz.com> (raw)
In-Reply-To: <20261006075051.7-1-me@dualfroz.com>

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




  reply	other threads:[~2026-10-06  7:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20261006075051.7-2-me@dualfroz.com \
    --to=me@dualfroz.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal