From 1adc6f7ab33b78b7e6f30b58fc786cc7a03ec8e3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 27 Jun 2017 14:55:45 +0200 Subject: [PATCH] replication: refuse to create jobs with nothing to do When a VM has no disks or all of them are on shared storage the replication job has nothing to do and fails, so catch this when creating a new job. --- PVE/API2/ReplicationConfig.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PVE/API2/ReplicationConfig.pm b/PVE/API2/ReplicationConfig.pm index c5ae76f6..bfaeb49f 100644 --- a/PVE/API2/ReplicationConfig.pm +++ b/PVE/API2/ReplicationConfig.pm @@ -126,7 +126,8 @@ __PACKAGE__->register_method ({ 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 $rep_volumes = $guest_class->get_replicatable_volumes(PVE::Storage::config(), $guest, $guest_conf, 0, 0); + die "No replicatable volumes found\n" if !%$rep_volumes; my $code = sub { my $cfg = PVE::ReplicationConfig->new();