mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Storage plugin support to check if volume on datastore requires access for migration (#8655)
* Check if volume on datastore requires access for migration, and grant/revoke volume access if requires * Updated default implementation for requiresAccessForMigration method in PrimaryDataStoreDriver
This commit is contained in:
parent
18c3d470c6
commit
f731fe882c
@ -42,6 +42,10 @@ public interface PrimaryDataStoreDriver extends DataStoreDriver {
|
||||
|
||||
void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
|
||||
|
||||
default boolean requiresAccessForMigration(DataObject dataObject) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* intended for managed storage (cloud.storage_pool.managed = true)
|
||||
* if not managed, return volume.getSize()
|
||||
|
||||
@ -54,6 +54,8 @@ public interface VolumeService {
|
||||
|
||||
void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
|
||||
|
||||
boolean requiresAccessForMigration(DataObject dataObject, DataStore dataStore);
|
||||
|
||||
/**
|
||||
* Creates the volume based on the given criteria
|
||||
*
|
||||
|
||||
@ -1228,8 +1228,8 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
||||
DataStore dataStore = dataStoreMgr.getDataStore(volumeForVm.getPoolId(), DataStoreRole.Primary);
|
||||
PrimaryDataStore primaryDataStore = (PrimaryDataStore)dataStore;
|
||||
|
||||
// This might impact other managed storages, grant access for PowerFlex storage pool only
|
||||
if (primaryDataStore.isManaged() && primaryDataStore.getPoolType() == Storage.StoragePoolType.PowerFlex) {
|
||||
// This might impact other managed storages, enable requires access for migration in relevant datastore driver (currently enabled for PowerFlex storage pool only)
|
||||
if (primaryDataStore.isManaged() && volService.requiresAccessForMigration(volumeInfo, dataStore)) {
|
||||
volService.revokeAccess(volumeInfo, host, dataStore);
|
||||
}
|
||||
}
|
||||
@ -1507,8 +1507,8 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
||||
disk.setDetails(getDetails(volumeInfo, dataStore));
|
||||
|
||||
PrimaryDataStore primaryDataStore = (PrimaryDataStore)dataStore;
|
||||
// This might impact other managed storages, grant access for PowerFlex storage pool only
|
||||
if (primaryDataStore.isManaged() && primaryDataStore.getPoolType() == Storage.StoragePoolType.PowerFlex) {
|
||||
// This might impact other managed storages, enable requires access for migration in relevant datastore driver (currently enabled for PowerFlex storage pool only)
|
||||
if (primaryDataStore.isManaged() && volService.requiresAccessForMigration(volumeInfo, dataStore)) {
|
||||
volService.grantAccess(volFactory.getVolume(vol.getId()), dest.getHost(), dataStore);
|
||||
}
|
||||
|
||||
|
||||
@ -266,6 +266,19 @@ public class VolumeServiceImpl implements VolumeService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresAccessForMigration(DataObject dataObject, DataStore dataStore) {
|
||||
DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
|
||||
if (dataStoreDriver == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
|
||||
return ((PrimaryDataStoreDriver)dataStoreDriver).requiresAccessForMigration(dataObject);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncCallFuture<VolumeApiResult> createVolumeAsync(VolumeInfo volume, DataStore dataStore) {
|
||||
AsyncCallFuture<VolumeApiResult> future = new AsyncCallFuture<VolumeApiResult>();
|
||||
|
||||
@ -302,6 +302,11 @@ public class ScaleIOPrimaryDataStoreDriver implements PrimaryDataStoreDriver {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresAccessForMigration(DataObject dataObject) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUsedBytes(StoragePool storagePool) {
|
||||
long usedSpaceBytes = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user