[pve-devel] [pve-guest-common 1/2] get_jobid

Wolfgang Link w.link at proxmox.com
Fri Jun 9 08:19:47 CEST 2017


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

diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
index 01e7206..b4f0fe9 100644
--- a/PVE/ReplicationConfig.pm
+++ b/PVE/ReplicationConfig.pm
@@ -209,6 +209,20 @@ sub check_for_existing_jobs {
     return undef;
 }
 
+sub get_jobid {
+    my ($cfg, $vmid, $target) = @_;
+
+    foreach my $id (keys %{$cfg->{ids}}) {
+	my $data = $cfg->{ids}->{$id};
+
+	if ($data->{target} eq $target) {
+	    return $id;
+	}
+    }
+
+    return undef;
+}
+
 package PVE::ReplicationConfig::Cluster;
 
 use base qw(PVE::ReplicationConfig);
-- 
2.11.0





More information about the pve-devel mailing list