[pve-devel] r5729 - in pve-common/trunk/data: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Mar 21 06:58:40 CET 2011


Author: dietmar
Date: 2011-03-21 06:58:40 +0100 (Mon, 21 Mar 2011)
New Revision: 5729

Modified:
   pve-common/trunk/data/ChangeLog
   pve-common/trunk/data/PVE/INotify.pm
   pve-common/trunk/data/PVE/Tools.pm
Log:

simply skip entries we
	cannot parse, add additional 'id' field to upid


Modified: pve-common/trunk/data/ChangeLog
===================================================================
--- pve-common/trunk/data/ChangeLog	2011-03-21 05:44:22 UTC (rev 5728)
+++ pve-common/trunk/data/ChangeLog	2011-03-21 05:58:40 UTC (rev 5729)
@@ -1,3 +1,8 @@
+2011-03-21  Proxmox Support Team  <support at proxmox.com>
+
+	* PVE/INotify.pm (read_active_workers): simply skip entries we
+	cannot parse, add additional 'id' field to upid
+
 2011-03-18  Proxmox Support Team  <support at proxmox.com>
 
 	* PVE/Tools.pm (upid_read_status): read/parse last line from

Modified: pve-common/trunk/data/PVE/INotify.pm
===================================================================
--- pve-common/trunk/data/PVE/INotify.pm	2011-03-21 05:44:22 UTC (rev 5728)
+++ pve-common/trunk/data/PVE/INotify.pm	2011-03-21 05:58:40 UTC (rev 5729)
@@ -618,7 +618,7 @@
 	    my $upid = $1;
 	    my $endtime = $3;
 	    my $status = $4;
-	    if ((my $task = PVE::Tools::upid_decode ($upid))) {
+	    if ((my $task = PVE::Tools::upid_decode($upid, 1))) {
 		$task->{upid} = $upid;
 		if ($endtime && $status) {
 		    $task->{endtime} = hex($endtime);

Modified: pve-common/trunk/data/PVE/Tools.pm
===================================================================
--- pve-common/trunk/data/PVE/Tools.pm	2011-03-21 05:44:22 UTC (rev 5728)
+++ pve-common/trunk/data/PVE/Tools.pm	2011-03-21 05:58:40 UTC (rev 5729)
@@ -475,13 +475,14 @@
 # UPID helper
 # We use this to uniquely identify a process.
 # An 'Unique Process ID' has the following format: 
-# "UPID:$node:$pid:$pstart:$startime:$dtype:$user"
+# "UPID:$node:$pid:$pstart:$startime:$dtype:$id:$user"
 
 sub upid_encode {
     my $d = shift;
 
-    return sprintf("UPID:%s:%08X:%08X:%08X:%s:%s:", $d->{node}, $d->{pid}, 
-		   $d->{pstart}, $d->{starttime}, $d->{type}, $d->{user});
+    return sprintf("UPID:%s:%08X:%08X:%08X:%s:%s:%s:", $d->{node}, $d->{pid}, 
+		   $d->{pstart}, $d->{starttime}, $d->{type}, $d->{id}, 
+		   $d->{user});
 }
 
 sub upid_decode {
@@ -491,13 +492,14 @@
     my $filename;
 
     # "UPID:$node:$pid:$start:$type:$user:"
-    if ($upid =~ m/^UPID:(\w+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]+):$/) {
+    if ($upid =~ m/^UPID:(\w+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]*):([^:\s]+):$/) {
 	$res->{node} = $1;
 	$res->{pid} = hex($2);
 	$res->{pstart} = hex($3);
 	$res->{starttime} = hex($4);
 	$res->{type} = $5;
-	$res->{user} = $6;
+	$res->{id} = $6;
+	$res->{user} = $7;
 
 	my $subdir = substr($4, 7, 8);
 	$filename = "$pvetaskdir/$subdir/$upid";



More information about the pve-devel mailing list