[pve-devel] [PATCH pve-zsync 2/5] update list output and include vmtype

Wolfgang Link w.link at proxmox.com
Thu Nov 5 09:00:27 CET 2015


---
 pve-zsync | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pve-zsync b/pve-zsync
index 1211ff1..302c33e 100644
--- a/pve-zsync
+++ b/pve-zsync
@@ -217,6 +217,7 @@ sub add_state_to_job {
 
     $job->{state} = $state->{state};
     $job->{lsync} = $state->{lsync};
+    $job->{vm_type} = $state->{vm_type};
 
     for (my $i = 0; $state->{"snap$i"}; $i++) {
 	$job->{"snap$i"} = $state->{"snap$i"};
@@ -315,6 +316,7 @@ sub update_state {
     if ($job->{state} ne "del") {
 	$state->{state} = $job->{state};
 	$state->{lsync} = $job->{lsync};
+	$state->{vm_type} = $job->{vm_type};
 
 	for (my $i = 0; $job->{"snap$i"} ; $i++) {
 	    $state->{"snap$i"} = $job->{"snap$i"};
@@ -413,15 +415,16 @@ sub list {
 
     my $cfg = read_cron();
 
-    my $list = sprintf("%-25s%-15s%-7s%-20s%-5s\n" , "SOURCE", "NAME", "STATE", "LAST SYNC", "TYPE");
+    my $list = sprintf("%-25s%-10s%-7s%-20s%-5s%-5s\n" , "SOURCE", "NAME", "STATE", "LAST SYNC", "TYPE", "CON");
 
     my $states = read_state();
     foreach my $source (sort keys%{$cfg}) {
 	foreach my $name (sort keys%{$cfg->{$source}}) {
 	    $list .= sprintf("%-25s", cut_target_width($source, 25));
-	    $list .= sprintf("%-15s", cut_target_width($name, 15));
+	    $list .= sprintf("%-10s", cut_target_width($name, 10));
 	    $list .= sprintf("%-7s", $states->{$source}->{$name}->{state});
 	    $list .= sprintf("%-20s",$states->{$source}->{$name}->{lsync});
+	    $list .= sprintf("%-5s",$states->{$source}->{$name}->{vm_type});
 	    $list .= sprintf("%-5s\n",$cfg->{$source}->{$name}->{method});
 	}
     }
@@ -475,6 +478,7 @@ sub init {
     die "Pool $source->{path} does not exists\n" if undef($check);
 
     my $vm_type = vm_exists($source);
+    $job->{vm_type} = $vm_type;
 
     die "VM $source->{vmid} doesn't exist\n" if $param->{vmid} && !$vm_type;
 
-- 
2.1.4




More information about the pve-devel mailing list