[pve-devel] [PATCH manager 2/2] replication: refuse to create jobs with nothing to do

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Jun 27 14:55:45 CEST 2017


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();
-- 
2.11.0





More information about the pve-devel mailing list