[pve-devel] [PATCH pve-guest-common 1/5] PVE::ReplicationConfig::find_local_replication_job - new helper

Dietmar Maurer dietmar at proxmox.com
Tue Jun 20 10:50:53 CEST 2017


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 PVE/ReplicationConfig.pm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
index 845d9c3..1e813dd 100644
--- a/PVE/ReplicationConfig.pm
+++ b/PVE/ReplicationConfig.pm
@@ -209,6 +209,19 @@ sub check_for_existing_jobs {
     return undef;
 }
 
+sub find_local_replication_job {
+    my ($cfg, $vmid, $target) = @_;
+
+    foreach my $id (keys %{$cfg->{ids}}) {
+	my $data = $cfg->{ids}->{$id};
+
+	return $data if $data->{type} eq 'local' &&
+	    $data->{guest} == $vmid && $data->{target} eq $target;
+    }
+
+    return undef;
+}
+
 sub delete_job {
     my ($jobid) = @_;
 
-- 
2.11.0




More information about the pve-devel mailing list