[pve-devel] [Patch V4 5/6] Add function: swap source and target in replication config
Wolfgang Link
w.link at proxmox.com
Tue May 8 15:33:43 CEST 2018
---
PVE/ReplicationConfig.pm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
index b6cd514..063299e 100644
--- a/PVE/ReplicationConfig.pm
+++ b/PVE/ReplicationConfig.pm
@@ -258,6 +258,24 @@ sub delete_job {
lock($code);
}
+sub swap_source_target {
+ my ($jobid) = @_;
+
+ my $cfg;
+
+ my $code = sub {
+ $cfg = __PACKAGE__->new();
+ my $job = $cfg->{ids}->{$jobid};
+ my $tmp = $job->{source};
+ $job->{source} = $job->{target};
+ $job->{target} = $tmp;
+ $cfg->write();
+ };
+
+ lock($code);
+ return $cfg->{ids}->{$jobid};
+}
+
package PVE::ReplicationConfig::Cluster;
use base qw(PVE::ReplicationConfig);
--
2.11.0
More information about the pve-devel
mailing list