From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <l.nunner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id A75A9866E
 for <pve-devel@lists.proxmox.com>; Thu, 31 Aug 2023 11:00:19 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 29B9D74F0
 for <pve-devel@lists.proxmox.com>; Thu, 31 Aug 2023 11:00:19 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Thu, 31 Aug 2023 11:00:18 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 22655478E8
 for <pve-devel@lists.proxmox.com>; Thu, 31 Aug 2023 11:00:18 +0200 (CEST)
Message-ID: <fd223f06-fc7e-f63b-6301-bc5be57e4bb3@proxmox.com>
Date: Thu, 31 Aug 2023 11:00:17 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.14.0
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
References: <20221116110233.54160-1-l.nunner@proxmox.com>
 <fb3e343a-f4b3-535f-2f6a-aad92c341407@proxmox.com>
From: Leo Nunner <l.nunner@proxmox.com>
In-Reply-To: <fb3e343a-f4b3-535f-2f6a-aad92c341407@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.524 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -1.242 Looks like a legit reply (A)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [storage.pm]
Subject: Re: [pve-devel] [PATCH v2 storage] fix #3004: show progress of
 offline migration in task log
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 31 Aug 2023 09:00:19 -0000

Thanks for the review!

On 2023-08-30 10:22, Fiona Ebner wrote:
> Sorry about the late review!
>
> Am 16.11.22 um 12:02 schrieb Leo Nunner:
>> --- a/PVE/Storage.pm
>> +++ b/PVE/Storage.pm
> Needs a rebase, because files got moved to src/
>
>> @@ -821,12 +821,25 @@ sub storage_migrate {
>>  
>>      my $new_volid;
>>      my $pattern = volume_imported_message(undef, 1);
>> -    my $match_volid_and_log = sub {
>> +    # Matches new volid and rate-limits dd output
>> +    my $match_and_log = sub {
> Why rename the function?
>
>>  	my $line = shift;
>> +	my $show = 1;
>> +
>> +	# rate-limit dd logs
>> +	if ($line =~ /(?:\d+ bytes)(?:.+?copied, )(\d+) s/) {
>> +	    if ($1 < 60) { # if < 60s, print every 3s
>> +		$show = !($1 % 3);
>> +	    } elsif($1 < 600) { # if < 10mins, print every 10s
> Style nit: missing space after elsif
>
>> +		$show = !($1 % 10);
>> +	    } else { # else, print every 30s
>> +		$show = !($1 % 30);
>> +	    }
>> +	}
ack, I'll fix those things in the v2.
> Upon completion something strange happens: There's a duplicate final log
> with fractional seconds and duplicate records in/out.

The duplicate logs seem to happen already without my patch:

> 2023-08-31 10:38:54 found local disk
> 'cluster-dir:100/vm-100-disk-0.raw' (attached)
> 2023-08-31 10:38:54 copying local disk images
> 2023-08-31 10:38:56 Formatting
> '/mnt/dir/images/100/vm-100-disk-0.raw', fmt=raw size=2147483648
> preallocation=off
> 2023-08-31 10:39:02 524288+0 records in
> 2023-08-31 10:39:02 524288+0 records out
> 2023-08-31 10:39:02 2147483648 bytes (2.1 GB, 2.0 GiB) copied, 6.52443
> s, 329 MB/s
> 2023-08-31 10:39:02 16749+32053 records in
> 2023-08-31 10:39:02 16749+32053 records out
> 2023-08-31 10:39:02 2147483648 bytes (2.1 GB, 2.0 GiB) copied, 6.22392
> s, 345 MB/s
> 2023-08-31 10:39:02 successfully imported
> 'cluster-dir:100/vm-100-disk-0.raw'
> 2023-08-31 10:39:02 volume 'cluster-dir:100/vm-100-disk-0.raw' is
> 'cluster-dir:100/vm-100-disk-0.raw' on the target
> 2023-08-31 10:39:03 migration finished successfully (duration 00:00:09)
> TASK OK

So this might be something that could be fixed in a separate, future patch.