From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <m.limbeck@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 E2E4E604EC
 for <pve-devel@lists.proxmox.com>; Wed,  2 Dec 2020 12:27:39 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id D05B81B0AC
 for <pve-devel@lists.proxmox.com>; Wed,  2 Dec 2020 12:27:09 +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 6544D1B09E
 for <pve-devel@lists.proxmox.com>; Wed,  2 Dec 2020 12:27:09 +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 2E601447EC
 for <pve-devel@lists.proxmox.com>; Wed,  2 Dec 2020 12:27:09 +0100 (CET)
To: pve-devel@lists.proxmox.com
References: <20201201145301.12838-1-m.limbeck@proxmox.com>
From: Mira Limbeck <m.limbeck@proxmox.com>
Message-ID: <d0aa11a7-0e2e-7034-47f3-2a2da5adba29@proxmox.com>
Date: Wed, 2 Dec 2020 12:27:08 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.5.0
MIME-Version: 1.0
In-Reply-To: <20201201145301.12838-1-m.limbeck@proxmox.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.468 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 qemu-server] fix cloning of cloudinit disks
 in raw format on file level storages
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: Wed, 02 Dec 2020 11:27:39 -0000

Only fixes the clone_disk case, not the restore from backup one. Will 
send a v2 with both fixes.

On 12/1/20 3:53 PM, Mira Limbeck wrote:
> We only added the format extension when it was not 'raw'. But on file level
> 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.
>
> Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
> ---
>   PVE/QemuServer.pm | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 4989938..73dcb05 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6945,7 +6945,10 @@ sub clone_disk {
>   	my $size = undef;
>   	if (drive_is_cloudinit($drive)) {
>   	    $name = "vm-$newvmid-cloudinit";
> -	    $name .= ".$dst_format" if $dst_format ne 'raw';
> +	    my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
> +	    if ($scfg->{path}) {
> +		$name .= ".$dst_format";
> +	    }
>   	    $snapname = undef;
>   	    $size = PVE::QemuServer::Cloudinit::CLOUDINIT_DISK_SIZE;
>   	} elsif ($drivename eq 'efidisk0') {