refuse to create replication jobs for unreplicatable VMs

This commit is contained in:
Wolfgang Bumiller 2017-06-26 16:34:33 +02:00 committed by Dietmar Maurer
parent 224c78da76
commit 25420507b2
2 changed files with 7 additions and 2 deletions

View File

@ -20,7 +20,7 @@ use base qw(PVE::RESTHandler);
my $pvesr_lock_path = "/var/lock/pvesr.lck";
my $lookup_guest_class = sub {
our $lookup_guest_class = sub {
my ($vmtype) = @_;
if ($vmtype eq 'qemu') {

View File

@ -118,11 +118,16 @@ __PACKAGE__->register_method ({
my $nodelist = PVE::Cluster::get_members();
my $vmlist = PVE::Cluster::get_vmlist();
my $guest_info = $vmlist->{ids}->{$guest};
die "Guest '$guest' does not exists.\n"
if !defined($vmlist->{ids}->{$guest});
if !defined($guest_info);
die "Target '$param->{target}' does not exists.\n"
if defined($param->{target}) && !defined($nodelist->{$param->{target}});
my $guest_class = $PVE::API2::Replication::lookup_guest_class->($guest_info->{type});
my $guest_conf = $guest_class->load_config($guest);
$guest_class->get_replicatable_volumes(PVE::Storage::config(), $guest, $guest_conf, 0, 0);
my $code = sub {
my $cfg = PVE::ReplicationConfig->new();