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

Fiona Ebner f.ebner at proxmox.com
Thu Nov 16 10:57:25 CET 2023


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.





More information about the pve-devel mailing list