[pve-devel] [PATCH manager 2/4] api: ceph pools: add type to returned properties

Aaron Lauterer a.lauterer at proxmox.com
Mon May 2 09:19:10 CEST 2022



On 5/2/22 09:11, Dominik Csapak wrote:
> one nit inline
> 
> On 4/29/22 16:16, Aaron Lauterer wrote:
>> The osd dump already contains the pool type in numerical format.
>>
>> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
>> ---
>>   PVE/API2/Ceph/Pools.pm | 14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>>
>> diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
>> index efdee360..b93f87e4 100644
>> --- a/PVE/API2/Ceph/Pools.pm
>> +++ b/PVE/API2/Ceph/Pools.pm
>> @@ -66,6 +66,11 @@ __PACKAGE__->register_method ({
>>               type => 'integer',
>>               title => 'Size',
>>           },
>> +        type => {
>> +            type => 'string',
>> +            title => 'Type',
>> +            enum => ['replicated', 'erasure', 'unknown'],
>> +        },
>>           min_size => {
>>               type => 'integer',
>>               title => 'Min Size',
>> @@ -185,6 +190,15 @@ __PACKAGE__->register_method ({
>>           $d->{bytes_used} = $s->{bytes_used};
>>           $d->{percent_used} = $s->{percent_used};
>>           }
>> +
>> +        if ($e->{type} == 1) {
>> +        $d->{type} = 'replicated';
>> +        } elsif ($e->{type} == 3) {
>> +        $d->{type} = 'erasure';
>> +        } else {
>> +        # we should never get here, but better be safe
>> +        $d->{type} = 'unknown';
>> +        }
> 
> i remember we talked off-list about those '1' / '3' values,
> but is there any reference we can use to document these?
> (as comment or commit message)
> 
> even if it's only a link to some github or refence to a file in
> some commit hash of ceph, that way we can easily look it up
> if it changes

sure
> 
> also what would be value '2' ?

beats me, didn't find anything ;)

> 
>>           push @$data, $d;
>>       }
> 
> 





More information about the pve-devel mailing list