PVE::API2::Storage::Replication->jobs(): return array
This commit is contained in:
@ -55,11 +55,20 @@ __PACKAGE__->register_method ({
|
||||
node => get_standard_option('pve-node'),
|
||||
},
|
||||
},
|
||||
returns => { type => 'object' },
|
||||
returns => {
|
||||
type => 'array',
|
||||
items => {
|
||||
type => "object",
|
||||
properties => {},
|
||||
},
|
||||
links => [ { rel => 'child', href => "{vmid}" } ],
|
||||
},
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
return PVE::ReplicationTools::get_all_jobs();
|
||||
my $jobs = PVE::ReplicationTools::get_all_jobs();
|
||||
|
||||
return PVE::RESTHandler::hash_to_array($jobs, 'vmid');
|
||||
}});
|
||||
|
||||
1;
|
||||
|
||||
@ -22,16 +22,16 @@ sub setup_environment {
|
||||
}
|
||||
|
||||
my $print_job_list = sub {
|
||||
my ($conf) = @_;
|
||||
my ($list) = @_;
|
||||
|
||||
printf("%-10s%-20s%-20s%-5s%-10s%-5s\n",
|
||||
"VMID", "DEST", "LAST SYNC","IVAL", "STATE", "FAIL");
|
||||
|
||||
foreach my $vmid (sort keys %$conf) {
|
||||
my $job = $conf->{$vmid};
|
||||
foreach my $job (sort { $a->{vmid} <=> $b->{vmid} } @$list) {
|
||||
|
||||
my $timestr = strftime("%Y-%m-%d_%H:%M:%S", localtime($job->{lastsync}));
|
||||
|
||||
printf("%-9s ", $vmid);
|
||||
printf("%-9s ", $job->{vmid});
|
||||
printf("%-19s ", $job->{tnode});
|
||||
printf("%-19s ", $timestr);
|
||||
printf("%-4s ", $job->{interval});
|
||||
|
||||
Reference in New Issue
Block a user