[pve-devel] [PATCH storage v2 4/4] pbs: fix #5008: Check if datastore and namespace is valid on add- and update hooks

Philipp Hufnagl p.hufnagl at proxmox.com
Thu Nov 16 11:45:29 CET 2023



On 11/16/23 10:57, Fiona Ebner wrote:
> Am 15.11.23 um 17:00 schrieb Philipp Hufnagl:
>> @@ -831,10 +855,27 @@ sub check_datastore_exists {
>>  	    return 1;
>>  	}
>>      }
>> -
>>      die "$storeid: Cannot find datastore '$datastore', check permissions and existence!\n";
>>  }
>>  
>> +sub check_namespace_exists {
>> +    my ($class, $storeid, $scfg, $password, $conn) = @_;
>> +
>> +    my $datastore = $scfg->{datastore};
>> +    my $namespace = $scfg->{namespace};
>> +
>> +    my $namespaces = eval { scan_namespaces($scfg, $datastore, $password) };
> 
> You're not actually re-using the connection, because it's not passed
> along here.
> 
> Ideally, the fix would've been ordered first and the connection re-use
> refactoring later. Like this, the fix cannot be applied independently of
> all that.

Thanks for noticing.

I was trying to order the commits in a way that, while they are
changing the code, the should not impact the behavior of the program.
It should be possible to apply all previous commits without modifying
the behavior.

If it is easier or maintainers, I can attempt to implement the fix
first, then the clean up after





More information about the pve-devel mailing list