]> git.proxmox.com Git - pve-guest-common.git/commitdiff
Add config parameter 'source'.
authorWolfgang Link <w.link@proxmox.com>
Wed, 9 May 2018 12:48:22 +0000 (14:48 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 9 May 2018 13:10:30 +0000 (15:10 +0200)
This parameter is useful for restoring the replication status.
It is also corrected if it is missing or wrong.

PVE/ReplicationConfig.pm
PVE/ReplicationState.pm

index 51cfe81ead08fb702a7bbea214a467644973a16a..b6cd51453b2b1dd0957c8f2c24950b2af7242235 100644 (file)
@@ -79,6 +79,11 @@ my $defaultData = {
            default => '*/15',
            optional => 1,
        },
+       source => {
+           description => "Source of the replication.",
+           type => 'string', format => 'pve-node',
+           optional => 1,
+       },
     },
 };
 
@@ -278,6 +283,7 @@ sub options {
        rate => { optional => 1 },
        schedule => { optional => 1 },
        remove_job => { optional => 1 },
+       source => { optional => 1 },
     };
 }
 
index 567535a1f2bf19bf60ef07d841c3a527ff58f71a..085119574dfbe02ecc2f43511e9df8612a05bfc3 100644 (file)
@@ -285,6 +285,11 @@ sub job_status {
 
        $jobcfg->{next_sync} = $next_sync;
 
+       if (!defined($jobcfg->{source}) || $jobcfg->{source} ne $local_node) {
+           $jobcfg->{source} = $cfg->{ids}->{$jobid}->{source} = $local_node;
+           PVE::ReplicationConfig::write($cfg);
+       }
+
        $jobs->{$jobid} = $jobcfg;
     }