[pve-devel] [PATCH storage] fix #5008: prevent adding pbs storage with invalid namespace
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Nov 15 10:52:46 CET 2023
Am 15/11/2023 um 10:37 schrieb Philipp Hufnagl:
> On 11/15/23 09:31, Fiona Ebner wrote:
>> Am 14.11.23 um 15:27 schrieb Philipp Hufnagl:
>>> diff --git a/src/PVE/Storage/PBSPlugin.pm b/src/PVE/Storage/PBSPlugin.pm
>>> index 4320974..aceb2c4 100644
>>> --- a/src/PVE/Storage/PBSPlugin.pm
>>> +++ b/src/PVE/Storage/PBSPlugin.pm
>>> @@ -817,6 +817,17 @@ sub scan_datastores {
>>> return $response;
>>> }
>>>
>>> +sub scan_namespaces {
>>> + my ($scfg, $datastore, $password) = @_;
>>> +
>>> + my $conn = pbs_api_connect($scfg, $password);
>>
>> Not super important, but would be nice to have a way to re-use the same
>> connection in scan_datastores() and here, since activate_storage() will
>> call both of them.
>
> scan_datastores() seem to be called somewhere else as well. I see if I
> can find a way to reuse the connection but not break the code there.
In the long run it maybe could be better to have an explicit check_availability
hook, but IMO it's a bit late in the release cycle for that as this needs a bit
extra care, especially w.r.t. external plugins and our ABI compat.
Anyhow, as workaround we might be able to do this check in the on_add_hook and
on_update_hook methods for now.
More information about the pve-devel
mailing list