[pve-devel] r5733 - pve-common/trunk/data/PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Mar 21 09:43:29 CET 2011


Author: dietmar
Date: 2011-03-21 09:43:29 +0100 (Mon, 21 Mar 2011)
New Revision: 5733

Modified:
   pve-common/trunk/data/PVE/INotify.pm
Log:
add 'saved' flag


Modified: pve-common/trunk/data/PVE/INotify.pm
===================================================================
--- pve-common/trunk/data/PVE/INotify.pm	2011-03-21 06:35:11 UTC (rev 5732)
+++ pve-common/trunk/data/PVE/INotify.pm	2011-03-21 08:43:29 UTC (rev 5733)
@@ -614,20 +614,20 @@
 
     my $res = []; 
     while (defined (my $line = <$fh>)) {
-	if ($line =~ m/^(\S+)(\s([0-9A-Za-z]{8})\s(\S.*))?$/) {
+	if ($line =~ m/^(\S+)\s(0|1)(\s([0-9A-Za-z]{8})(\s(\S.*))?)?$/) {
 	    my $upid = $1;
-	    my $endtime = $3;
-	    my $status = $4;
+	    my $saved = $2;
+	    my $endtime = $4;
+	    my $status = $6;
 	    if ((my $task = PVE::Tools::upid_decode($upid, 1))) {
 		$task->{upid} = $upid;
-		if ($endtime && $status) {
-		    $task->{endtime} = hex($endtime);
-		    $task->{status} = $status;
-		}
+		$task->{saved} = $saved;
+		$task->{endtime} = hex($endtime) if $endtime;
+		$task->{status} = $status if $status;
 		push @$res, $task;
 	    }
 	} else {
-	    warn "unable to parse line";
+	    warn "unable to parse line: $line";
 	}
     }
 
@@ -641,10 +641,15 @@
     my $raw = '';
     foreach my $task (@$tasklist) {
 	my $upid = $task->{upid};
-	if ($task->{endtime} && $task->{status}) {
-	    $raw .= sprintf("$upid %08X $task->{status}\n", $task->{endtime});
+	my $saved = $task->{saved} ? 1 : 0;
+	if ($task->{endtime}) {
+	    if ($task->{status}) {
+		$raw .= sprintf("$upid $saved %08X $task->{status}\n", $task->{endtime});
+	    } else {
+		$raw .= sprintf("$upid $saved %08X\n", $task->{endtime});
+	    }
 	} else {
-	    $raw .= "$upid\n";
+	    $raw .= "$upid $saved\n";
 	}
     }
 




More information about the pve-devel mailing list