[pve-devel] [PATCH pve-guest-common 1/2] Add check if guest exists.
Wolfgang Link
w.link at proxmox.com
Fri Jun 2 11:04:59 CEST 2017
---
PVE/ReplicationConfig.pm | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
index 092c497..87b3710 100644
--- a/PVE/ReplicationConfig.pm
+++ b/PVE/ReplicationConfig.pm
@@ -186,6 +186,13 @@ sub check_for_existing_jobs {
return undef;
}
+sub guest_exists {
+ my ($class, $vmid) = @_;
+
+ die "please overwrite in subclass";
+
+}
+
package PVE::ReplicationConfig::Cluster;
use base qw(PVE::ReplicationConfig);
@@ -221,6 +228,14 @@ sub get_unique_target_id {
return "local/$data->{target}";
}
+sub guest_exists {
+ my ($class, $vmid) = @_;
+
+ my $vmlist = PVE::Cluster::get_vmlist();
+
+ return defined($vmlist->{ids}->{$vmid});
+}
+
PVE::ReplicationConfig::Cluster->register();
PVE::ReplicationConfig->init();
--
2.11.0
More information about the pve-devel
mailing list