[pve-devel] [PATCH qemu-server] fix #3324: clone disk: use larger blocksize for EFI disk when possible

Fabian Ebner f.ebner at proxmox.com
Tue Mar 2 08:11:58 CET 2021


Am 01.03.21 um 11:18 schrieb Dietmar Maurer:
> 
>>>>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
>>>>> index f401baf..e579cdf 100644
>>>>> --- a/PVE/QemuServer.pm
>>>>> +++ b/PVE/QemuServer.pm
>>>>> @@ -6991,7 +6991,15 @@ sub clone_disk {
>>>>>            # that is given by the OVMF_VARS.fd
>>>>>            my $src_path = PVE::Storage::path($storecfg, $drive->{file});
>>>>>            my $dst_path = PVE::Storage::path($storecfg, $newvolid);
>>>>> -        run_command(['qemu-img', 'dd', '-n', '-O', $dst_format,
>>>>> "bs=1", "count=$size",
>>>>> +
>>>>> +        # Ceph doesn't like too small blocksize, see bug #3324
>>>>> +        my $bs = 1;
>>>>> +        while ($bs < $size && $bs < 1024 && $size % $bs == 0) {
>>>>> +            $bs *= 2;
>>>>> +        }
> 
> now, $size % $bs != 0
> 
> I guess this is wrong...
> 

Sorry about the confusion yesterday. Of course you are right.

>>>>> +        my $count = $size / $bs;
>>>>> +
>>>>> +        run_command(['qemu-img', 'dd', '-n', '-O', $dst_format,
>>>>> "bs=$bs", "count=$count",
>>>>>                "if=$src_path", "of=$dst_path"]);
>>>>>            } else {
>>>>>            qemu_img_convert($drive->{file}, $newvolid, $size,
>>>>> $snapname, $sparseinit);
>>>>>
>>
>>
>> _______________________________________________
>> pve-devel mailing list
>> pve-devel at lists.proxmox.com
>> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel





More information about the pve-devel mailing list