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 DC5051FF16B
for <inbox@lore.proxmox.com>; Thu, 20 Feb 2025 10:35:28 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
by firstgate.proxmox.com (Proxmox) with ESMTP id 62EC5CCC4;
Thu, 20 Feb 2025 10:35:23 +0100 (CET)
Message-ID: <c2963005-0bfc-41c8-81c1-fb6aa8eb7fa1@proxmox.com>
Date: Thu, 20 Feb 2025 10:34:50 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Fiona Ebner <f.ebner@proxmox.com>,
Proxmox VE development discussion <pve-devel@lists.proxmox.com>
References: <20250211160825.254167-1-d.kral@proxmox.com>
<20250211160825.254167-5-d.kral@proxmox.com>
<4e80e33c-caa2-4d8a-9f30-db82521dec08@proxmox.com>
Content-Language: en-US
From: Daniel Kral <d.kral@proxmox.com>
In-Reply-To: <4e80e33c-caa2-4d8a-9f30-db82521dec08@proxmox.com>
X-SPAM-LEVEL: Spam detection results: 0
AWL 0.009 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] [PATCH pve-storage v2 4/5] vdisk_alloc: factor out
optional parameters in options hash argument
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-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>
On 2/20/25 09:49, Fiona Ebner wrote:
> Am 11.02.25 um 17:07 schrieb Daniel Kral:
>> Moves the optional parameter `name` into an optional hash argument at
>> the end of the function.
>>
>> This allows to add more optional arguments in the future and makes the
>> function call easier to follow when a name is not required.
>>
>> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
>> ---
>
> While the cover letter already talks about it, it never hurts to
> explicitly mention that this requires a versioned breaks for qemu-server
> and pve-container again in the patch itself.
>
>> changes since v1:
>> - new!
>>
>> src/PVE/API2/Storage/Content.pm | 6 +++---
>> src/PVE/GuestImport.pm | 2 +-
>> src/PVE/Storage.pm | 30 ++++++++++++++++++++++++++++--
>> src/test/run_test_zfspoolplugin.pl | 8 ++++----
>> 4 files changed, 36 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/PVE/API2/Storage/Content.pm b/src/PVE/API2/Storage/Content.pm
>> index fe0ad4a..77924a6 100644
>> --- a/src/PVE/API2/Storage/Content.pm
>> +++ b/src/PVE/API2/Storage/Content.pm
>> @@ -220,9 +220,9 @@ __PACKAGE__->register_method ({
>>
>> my $cfg = PVE::Storage::config();
>>
>> - my $volid = PVE::Storage::vdisk_alloc ($cfg, $storeid, $param->{vmid},
>> - $param->{format},
>> - $name, $size);
>> + my $volid = PVE::Storage::vdisk_alloc($cfg, $storeid, $param->{vmid}, $param->{format}, $size, {
>> + name => $name,
>> + });
>
> Style nit: the first line is still too long and just having the last
> param split out like this looks kinda wonky here. I'd go for this instead:
Will do so (also at other locations where this happened)!
>
>> my $volid = PVE::Storage::vdisk_alloc(
>> $cfg, $storeid, $param->{vmid}, $param->{format}, $size, { name => $name });
>
>
>>
>> return $volid;
>> }});
>
> ---snip 8<---
>
>> diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
>> index 0134893..3776565 100755
>> --- a/src/PVE/Storage.pm
>> +++ b/src/PVE/Storage.pm
>> @@ -1041,8 +1041,34 @@ sub unmap_volume {
>> return $plugin->unmap_volume($storeid, $scfg, $volname, $snapname);
>> }
>>
>> -sub vdisk_alloc {
>> - my ($cfg, $storeid, $vmid, $fmt, $name, $size) = @_;
>> +=head3 vdisk_alloc($cfg, $storeid, $vmid, $size, %opts)
>
> It's missing $fmt here.
Sorry, yes it does! Thanks for spotting this and will take more care
with the documentation when preparing the v3.
>
>> +
>> +Allocates a volume on the storage with the identifier C<$storeid> (defined in the storage config
>> +C<$cfg>) for the VM with the id C<$vmid> with format C<$fmt> and a size of C<$size> kilobytes.
>> +
>> +The format C<$fmt> can be C<'raw'>, C<'qcow2'>, C<'subvol'> or C<'vmdk'>. If C<$fmt> is left
>> +undefined, it will fallback on the default format of the storage type of C<$storeid>.
>> +
>> +Optionally, the following key-value pairs are available for C<%opts>:
>> +
>> +=over
>> +
>> +=item * C<< $name => $string >>
>> +
>> +Specifies the name of the new volume.
>> +
>> +If undefined, the name will be generated with C<PVE::Storage::Plugin::find_free_diskname>.
>
> This might be true for our plugins, but other plugins might not use this
> method. I'd just mention that it will be generated, but not how.
Will do so!
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel