remove outdated unused API2::Storage::Replication module
this was not installed, had references to non-existing modules (e.g., PVE::ReplicationTools) and the things it probably was intended for are done in pve-manager, which has full access to all pve perl libs and API methods (from a dependency POV) Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
@ -1,114 +0,0 @@
|
||||
package PVE::API2::Storage::Replication;
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use PVE::JSONSchema qw(get_standard_option);
|
||||
use PVE::RPCEnvironment;
|
||||
use PVE::ReplicationTools;
|
||||
|
||||
use PVE::RESTHandler;
|
||||
|
||||
use base qw(PVE::RESTHandler);
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
name => 'index',
|
||||
path => '',
|
||||
method => 'GET',
|
||||
permissions => { user => 'all' },
|
||||
description => "Directory index.",
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
properties => {
|
||||
node => get_standard_option('pve-node'),
|
||||
},
|
||||
},
|
||||
returns => {
|
||||
type => 'array',
|
||||
items => {
|
||||
type => "object",
|
||||
properties => {},
|
||||
},
|
||||
links => [ { rel => 'child', href => "{name}" } ],
|
||||
},
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
return [
|
||||
{ name => 'jobs' },
|
||||
];
|
||||
}});
|
||||
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
name => 'jobs',
|
||||
path => 'jobs',
|
||||
method => 'GET',
|
||||
description => "List replication jobs.",
|
||||
permissions => {
|
||||
description => "Only list jobs where you have VM.Audit permissons on /vms/<vmid>.",
|
||||
user => 'all',
|
||||
},
|
||||
protected => 1,
|
||||
proxyto => 'node',
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
properties => {
|
||||
node => get_standard_option('pve-node'),
|
||||
},
|
||||
},
|
||||
returns => {
|
||||
type => 'array',
|
||||
items => {
|
||||
type => "object",
|
||||
properties => {},
|
||||
},
|
||||
links => [ { rel => 'child', href => "{vmid}" } ],
|
||||
},
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
my $authuser = $rpcenv->get_user();
|
||||
|
||||
my $jobs = PVE::ReplicationTools::get_all_jobs();
|
||||
|
||||
my $res = [];
|
||||
foreach my $vmid (sort keys %$jobs) {
|
||||
next if !$rpcenv->check($authuser, "/vms/$vmid", [ 'VM.Audit' ]);
|
||||
my $job = $jobs->{$vmid};
|
||||
$job->{vmid} = $vmid;
|
||||
push @$res, $job;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
name => 'destroy_job',
|
||||
path => 'jobs/vmid',
|
||||
method => 'DELETE',
|
||||
description => "Destroy replication job.",
|
||||
permissions => {
|
||||
check => ['perm', '/vms/{vmid}', ['VM.Config.Disk']],
|
||||
},
|
||||
protected => 1,
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
properties => {
|
||||
vmid => {
|
||||
description => "The VMID of the guest.",
|
||||
type => 'string', format => 'pve-vmid',
|
||||
},
|
||||
},
|
||||
},
|
||||
returns => { type => 'null' },
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
PVE::ReplicationTools::destroy_replica($param->{vmid});
|
||||
|
||||
return undef;
|
||||
}});
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user