public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage] rbd: fix #4060 show data-pool usage when configured
@ 2022-05-17 12:58 Aaron Lauterer
  2022-05-17 14:01 ` Dominik Csapak
  0 siblings, 1 reply; 4+ messages in thread
From: Aaron Lauterer @ 2022-05-17 12:58 UTC (permalink / raw)
  To: pve-devel

When a data-pool is configured, use it for status infos. The 'data-pool'
config option is used to mark the erasure coded pool while the 'pool'
will be the replicated pool holding meta data such as the omap.

This means, the 'pool' will only use a small amount of space and people
are interested how much they can store in the erasure coded pool anyway.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
I decided to check for the IMO more likely case first and check against
a configured data-pool. Afterwards check if we actually need to set the
default pool name in case the pool property is omitted in the storage
config.

 PVE/Storage/RBDPlugin.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index fb48c3f..da28e8a 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -630,7 +630,8 @@ sub status {
     my $rados = $librados_connect->($scfg, $storeid);
     my $df = $rados->mon_command({ prefix => 'df', format => 'json' });
 
-    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
+    my $pool = $scfg->{'data-pool'} ? $scfg->{'data-pool'} : $scfg->{pool};
+    $pool = 'rbd' if !$pool;
 
     my ($d) = grep { $_->{name} eq $pool } @{$df->{pools}};
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH storage] rbd: fix #4060 show data-pool usage when configured
  2022-05-17 12:58 [pve-devel] [PATCH storage] rbd: fix #4060 show data-pool usage when configured Aaron Lauterer
@ 2022-05-17 14:01 ` Dominik Csapak
  2022-05-17 14:07   ` Aaron Lauterer
  0 siblings, 1 reply; 4+ messages in thread
From: Dominik Csapak @ 2022-05-17 14:01 UTC (permalink / raw)
  To: Proxmox VE development discussion, Aaron Lauterer

On 5/17/22 14:58, Aaron Lauterer wrote:
> When a data-pool is configured, use it for status infos. The 'data-pool'
> config option is used to mark the erasure coded pool while the 'pool'
> will be the replicated pool holding meta data such as the omap.
> 
> This means, the 'pool' will only use a small amount of space and people
> are interested how much they can store in the erasure coded pool anyway.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> I decided to check for the IMO more likely case first and check against
> a configured data-pool. Afterwards check if we actually need to set the
> default pool name in case the pool property is omitted in the storage
> config.
> 
>   PVE/Storage/RBDPlugin.pm | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
> index fb48c3f..da28e8a 100644
> --- a/PVE/Storage/RBDPlugin.pm
> +++ b/PVE/Storage/RBDPlugin.pm
> @@ -630,7 +630,8 @@ sub status {
>       my $rados = $librados_connect->($scfg, $storeid);
>       my $df = $rados->mon_command({ prefix => 'df', format => 'json' });
>   
> -    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
> +    my $pool = $scfg->{'data-pool'} ? $scfg->{'data-pool'} : $scfg->{pool};
> +    $pool = 'rbd' if !$pool;
>   
>       my ($d) = grep { $_->{name} eq $pool } @{$df->{pools}};
>   

without looking more closely at the surrounding code and how we
set/get those properties, wouldn't it also possble to do:

my $pool = $scfg->{'data-pool'} // $scfg->{pool} // 'rbd';

?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH storage] rbd: fix #4060 show data-pool usage when configured
  2022-05-17 14:01 ` Dominik Csapak
@ 2022-05-17 14:07   ` Aaron Lauterer
  2022-05-18  6:19     ` Thomas Lamprecht
  0 siblings, 1 reply; 4+ messages in thread
From: Aaron Lauterer @ 2022-05-17 14:07 UTC (permalink / raw)
  To: Dominik Csapak, Proxmox VE development discussion



On 5/17/22 16:01, Dominik Csapak wrote:
> On 5/17/22 14:58, Aaron Lauterer wrote:
>> When a data-pool is configured, use it for status infos. The 'data-pool'
>> config option is used to mark the erasure coded pool while the 'pool'
>> will be the replicated pool holding meta data such as the omap.
>>
>> This means, the 'pool' will only use a small amount of space and people
>> are interested how much they can store in the erasure coded pool anyway.
>>
>> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
>> ---
>> I decided to check for the IMO more likely case first and check against
>> a configured data-pool. Afterwards check if we actually need to set the
>> default pool name in case the pool property is omitted in the storage
>> config.
>>
>>   PVE/Storage/RBDPlugin.pm | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
>> index fb48c3f..da28e8a 100644
>> --- a/PVE/Storage/RBDPlugin.pm
>> +++ b/PVE/Storage/RBDPlugin.pm
>> @@ -630,7 +630,8 @@ sub status {
>>       my $rados = $librados_connect->($scfg, $storeid);
>>       my $df = $rados->mon_command({ prefix => 'df', format => 'json' });
>> -    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
>> +    my $pool = $scfg->{'data-pool'} ? $scfg->{'data-pool'} : $scfg->{pool};
>> +    $pool = 'rbd' if !$pool;
>>       my ($d) = grep { $_->{name} eq $pool } @{$df->{pools}};
> 
> without looking more closely at the surrounding code and how we
> set/get those properties, wouldn't it also possble to do:
> 
> my $pool = $scfg->{'data-pool'} // $scfg->{pool} // 'rbd';
> 
> ?

Should work as well if it is okay stylewise. In the end, we want to get the pool 
name in that order.

> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH storage] rbd: fix #4060 show data-pool usage when configured
  2022-05-17 14:07   ` Aaron Lauterer
@ 2022-05-18  6:19     ` Thomas Lamprecht
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2022-05-18  6:19 UTC (permalink / raw)
  To: Proxmox VE development discussion, Aaron Lauterer, Dominik Csapak

Am 5/17/22 um 16:07 schrieb Aaron Lauterer:
>>> diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
>>> index fb48c3f..da28e8a 100644
>>> --- a/PVE/Storage/RBDPlugin.pm
>>> +++ b/PVE/Storage/RBDPlugin.pm
>>> @@ -630,7 +630,8 @@ sub status {
>>>       my $rados = $librados_connect->($scfg, $storeid);
>>>       my $df = $rados->mon_command({ prefix => 'df', format => 'json' });
>>> -    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
>>> +    my $pool = $scfg->{'data-pool'} ? $scfg->{'data-pool'} : $scfg->{pool};
>>> +    $pool = 'rbd' if !$pool;
>>>       my ($d) = grep { $_->{name} eq $pool } @{$df->{pools}};
>>
>> without looking more closely at the surrounding code and how we
>> set/get those properties, wouldn't it also possble to do:
>>
>> my $pool = $scfg->{'data-pool'} // $scfg->{pool} // 'rbd';
>>
>> ?
> 
> Should work as well if it is okay stylewise. In the end, we want to get the pool name in that order.

Dominik's proposal would be fine(r) for me style wise.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-18  6:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17 12:58 [pve-devel] [PATCH storage] rbd: fix #4060 show data-pool usage when configured Aaron Lauterer
2022-05-17 14:01 ` Dominik Csapak
2022-05-17 14:07   ` Aaron Lauterer
2022-05-18  6:19     ` Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal