From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D47711FF15C for ; Wed, 22 Jan 2025 14:19:24 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B4EAB1F25F; Wed, 22 Jan 2025 14:19:21 +0100 (CET) Message-ID: Date: Wed, 22 Jan 2025 14:18:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Fiona Ebner , Proxmox VE development discussion References: <20240916163839.236908-1-d.kral@proxmox.com> <20240916163839.236908-5-d.kral@proxmox.com> Content-Language: en-US From: Daniel Kral In-Reply-To: X-SPAM-LEVEL: Spam detection results: 0 AWL 0.012 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] [RFC qemu-server 4/9] api: clone_vm: add check if storage supports vm images 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: , Reply-To: Proxmox VE development discussion Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On 11/29/24 15:23, Fiona Ebner wrote: > Am 16.09.24 um 18:38 schrieb Daniel Kral: >> @@ -197,6 +198,25 @@ sub check_volume_alloc : prototype($$;$) { >> return 1; >> } >> >> +=head3 alloc_volume_disk($storecfg, $storeid, $vmid, $format, $name, $size_kb) >> + >> +Allocates a volume disk image on C<$storeid>, that is defined in C<$storecfg> (which is typically >> +retrieved with L), with the VM id C<$vmid>, the format C<$format> (e.g. >> +C<"raw">), the name C<$name> and the image size in kilobytes C<$size_kb>. >> + >> +This subroutine will check whether the storage, where the volume disk image should be allocated, >> +supports the allocation beforehand with L. >> + >> +=cut >> + >> +sub alloc_volume_disk : prototype($$$$$$) { > > I think the volume+disk is redundant. Maybe simply allocate_image or > allocate_volume? ACK > > Thinking about this, are there any cases where we do not want to have > the checks done first? I.e. can we simply add the checks as part of > vdisk_alloc itself (would require passing along the content type for the > checks but would avoid the need for this helper)? AFAICS from a quick grep over all usages of vdisk_alloc (in pve-container and qemu-server), we could move them there. I'll do that if it doesn't break any existing API from the user-side. > >> + my ($storecfg, $storeid, $vmid, $format, $name, $size_kb) = @_; >> + >> + check_volume_alloc($storecfg, $storeid); >> + >> + return PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $format, $name, $size_kb); >> +} >> + >> sub min_version { >> my ($verstr, $major, $minor, $pve) = @_; >> > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel