public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH manager/guest-common/docs v2 0/3] fix #5990: vzdump: notes template: add pool variable
@ 2026-11-24  6:58 Michal Fox
  2026-11-24  6:58 ` [PATCH manager v2 1/3] " Michal Fox
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michal Fox @ 2026-11-24  6:58 UTC (permalink / raw)
  To: pve-devel

Add a {{pool}} variable for the notes template of backups, which is
replaced with the resource pool the guest is a member of, so backups
can be told apart by pool later on.

1/3 adds the variable and lists it in the hint of the backup dialogs,
2/3 mentions it in the description of the 'notes-template' option and
3/3 in the documentation.

v2: rebased on current master


manager:

Michal Fox (1):
  fix #5990: vzdump: notes template: add pool variable

 PVE/VZDump.pm         | 3 ++-
 www/manager6/Utils.js | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)


guest-common:

Michal Fox (1):
  vzdump: notes template: mention pool variable in description

 src/PVE/VZDump/Common.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


docs:

Michal Fox (1):
  vzdump: notes template: document pool variable

 vzdump.adoc | 1 +
 1 file changed, 1 insertion(+)


-- 
2.43.0




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH manager v2 1/3] fix #5990: vzdump: notes template: add pool variable
  2026-11-24  6:58 [PATCH manager/guest-common/docs v2 0/3] fix #5990: vzdump: notes template: add pool variable Michal Fox
@ 2026-11-24  6:58 ` Michal Fox
  2026-11-24  6:58 ` [PATCH guest-common v2 2/3] vzdump: notes template: mention pool variable in description Michal Fox
  2026-11-24  6:58 ` [PATCH docs v2 3/3] vzdump: notes template: document pool variable Michal Fox
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Fox @ 2026-11-24  6:58 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 5b9397c..a62fd93 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -112,7 +112,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|uid|vmid)$/;
+            if $var !~ /^(cluster|guestname|node|pool|uid|vmid)$/;
     }
 
     die "found unknown: " . join(', ', @problematic) . "\n" if scalar(@problematic);
@@ -127,6 +127,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 3c0b030..3213b23 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -2150,7 +2150,7 @@ Ext.define('PVE.Utils', {
             return value.replace(/(\\\\|\\n)/g, (match) => replace[match]);
         },
 
-        notesTemplateVars: ['cluster', 'guestname', 'node', 'uid', 'vmid'],
+        notesTemplateVars: ['cluster', 'guestname', 'node', 'pool', 'uid', 'vmid'],
 
         renderTags: function (tagstext, overrides) {
             let text = '';
-- 
2.43.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH guest-common v2 2/3] vzdump: notes template: mention pool variable in description
  2026-11-24  6:58 [PATCH manager/guest-common/docs v2 0/3] fix #5990: vzdump: notes template: add pool variable Michal Fox
  2026-11-24  6:58 ` [PATCH manager v2 1/3] " Michal Fox
@ 2026-11-24  6:58 ` Michal Fox
  2026-11-24  6:58 ` [PATCH docs v2 3/3] vzdump: notes template: document pool variable Michal Fox
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Fox @ 2026-11-24  6:58 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 1f66b85..0baea98 100644
--- a/src/PVE/VZDump/Common.pm
+++ b/src/PVE/VZDump/Common.pm
@@ -364,9 +364,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}}, {{uid}}, 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}}, {{uid}}, 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

* [PATCH docs v2 3/3] vzdump: notes template: document pool variable
  2026-11-24  6:58 [PATCH manager/guest-common/docs v2 0/3] fix #5990: vzdump: notes template: add pool variable Michal Fox
  2026-11-24  6:58 ` [PATCH manager v2 1/3] " Michal Fox
  2026-11-24  6:58 ` [PATCH guest-common v2 2/3] vzdump: notes template: mention pool variable in description Michal Fox
@ 2026-11-24  6:58 ` Michal Fox
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Fox @ 2026-11-24  6:58 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Michal Fox <me@dualfroz.com>
---
 vzdump.adoc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vzdump.adoc b/vzdump.adoc
index f1df4df..c3c283d 100644
--- a/vzdump.adoc
+++ b/vzdump.adoc
@@ -445,6 +445,7 @@ Currently supported are:
 * `{{cluster}}` the cluster name, if any
 * `{{guestname}}` the virtual guest's assigned name
 * `{{node}}` the host name of the node the backup is being created
+* `{{pool}}` the resource pool the guest is a member of, if any
 * `{{uid}}` the `uid` of the xref:guest_identity[guest identity] in the backup,
   if any
 * `{{vmid}}` the numerical VMID of the guest
-- 
2.43.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-24  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24  6:58 [PATCH manager/guest-common/docs v2 0/3] fix #5990: vzdump: notes template: add pool variable Michal Fox
2026-11-24  6:58 ` [PATCH manager v2 1/3] " Michal Fox
2026-11-24  6:58 ` [PATCH guest-common v2 2/3] vzdump: notes template: mention pool variable in description Michal Fox
2026-11-24  6:58 ` [PATCH docs v2 3/3] vzdump: notes template: document pool variable Michal Fox

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