It would be nice to reuse an existing PBS connection for scan_datastore. Because scan_datastore is used multiple in the code, it can not be changed without breaking existing code.
This change add an optional connection parameter to scan_datastore. If it is passed it will use this connection. If not, it will create a new one. Signed-off-by: Philipp Hufnagl <p.hufn...@proxmox.com> --- src/PVE/Storage/PBSPlugin.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/Storage/PBSPlugin.pm b/src/PVE/Storage/PBSPlugin.pm index 96373a4..b4d7914 100644 --- a/src/PVE/Storage/PBSPlugin.pm +++ b/src/PVE/Storage/PBSPlugin.pm @@ -808,9 +808,9 @@ sub status { # fingerprint (optional for trusted certs) # } sub scan_datastores { - my ($scfg, $password) = @_; + my ($scfg, $password, $conn) = @_; - my $conn = pbs_api_connect($scfg, $password); + $conn = pbs_api_connect($scfg, $password) if !defined($conn); my $response = eval { $conn->get('/api2/json/admin/datastore', {}) }; die "error fetching datastores - $@" if $@; -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel