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 554041FF171
	for <inbox@lore.proxmox.com>; Fri, 29 Nov 2024 15:23:49 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 7A2671AB48;
	Fri, 29 Nov 2024 15:23:46 +0100 (CET)
Message-ID: <d550857b-1801-40f6-a865-e515f9532803@proxmox.com>
Date: Fri, 29 Nov 2024 15:23:43 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Daniel Kral <d.kral@proxmox.com>
References: <20240916163839.236908-1-d.kral@proxmox.com>
 <20240916163839.236908-5-d.kral@proxmox.com>
Content-Language: en-US
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <20240916163839.236908-5-d.kral@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.053 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 <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>

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<PVE::Storage::config>), 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<check_volume_alloc>.
> +
> +=cut
> +
> +sub alloc_volume_disk : prototype($$$$$$) {

I think the volume+disk is redundant. Maybe simply allocate_image or
allocate_volume?

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)?

> +    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