[pve-devel] [PATCH 3/3] drive_mirror : add support for nbd uri target
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Oct 12 09:57:42 CEST 2016
Same here, should be before patch 1, as patch 1 already uses this code
(or at least the changes)
On 10/11/2016 04:45 PM, Alexandre Derumier wrote:
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
> PVE/QemuServer.pm | 21 +++++++++++++++------
> 1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index b80f8f1..bbee7cd 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -5800,16 +5800,25 @@ sub qemu_img_format {
> sub qemu_drive_mirror {
> my ($vmid, $drive, $dst_volid, $vmiddst, $is_zero_initialized) = @_;
>
> - my $storecfg = PVE::Storage::config();
> - my ($dst_storeid, $dst_volname) = PVE::Storage::parse_volume_id($dst_volid);
> + my $qemu_target;
> + my $format;
> +
> + if($dst_volid =~ /^nbd:/) {
> + $qemu_target = $dst_volid;
> + $format = "nbd";
> + } else {
>
> - my $dst_scfg = PVE::Storage::storage_config($storecfg, $dst_storeid);
> + my $storecfg = PVE::Storage::config();
> + my ($dst_storeid, $dst_volname) = PVE::Storage::parse_volume_id($dst_volid);
>
> - my $format = qemu_img_format($dst_scfg, $dst_volname);
> + my $dst_scfg = PVE::Storage::storage_config($storecfg, $dst_storeid);
> +
> + $format = qemu_img_format($dst_scfg, $dst_volname);
>
> - my $dst_path = PVE::Storage::path($storecfg, $dst_volid);
> + my $dst_path = PVE::Storage::path($storecfg, $dst_volid);
>
> - my $qemu_target = $is_zero_initialized ? "zeroinit:$dst_path" : $dst_path;
> + $qemu_target = $is_zero_initialized ? "zeroinit:$dst_path" : $dst_path;
> + }
>
> my $opts = { timeout => 10, device => "drive-$drive", mode => "existing", sync => "full", target => $qemu_target };
> $opts->{format} = $format if $format;
More information about the pve-devel
mailing list