mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.18' into 4.19
This commit is contained in:
commit
a55ba96a08
@ -41,6 +41,7 @@ import com.linbit.linstor.api.model.ApiCallRc;
|
|||||||
import com.linbit.linstor.api.model.ApiCallRcList;
|
import com.linbit.linstor.api.model.ApiCallRcList;
|
||||||
import com.linbit.linstor.api.model.Properties;
|
import com.linbit.linstor.api.model.Properties;
|
||||||
import com.linbit.linstor.api.model.ProviderKind;
|
import com.linbit.linstor.api.model.ProviderKind;
|
||||||
|
import com.linbit.linstor.api.model.Resource;
|
||||||
import com.linbit.linstor.api.model.ResourceDefinition;
|
import com.linbit.linstor.api.model.ResourceDefinition;
|
||||||
import com.linbit.linstor.api.model.ResourceDefinitionModify;
|
import com.linbit.linstor.api.model.ResourceDefinitionModify;
|
||||||
import com.linbit.linstor.api.model.ResourceGroupSpawn;
|
import com.linbit.linstor.api.model.ResourceGroupSpawn;
|
||||||
@ -281,7 +282,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
|
|||||||
public boolean disconnectPhysicalDisk(String volumePath, KVMStoragePool pool)
|
public boolean disconnectPhysicalDisk(String volumePath, KVMStoragePool pool)
|
||||||
{
|
{
|
||||||
s_logger.debug("Linstor: disconnectPhysicalDisk " + pool.getUuid() + ":" + volumePath);
|
s_logger.debug("Linstor: disconnectPhysicalDisk " + pool.getUuid() + ":" + volumePath);
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -317,8 +318,8 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
|
|||||||
s_logger.debug("Linstor: Using storpool: " + pool.getUuid());
|
s_logger.debug("Linstor: Using storpool: " + pool.getUuid());
|
||||||
final DevelopersApi api = getLinstorAPI(pool);
|
final DevelopersApi api = getLinstorAPI(pool);
|
||||||
|
|
||||||
try
|
Optional<ResourceWithVolumes> optRsc;
|
||||||
{
|
try {
|
||||||
List<ResourceWithVolumes> resources = api.viewResources(
|
List<ResourceWithVolumes> resources = api.viewResources(
|
||||||
Collections.singletonList(localNodeName),
|
Collections.singletonList(localNodeName),
|
||||||
null,
|
null,
|
||||||
@ -327,31 +328,35 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
|
|||||||
null,
|
null,
|
||||||
null);
|
null);
|
||||||
|
|
||||||
Optional<ResourceWithVolumes> rsc = getResourceByPath(resources, localPath);
|
optRsc = getResourceByPath(resources, localPath);
|
||||||
|
} catch (ApiException apiEx) {
|
||||||
|
// couldn't query linstor controller
|
||||||
|
s_logger.error(apiEx.getBestMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (rsc.isPresent())
|
if (optRsc.isPresent()) {
|
||||||
{
|
try {
|
||||||
|
Resource rsc = optRsc.get();
|
||||||
ResourceDefinitionModify rdm = new ResourceDefinitionModify();
|
ResourceDefinitionModify rdm = new ResourceDefinitionModify();
|
||||||
rdm.deleteProps(Collections.singletonList("DrbdOptions/Net/allow-two-primaries"));
|
rdm.deleteProps(Collections.singletonList("DrbdOptions/Net/allow-two-primaries"));
|
||||||
ApiCallRcList answers = api.resourceDefinitionModify(rsc.get().getName(), rdm);
|
ApiCallRcList answers = api.resourceDefinitionModify(rsc.getName(), rdm);
|
||||||
if (answers.hasError())
|
if (answers.hasError()) {
|
||||||
{
|
|
||||||
s_logger.error(
|
s_logger.error(
|
||||||
String.format("Failed to remove 'allow-two-primaries' on %s: %s",
|
String.format("Failed to remove 'allow-two-primaries' on %s: %s",
|
||||||
rsc.get().getName(), LinstorUtil.getBestErrorMessage(answers)));
|
rsc.getName(), LinstorUtil.getBestErrorMessage(answers)));
|
||||||
// do not fail here as removing allow-two-primaries property isn't fatal
|
// do not fail here as removing allow-two-primaries property isn't fatal
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
s_logger.warn("Linstor: Couldn't find resource for this path: " + localPath);
|
|
||||||
} catch(ApiException apiEx){
|
} catch(ApiException apiEx){
|
||||||
s_logger.error(apiEx.getBestMessage());
|
s_logger.error(apiEx.getBestMessage());
|
||||||
// do not fail here as removing allow-two-primaries property isn't fatal
|
// do not fail here as removing allow-two-primaries property isn't fatal
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
s_logger.info("Linstor: Couldn't find resource for this path: " + localPath);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deletePhysicalDisk(String name, KVMStoragePool pool, Storage.ImageFormat format)
|
public boolean deletePhysicalDisk(String name, KVMStoragePool pool, Storage.ImageFormat format)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user