mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch '4.16' into main
This commit is contained in:
commit
1484f5a418
@ -1650,7 +1650,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId());
|
||||
|
||||
if (storagePool != null && storagePool.isManaged()) {
|
||||
Map<String, String> info = new HashMap<>(3);
|
||||
Map<String, String> info = new HashMap<>();
|
||||
|
||||
info.put(DiskTO.STORAGE_HOST, storagePool.getHostAddress());
|
||||
info.put(DiskTO.STORAGE_PORT, String.valueOf(storagePool.getPort()));
|
||||
|
||||
@ -3023,7 +3023,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
public boolean cleanupDisk(final DiskDef disk) {
|
||||
final String path = disk.getDiskPath();
|
||||
|
||||
if (path == null) {
|
||||
if (org.apache.commons.lang.StringUtils.isBlank(path)) {
|
||||
s_logger.debug("Unable to clean up disk with null path (perhaps empty cdrom drive):" + disk);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -331,12 +331,6 @@ public class IscsiAdmStorageAdaptor implements StorageAdaptor {
|
||||
|
||||
@Override
|
||||
public boolean disconnectPhysicalDisk(Map<String, String> volumeToDisconnect) {
|
||||
String poolType = volumeToDisconnect.get(DiskTO.PROTOCOL_TYPE);
|
||||
// Unsupported pool types
|
||||
if (poolType != null && poolType.equalsIgnoreCase(StoragePoolType.PowerFlex.toString())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String host = volumeToDisconnect.get(DiskTO.STORAGE_HOST);
|
||||
String port = volumeToDisconnect.get(DiskTO.STORAGE_PORT);
|
||||
String path = volumeToDisconnect.get(DiskTO.IQN);
|
||||
|
||||
@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
@ -165,10 +166,27 @@ public class KVMStoragePoolManager {
|
||||
}
|
||||
|
||||
public boolean disconnectPhysicalDisk(Map<String, String> volumeToDisconnect) {
|
||||
s_logger.debug(String.format("Disconnect physical disks using volume map: %s", volumeToDisconnect.toString()));
|
||||
if (MapUtils.isEmpty(volumeToDisconnect)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (volumeToDisconnect.get(DiskTO.PROTOCOL_TYPE) != null) {
|
||||
String poolType = volumeToDisconnect.get(DiskTO.PROTOCOL_TYPE);
|
||||
StorageAdaptor adaptor = _storageMapper.get(poolType);
|
||||
if (adaptor != null) {
|
||||
s_logger.info(String.format("Disconnecting physical disk using the storage adaptor found for pool type: %s", poolType));
|
||||
return adaptor.disconnectPhysicalDisk(volumeToDisconnect);
|
||||
}
|
||||
|
||||
s_logger.debug(String.format("Couldn't find the storage adaptor for pool type: %s to disconnect the physical disk, trying with others", poolType));
|
||||
}
|
||||
|
||||
for (Map.Entry<String, StorageAdaptor> set : _storageMapper.entrySet()) {
|
||||
StorageAdaptor adaptor = set.getValue();
|
||||
|
||||
if (adaptor.disconnectPhysicalDisk(volumeToDisconnect)) {
|
||||
s_logger.debug(String.format("Disconnected physical disk using the storage adaptor for pool type: %s", set.getKey()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -177,10 +195,12 @@ public class KVMStoragePoolManager {
|
||||
}
|
||||
|
||||
public boolean disconnectPhysicalDiskByPath(String path) {
|
||||
s_logger.debug(String.format("Disconnect physical disk by path: %s", path));
|
||||
for (Map.Entry<String, StorageAdaptor> set : _storageMapper.entrySet()) {
|
||||
StorageAdaptor adaptor = set.getValue();
|
||||
|
||||
if (adaptor.disconnectPhysicalDiskByPath(path)) {
|
||||
s_logger.debug(String.format("Disconnected physical disk by local path: %s, using the storage adaptor for pool type: %s", path, set.getKey()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,8 +288,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
|
||||
@Override
|
||||
public boolean disconnectPhysicalDisk(Map<String, String> volumeToDisconnect)
|
||||
{
|
||||
s_logger.debug("Linstor: disconnectPhysicalDisk map");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private Optional<ResourceWithVolumes> getResourceByPath(final List<ResourceWithVolumes> resources, String path) {
|
||||
@ -309,10 +308,10 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
|
||||
@Override
|
||||
public boolean disconnectPhysicalDiskByPath(String localPath)
|
||||
{
|
||||
s_logger.debug("Linstor: disconnectPhysicalDiskByPath " + localPath);
|
||||
// get first storage pool from the map, as we don't know any better:
|
||||
if (!MapStorageUuidToStoragePool.isEmpty())
|
||||
{
|
||||
s_logger.debug("Linstor: disconnectPhysicalDiskByPath " + localPath);
|
||||
String firstKey = MapStorageUuidToStoragePool.keySet().stream().findFirst().get();
|
||||
final KVMStoragePool pool = MapStorageUuidToStoragePool.get(firstKey);
|
||||
|
||||
|
||||
@ -214,12 +214,12 @@ public class ScaleIOStorageAdaptor implements StorageAdaptor {
|
||||
|
||||
@Override
|
||||
public boolean disconnectPhysicalDisk(Map<String, String> volumeToDisconnect) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disconnectPhysicalDiskByPath(String localPath) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user