[pve-devel] [PatchV3 guest-common 5/6] Add function: swap source and target in replication config
Wolfgang Link
w.link at proxmox.com
Tue May 8 08:30:00 CEST 2018
---
PVE/ReplicationConfig.pm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
index b6cd514..a696a81 100644
--- a/PVE/ReplicationConfig.pm
+++ b/PVE/ReplicationConfig.pm
@@ -258,6 +258,23 @@ sub delete_job {
lock($code);
}
+sub swap_source_target {
+ my ($jobid) = @_;
+
+ my $cfg;
+
+ my $code = sub {
+ $cfg = __PACKAGE__->new();
+ my $tmp = $cfg->{ids}->{$jobid}->{source};
+ $cfg->{ids}->{$jobid}->{source} = $cfg->{ids}->{$jobid}->{target};
+ $cfg->{ids}->{$jobid}->{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