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 5D1A598AEB for ; Mon, 13 Nov 2023 14:40:13 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3D68F13305 for ; Mon, 13 Nov 2023 14:39:43 +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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 13 Nov 2023 14:39:42 +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 EDA8841CC3 for ; Mon, 13 Nov 2023 14:39:41 +0100 (CET) Message-ID: <76aa4c50-723e-4ba7-86e6-17fe1fde56ad@proxmox.com> Date: Mon, 13 Nov 2023 14:39:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: =?UTF-8?Q?Hannes_D=C3=BCrr?= , Proxmox VE development discussion References: <20231016115920.95859-1-h.duerr@proxmox.com> <5f42156e-a80c-411b-9ce9-782fa72ffb61@proxmox.com> From: Fiona Ebner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.079 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH pve-storage] fix #1611: implement import of base-images for LVM-thin Storage 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: Mon, 13 Nov 2023 13:40:13 -0000 Am 13.11.23 um 14:13 schrieb Hannes Dürr: > > On 11/3/23 11:39, Fiona Ebner wrote: >> 1. check if base >> 2. check if already exists/rename allowed >> 3. call parent plugin's volume_import function passing along >> vm-XYZ-disk-N (or undef if it should be renamed) instead of >> base-XYZ-disk-N >> 4. if it was a base image, handle the conversion to base image >> >> Then there's no need for new helpers either. But this is just a sketch >> of course, didn't think through all details. What do you think? > that sounds good so far, but you can't get around the > "find_free_diskspace()" call, can you ? > Not specifying a name leads to an error in the volume_import of the LVM > plugin, Oh, I see. > because without a name no plugin can be parsed and to get a new name in > the style > of "vm-XYZ-disk-N" you need "find_free_diskspace()" to make sure that > the name does not yet exist, > or am I missing something ? > > So I'd propose: > > 1. check if base > 2. check if already exists/rename allowed > 3. call parent plugin's volume_import function passing along > vm-XYZ-disk-N generated with "find_free_diskspace(), instead of > base-XYZ-disk-N Yes. And while not super important, we might want to preserve the N in the suffix (or custom disk names). This can be done by only calling find_free_diskname() if an image with the name already exists and the image can be renamed. Otherwise, we can just pass the name with "base-" replaced by "vm-" instead of invoking find_free_diskname(). > 4. if it was a base image, handle the conversion to base image >