[pve-devel] [PATCH pve-guest-common 2/2] Add check if target exists.

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


---
 PVE/ReplicationConfig.pm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
index 87b3710..1a30e81 100644
--- a/PVE/ReplicationConfig.pm
+++ b/PVE/ReplicationConfig.pm
@@ -193,6 +193,13 @@ sub guest_exists {
 
 }
 
+sub target_exists {
+    my ($class, $target) = @_;
+
+    die "please overwrite in subclass";
+
+}
+
 package PVE::ReplicationConfig::Cluster;
 
 use base qw(PVE::ReplicationConfig);
@@ -236,6 +243,14 @@ sub guest_exists {
     return defined($vmlist->{ids}->{$vmid});
 }
 
+sub target_exists {
+    my ($class, $target) = @_;
+
+    my $nodelist = PVE::Cluster::get_members();
+
+    return defined($nodelist->{$target});
+}
+
 PVE::ReplicationConfig::Cluster->register();
 PVE::ReplicationConfig->init();
 
-- 
2.11.0





More information about the pve-devel mailing list