linstor: do not use the same static ApiClient for all calls (#9326)

The client.setBasePath() would overwrite the Linstor controller IP/host
for all current client users. This is basically a race condition
that triggered as soon as you had configured 2 different primary storages
with different Linstor controllers.
This commit is contained in:
Rene Peinthor 2024-07-03 12:43:16 +02:00 committed by GitHub
parent 983f164c57
commit 121a35d666
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,7 +18,6 @@ package org.apache.cloudstack.storage.datastore.util;
import com.linbit.linstor.api.ApiClient;
import com.linbit.linstor.api.ApiException;
import com.linbit.linstor.api.Configuration;
import com.linbit.linstor.api.DevelopersApi;
import com.linbit.linstor.api.model.ApiCallRc;
import com.linbit.linstor.api.model.ApiCallRcList;
@ -46,7 +45,7 @@ public class LinstorUtil {
public static final String CLUSTER_DEFAULT_MAX_IOPS = "clusterDefaultMaxIops";
public static DevelopersApi getLinstorAPI(String linstorUrl) {
ApiClient client = Configuration.getDefaultApiClient();
ApiClient client = new ApiClient();
client.setBasePath(linstorUrl);
return new DevelopersApi(client);
}