From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@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 3297760D88
 for <pve-devel@lists.proxmox.com>; Tue, 15 Dec 2020 14:57:17 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 2209F1311E
 for <pve-devel@lists.proxmox.com>; Tue, 15 Dec 2020 14:57:17 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (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 id D4E3D13112
 for <pve-devel@lists.proxmox.com>; Tue, 15 Dec 2020 14:57:15 +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 C8615451AF
 for <pve-devel@lists.proxmox.com>; Tue, 15 Dec 2020 14:57:14 +0100 (CET)
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Mira Limbeck <m.limbeck@proxmox.com>
References: <20201202125025.27401-1-m.limbeck@proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
Message-ID: <a54eeb72-dada-3cab-a2a8-4c25da6bbfe6@proxmox.com>
Date: Tue, 15 Dec 2020 14:57:14 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101
 Thunderbird/84.0
MIME-Version: 1.0
In-Reply-To: <20201202125025.27401-1-m.limbeck@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.066 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.001 Looks like a legit reply (A)
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 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. [qemuserver.pm]
Subject: Re: [pve-devel] [PATCH v2 qemu-server] fix cloning/restoring of
 cloudinit disks in raw format
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: Tue, 15 Dec 2020 13:57:17 -0000

On 02.12.20 13:50, Mira Limbeck wrote:
> We only added the format extension when it was not 'raw'. But on file l=
evel
> storages we always require it. To fix this, always add the format
> extension if the storage provides the 'path' property.
> This is the same logic we use in create_disks for cloudinit disks.
>=20
> Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
> ---
> v2:
>  - added the same fix when restoring from backup
>=20

clone seems to be fine, even if I slowly start to feel real hatred for th=
ose
cloudinit disk edge cases, anyway, is there an actual reason why we need =
to
restore that disk - isn't in gonna get regenerated on first start anyway?=


>  PVE/QemuServer.pm | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>=20
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 4989938..412113e 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -5797,7 +5797,10 @@ my $restore_allocate_devices =3D sub {
>  	my $name;
>  	if ($d->{is_cloudinit}) {
>  	    $name =3D "vm-$vmid-cloudinit";
> -	    $name .=3D ".$d->{format}" if $d->{format} ne 'raw';
> +	    my $scfg =3D PVE::Storage::storage_config($storecfg, $storeid);
> +	    if ($scfg->{path}) {
> +		$name .=3D ".$d->{format}";
> +	    }
>  	}
> =20
>  	my $volid =3D PVE::Storage::vdisk_alloc(
> @@ -6945,7 +6948,10 @@ sub clone_disk {
>  	my $size =3D undef;
>  	if (drive_is_cloudinit($drive)) {
>  	    $name =3D "vm-$newvmid-cloudinit";
> -	    $name .=3D ".$dst_format" if $dst_format ne 'raw';
> +	    my $scfg =3D PVE::Storage::storage_config($storecfg, $storeid);
> +	    if ($scfg->{path}) {
> +		$name .=3D ".$dst_format";
> +	    }
>  	    $snapname =3D undef;
>  	    $size =3D PVE::QemuServer::Cloudinit::CLOUDINIT_DISK_SIZE;
>  	} elsif ($drivename eq 'efidisk0') {
>=20