]> git.proxmox.com Git - pve-manager.git/commitdiff
PVE::Replication::remote_prepare_local_job - new helper
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 23 May 2017 05:33:46 +0000 (07:33 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 31 May 2017 06:23:47 +0000 (08:23 +0200)
Simple wrapper to call "pvesr prepare-local-job" on a remote
cluster node.

PVE/Replication.pm

index 895939f600bab898041f54e818cc20eb9b2777d0..a3876cf942f1e3a19027da0c89c3ebe1219d0c73 100644 (file)
@@ -165,6 +165,28 @@ sub replication_snapshot_name {
     wantarray ? ($prefix, $snapname) : $snapname;
 }
 
+sub remote_prepare_local_job {
+    my ($ssh_info, $jobid, $vmid, $volumes, $last_sync) = @_;
+
+    my $ssh_cmd = PVE::Cluster::ssh_info_to_command($ssh_info);
+    my $cmd = [@$ssh_cmd, '--', 'pvesr', 'prepare-local-job', $jobid,
+              $vmid, @$volumes, '--last_sync', $last_sync];
+
+    my $remote_snapshots;
+
+    my $parser = sub {
+       my $line = shift;
+       $remote_snapshots = JSON::decode_json($line);
+    };
+
+    PVE::Tools::run_command($cmd, outfunc => $parser);
+
+    die "prepare remote node failed - no result\n"
+       if !defined($remote_snapshots);
+
+    return $remote_snapshots;
+}
+
 sub prepare {
     my ($storecfg, $volids, $jobid, $last_sync, $start_time, $logfunc) = @_;