[pve-devel] [PATCH pve-manager 15/18] PVE::Replication::remote_prepare_local_job - new helper
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon May 29 08:20:00 CEST 2017
On Tue, May 23, 2017 at 09:08:54AM +0200, Dietmar Maurer wrote:
> Simple wrapper to call "pvesr prepare-local-job" on a remote
> cluster node.
>
> Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> ---
> PVE/Replication.pm | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/PVE/Replication.pm b/PVE/Replication.pm
> index 0a0ed436..9f5fea1e 100644
> --- a/PVE/Replication.pm
> +++ b/PVE/Replication.pm
> @@ -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);
which was 'print to_json($something)' on the other side - IMHO the other
side should use encode_json, but if not, this one here should use
from_json I guess?
> + };
> +
> + 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) = @_;
>
> --
> 2.11.0
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
More information about the pve-devel
mailing list