all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager 1/3] replication: refactor source checks on job creation
@ 2020-08-11 12:30 Fabian Grünbichler
  2020-08-11 12:30 ` [pve-devel] [PATCH manager 2/3] replication: target is a required parameter Fabian Grünbichler
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2020-08-11 12:30 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 PVE/API2/ReplicationConfig.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/ReplicationConfig.pm b/PVE/API2/ReplicationConfig.pm
index b85e5804..a8c6213a 100644
--- a/PVE/API2/ReplicationConfig.pm
+++ b/PVE/API2/ReplicationConfig.pm
@@ -119,13 +119,20 @@ __PACKAGE__->register_method ({
 	my $vmlist = PVE::Cluster::get_vmlist();
 
 	my $guest_info = $vmlist->{ids}->{$guest};
+
 	die "Guest '$guest' does not exist.\n"
 	    if !defined($guest_info);
 	die "Target '$param->{target}' does not exist.\n"
 	    if defined($param->{target}) && !defined($nodelist->{$param->{target}});
 
+	my $source = $guest_info->{node};
+	die "Source '$param->{source}' does not match current node of guest '$guest'\n"
+	    if defined($param->{source}) && $param->{source} ne $source;
+
+	$param->{source} //= $source;
+
 	my $guest_class = $PVE::API2::Replication::lookup_guest_class->($guest_info->{type});
-	my $guest_conf = $guest_class->load_config($guest, $guest_info->{node});
+	my $guest_conf = $guest_class->load_config($guest, $source);
 	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;
 
@@ -138,7 +145,6 @@ __PACKAGE__->register_method ({
 	    my $opts = $plugin->check_config($id, $param, 1, 1);
 
 	    $opts->{guest} = $guest;
-	    $opts->{source} //= $vmlist->{ids}->{$guest}->{node};
 
 	    $cfg->{ids}->{$id} = $opts;
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-20 13:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 12:30 [pve-devel] [PATCH manager 1/3] replication: refactor source checks on job creation Fabian Grünbichler
2020-08-11 12:30 ` [pve-devel] [PATCH manager 2/3] replication: target is a required parameter Fabian Grünbichler
2020-08-11 12:31 ` [pve-devel] [PATCH manager 3/3] replication: check for source == target on job creation Fabian Grünbichler
2020-08-20 13:27 ` [pve-devel] applied-series: [PATCH manager 1/3] replication: refactor source checks " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal