From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id C4E9E1FF164
	for <inbox@lore.proxmox.com>; Fri,  9 May 2025 12:30:01 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 5DADD3A869;
	Fri,  9 May 2025 12:30:13 +0200 (CEST)
Date: Fri, 9 May 2025 12:30:10 +0200 (CEST)
From: =?UTF-8?Q?Fabian_Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Message-ID: <1833772435.12921.1746786610046@webmail.proxmox.com>
In-Reply-To: <mailman.41.1745322774.394.pve-devel@lists.proxmox.com>
References: <20250422115141.808427-1-alexandre.derumier@groupe-cyllene.com>
 <mailman.41.1745322774.394.pve-devel@lists.proxmox.com>
MIME-Version: 1.0
X-Priority: 3
Importance: Normal
X-Mailer: Open-Xchange Mailer v7.10.6-Rev75
X-Originating-Client: open-xchange-appsuite
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.046 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
 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 qemu-server 12/14] qemu_img convert : add
 external snapshot support
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>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

the commit title is a bit weird, this actually adapts the qemu_img_convert helper
to the new volume_has_feature values, supporting external snapshots is a side effect
of that..

> Alexandre Derumier via pve-devel <pve-devel@lists.proxmox.com> hat am 22.04.2025 13:51 CEST geschrieben:
> for external snapshot, we simply use snap volname as src.
> don't use internal snapshot option in the command line.
> 
> Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
> ---
>  PVE/QemuServer.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 12d60cad..5cce7094 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -7906,11 +7906,11 @@ sub qemu_img_convert {
>      my $dst_format = checked_volume_format($storecfg, $dst_volid);
>      my $dst_path = PVE::Storage::path($storecfg, $dst_volid);
>      my $dst_is_iscsi = ($dst_path =~ m|^iscsi://|);
> +    my $snapshot_type = PVE::Storage::volume_has_feature($storecfg, 'snapshot', $src_volid);
>  
>      my $cmd = [];
>      push @$cmd, '/usr/bin/qemu-img', 'convert', '-p', '-n';
> -    push @$cmd, '-l', "snapshot.name=$snapname"
> -	if $snapname && $src_format && $src_format eq "qcow2";
> +    push @$cmd, '-l', "snapshot.name=$snapname" if $snapname && $snapshot_type == 2;

this breaks backwards compatibility with external plugins that override volume_has_features, and
thus still return '1' while using internal qcow2 snapshots.. I think we need to detect that and
fallback here? or we need to differentiate all four cases:

1: plugin not changed, fallback to format-based decision
2: storage snapshot, no need to pass snapshot name to qemu-img
3: qcow2-internal snapshot, need to pass snapshot name to qemu-img
4: qcow2-external snapshot, no need to pass snapshot name to qemu-img

?

at that point, it might make more sense to actually name those values:

1: plugin not changed, 'legacy' snapshot support
'storage': same semantics as '1', but plugin was updated/doesn't override volume_has_features
'file-internal': same as 3 above
'file-external': same as 4 above

? or if we want to keep volume_has_features the same, we could introduce a new helper that
returns the snapshot type?

>      push @$cmd, '-t', 'none' if $dst_scfg->{type} eq 'zfspool';
>      push @$cmd, '-T', $cachemode if defined($cachemode);
>      push @$cmd, '-r', "${bwlimit}K" if defined($bwlimit);
> -- 
> 2.39.5


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel