From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 DDE2F621B5 for ; Wed, 19 Jan 2022 15:38:17 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D14D11A870 for ; Wed, 19 Jan 2022 15:38:17 +0100 (CET) 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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 736141A863 for ; Wed, 19 Jan 2022 15:38:16 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 49AA8460BD for ; Wed, 19 Jan 2022 15:38:16 +0100 (CET) Date: Wed, 19 Jan 2022 15:38:09 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Fabian Ebner , pve-devel@lists.proxmox.com References: <20211222135257.3242938-1-f.gruenbichler@proxmox.com> <20211222135257.3242938-20-f.gruenbichler@proxmox.com> <7c98a8c9-bf80-383c-f282-a6af80c460ef@proxmox.com> In-Reply-To: <7c98a8c9-bf80-383c-f282-a6af80c460ef@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1642602909.iv0jp1c39k.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.215 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH v3 storage 2/4] storage_migrate: pull out snapshot decision X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jan 2022 14:38:17 -0000 On January 5, 2022 10:00 am, Fabian Ebner wrote: > Am 22.12.21 um 14:52 schrieb Fabian Gr=C3=BCnbichler: >> into new top-level helper for re-use with remote migration. >>=20 >> Signed-off-by: Fabian Gr=C3=BCnbichler >> --- >> new in v3 >>=20 >> PVE/Storage.pm | 14 ++++++++++---- >> 1 file changed, 10 insertions(+), 4 deletions(-) >>=20 >> diff --git a/PVE/Storage.pm b/PVE/Storage.pm >> index 05be3dd..4f3a44a 100755 >> --- a/PVE/Storage.pm >> +++ b/PVE/Storage.pm >> @@ -643,6 +643,14 @@ my $volname_for_storage =3D sub { >> } >> }; >> =20 >> +# whether a migration snapshot is needed for a given storage >> +sub storage_migrate_snapshot { >> + my ($cfg, $storeid) =3D @_; >> + my $scfg =3D storage_config($cfg, $storeid); >> + >> + return $scfg->{type} eq 'zfspool' || $scfg->{type} eq 'btrfs'; >> +} >> + >> sub storage_migrate { >> my ($cfg, $volid, $target_sshinfo, $target_storeid, $opts, $logfun= c) =3D @_; >> =20 >> @@ -688,10 +696,8 @@ sub storage_migrate { >> =20 >> my $migration_snapshot; >> if (!defined($snapshot)) { >> - if ($scfg->{type} eq 'zfspool' || $scfg->{type} eq 'btrfs') { >> - $migration_snapshot =3D 1; >> - $snapshot =3D '__migration__'; >> - } >> + $migration_snapshot =3D storage_migrate_snapshot->($cfg, $target_store= id); >=20 > The call is wrong, because of the -> that's a fixup gone wrong (got cleaned up in a later patch instead of=20 folding that chunk into this one) > And why base the decision on the target storage rather than keeping it=20 > based on the source storage? That breaks migration from e.g. lvm-thin to=20 > btrfs, because it now tries to use a snapshot and doesn't find any=20 > common transfer format anymore. and yeah, this should be $storeid, not $target_storeid (ZFS only allows=20 importing from ZFS, so it was not affected). >=20 >> + $snapshot =3D '__migration__' if $migration_snapshot; >> } >> =20 >> my @formats =3D volume_transfer_formats($cfg, $volid, $target_voli= d, $snapshot, $base_snapshot, $with_snapshots); >=20