all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: Dietmar Maurer <dietmar@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Stefan Reiter <s.reiter@proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server] fix #3324: clone disk: use larger blocksize for EFI disk when possible
Date: Mon, 1 Mar 2021 11:22:29 +0100	[thread overview]
Message-ID: <2faca1b5-fa84-e5a2-5c20-25a3925fa385@proxmox.com> (raw)
In-Reply-To: <909038762.124.1614593932855@webmail.proxmox.com>

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...
> 

No, because of the $bs < $size check first. If we enter the loop, $size 
was a multiple of $bs and at least twice $bs. I wrote it like this 
because it'd avoid an endless loop if for whatever reason $size is 0.

>>>>> +        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@lists.proxmox.com
>> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




  reply	other threads:[~2021-03-01 10:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01  9:42 Fabian Ebner
2021-03-01  9:54 ` Stefan Reiter
2021-03-01 10:06   ` Fabian Ebner
2021-03-01 10:13     ` Stefan Reiter
2021-03-01 10:18       ` Dietmar Maurer
2021-03-01 10:22         ` Fabian Ebner [this message]
2021-03-02  7:11         ` Fabian Ebner
2021-03-01 10:19       ` Fabian Ebner
2021-03-01 10:23 ` Fabian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2faca1b5-fa84-e5a2-5c20-25a3925fa385@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=dietmar@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.reiter@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal