[pve-devel] [PATCH proxmox-widget-toolkit] parse_task_upid: Allow additional (optional) task_id field
Dietmar Maurer
dietmar at proxmox.com
Tue Apr 9 13:17:35 CEST 2019
We need that if tasks runs inside multi-threaded applications (several
tasks inside one process).
---
Utils.js | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/Utils.js b/Utils.js
index 93ccc01..a9843a3 100644
--- a/Utils.js
+++ b/Utils.js
@@ -571,17 +571,20 @@ Ext.define('Proxmox.Utils', { utilities: {
parse_task_upid: function(upid) {
var task = {};
- var res = upid.match(/^UPID:(\S+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8,9}):([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]*):([^:\s]+):$/);
+ var res = upid.match(/^UPID:([^\s:]+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8,9}):(([0-9A-Fa-f]{8,16}):)?([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]*):([^:\s]+):$/);
if (!res) {
throw "unable to parse upid '" + upid + "'";
}
task.node = res[1];
task.pid = parseInt(res[2], 16);
task.pstart = parseInt(res[3], 16);
- task.starttime = parseInt(res[4], 16);
- task.type = res[5];
- task.id = res[6];
- task.user = res[7];
+ if (res[5] !== undefined) {
+ task.task_id = parseInt(res[5], 16);
+ }
+ task.starttime = parseInt(res[6], 16);
+ task.type = res[7];
+ task.id = res[8];
+ task.user = res[9];
task.desc = Proxmox.Utils.format_task_description(task.type, task.id);
--
2.11.0
More information about the pve-devel
mailing list