mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-03 06:44:03 +00:00
PVE/API2/Replication.pm: add schedule_now API
This commit is contained in:
parent
1ec226c31d
commit
88ea8e67d3
@ -192,6 +192,7 @@ __PACKAGE__->register_method ({
|
||||
my ($param) = @_;
|
||||
|
||||
return [
|
||||
{ name => 'schedule_now' },
|
||||
{ name => 'log' },
|
||||
{ name => 'status' },
|
||||
];
|
||||
@ -311,4 +312,38 @@ __PACKAGE__->register_method({
|
||||
return $lines;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
name => 'schedule_now',
|
||||
path => '{id}/schedule_now',
|
||||
method => 'POST',
|
||||
description => "Schedule replication job to start as soon as possible.",
|
||||
proxyto => 'node',
|
||||
protected => 1,
|
||||
permissions => {
|
||||
check => ['perm', '/storage', ['Datastore.Allocate']],
|
||||
},
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
properties => {
|
||||
id => get_standard_option('pve-replication-id'),
|
||||
node => get_standard_option('pve-node'),
|
||||
},
|
||||
},
|
||||
returns => {
|
||||
type => 'string',
|
||||
},
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
my $jobid = $param->{id};
|
||||
|
||||
my $cfg = PVE::ReplicationConfig->new();
|
||||
my $jobcfg = $cfg->{ids}->{$jobid};
|
||||
|
||||
die "no such replication job '$jobid'\n" if !defined($jobcfg);
|
||||
|
||||
PVE::ReplicationState::schedule_job_now($jobcfg);
|
||||
|
||||
}});
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user