[pve-devel] [PATCH pve-manager] Add checks when job is created.

Wolfgang Link w.link at proxmox.com
Fri Jun 2 11:05:01 CEST 2017


We must know if the target and guest exists to avoid creation faulty jobs.
---
 PVE/API2/ReplicationConfig.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/API2/ReplicationConfig.pm b/PVE/API2/ReplicationConfig.pm
index e1623f73..d067356f 100644
--- a/PVE/API2/ReplicationConfig.pm
+++ b/PVE/API2/ReplicationConfig.pm
@@ -107,6 +107,12 @@ __PACKAGE__->register_method ({
 
 	my $type = extract_param($param, 'type');
 	my $plugin = PVE::ReplicationConfig->lookup($type);
+
+	die "Guest does not exists\n"
+	    if !$plugin->guest_exists($param->{guest});
+	die "Target does not exists\n"
+	    if !$plugin->node_exists($param->{target});
+
 	my $id = extract_param($param, 'id');
 
 	my $code = sub {
-- 
2.11.0





More information about the pve-devel mailing list