[pve-devel] [RFC PATCH manager 1/1] close #6306: ui: display vmname in addition to vmid in task list

Michael Köppl m.koeppl at proxmox.com
Mon May 5 17:29:54 CEST 2025


The information displayed in the task list is based on the content of
/var/log/pve/tasks/index, which does not contain the VM/CT name.
The vmname is, however, available through the PVEResources store. The
render function is therefore adapted to find the name matching the vmid
and uses existing functions for rendering the information correctly. The
order of vmid and vmname is dependent on the sort key chosen in the tree
settings (either sorted by VMID or Name).

Signed-off-by: Michael Köppl <m.koeppl at proxmox.com>
---
This patch only partially closes #6306 [0]. I've invested some time 
looking into adding vmname to logging messages such as 'Starting Backup
of VM 100' as well. Generally, there are many cases where we display a
VMID in relation to a task, thus using /var/log/pve/tasks/index as the
source for the VMID and other information, such as the task type. The
logging in the task viewer is one of those cases. It seems to me that
the cleanest solution would be to add the vmname when we encode content
for this file and consider it when decoding. There are upid_encode and
upid_decode functions in pve-common for this. A quick grep suggests that
we always use these functions when accessing this file. Still, I do not
feel comfortable making this change without properly understanding the
implications of it. Perhaps someone more knowledgeable in this regard 
could chime in, I'd love some input on whether this approach makes sense
or if it's even worth the effort, considering we're talking about a
purely visual motivation (displaying the vmname) for this change. Or
maybe I'm just not seeing a more obvious solution.

If a change to the upid_encode and upid_decode functions should be the
preferred solution, this patch probably is not a good solution anymore,
as the vmname would then also be available in record.data.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=6306

 www/manager6/dc/Tasks.js | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/www/manager6/dc/Tasks.js b/www/manager6/dc/Tasks.js
index f68bd5e9..579955fc 100644
--- a/www/manager6/dc/Tasks.js
+++ b/www/manager6/dc/Tasks.js
@@ -34,6 +34,16 @@ Ext.define('PVE.dc.Tasks', {
 	    ],
 
 	});
+	let resourcesStore = Ext.create('Ext.data.Store', {
+	    model: 'PVEResources',
+	    autoLoad: true,
+	    filters: [
+		{
+		    property: 'type',
+		    value: /lxc|qemu/,
+		},
+	    ],
+	});
 
 	let run_task_viewer = function() {
 	    var sm = me.getSelectionModel();
@@ -51,6 +61,7 @@ Ext.define('PVE.dc.Tasks', {
 
 	Ext.apply(me, {
 	    store: store,
+	    resourcesStore: resourcesStore,
 	    stateful: false,
 	    viewConfig: {
 		trackOver: false,
@@ -111,7 +122,21 @@ Ext.define('PVE.dc.Tasks', {
 		    header: gettext("Description"),
 		    dataIndex: 'upid',
 		    flex: 1,
-		    renderer: Proxmox.Utils.render_upid,
+		    renderer: function(value, metaData, record) {
+			let vmid = record.data.id;
+			if (vmid) {
+			    let resourceRecord = me.resourcesStore.findRecord('vmid', vmid);
+			    if (resourceRecord) {
+				let vmname = resourceRecord.get('name');
+				record.data.id = PVE.Utils.getFormattedGuestIdentifier(vmid, vmname);
+			    }
+			}
+			return Proxmox.Utils.render_upid(
+			    value,
+			    metaData,
+			    record,
+			);
+		    },
 		},
 		{
 		    header: gettext("Status"),
-- 
2.39.5





More information about the pve-devel mailing list