Merge release branch 4.18 to 4.19

* 4.18:
  Storage plugin support to check if volume on datastore requires access for migration (#8655)
  CKS: fix /opt/bin/deploy-cloudstack-secret in CKS control nodes (#8697)
This commit is contained in:
Daan Hoogland 2024-02-26 15:53:11 +01:00
commit f4987bf8ee
6 changed files with 30 additions and 6 deletions

View File

@ -44,6 +44,10 @@ public interface PrimaryDataStoreDriver extends DataStoreDriver {
void revokeAccess(DataObject dataObject, Host host, DataStore dataStore); void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
default boolean requiresAccessForMigration(DataObject dataObject) {
return false;
}
/** /**
* intended for managed storage (cloud.storage_pool.managed = true) * intended for managed storage (cloud.storage_pool.managed = true)
* if not managed, return volume.getSize() * if not managed, return volume.getSize()

View File

@ -57,6 +57,8 @@ public interface VolumeService {
void revokeAccess(DataObject dataObject, Host host, DataStore dataStore); void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
boolean requiresAccessForMigration(DataObject dataObject, DataStore dataStore);
/** /**
* Creates the volume based on the given criteria * Creates the volume based on the given criteria
* *

View File

@ -1228,8 +1228,8 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
DataStore dataStore = dataStoreMgr.getDataStore(volumeForVm.getPoolId(), DataStoreRole.Primary); DataStore dataStore = dataStoreMgr.getDataStore(volumeForVm.getPoolId(), DataStoreRole.Primary);
PrimaryDataStore primaryDataStore = (PrimaryDataStore)dataStore; PrimaryDataStore primaryDataStore = (PrimaryDataStore)dataStore;
// This might impact other managed storages, grant access for PowerFlex storage pool only // 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() && primaryDataStore.getPoolType() == Storage.StoragePoolType.PowerFlex) { if (primaryDataStore.isManaged() && volService.requiresAccessForMigration(volumeInfo, dataStore)) {
volService.revokeAccess(volumeInfo, host, dataStore); volService.revokeAccess(volumeInfo, host, dataStore);
} }
} }
@ -1507,8 +1507,8 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
disk.setDetails(getDetails(volumeInfo, dataStore)); disk.setDetails(getDetails(volumeInfo, dataStore));
PrimaryDataStore primaryDataStore = (PrimaryDataStore)dataStore; PrimaryDataStore primaryDataStore = (PrimaryDataStore)dataStore;
// This might impact other managed storages, grant access for PowerFlex storage pool only // 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() && primaryDataStore.getPoolType() == Storage.StoragePoolType.PowerFlex) { if (primaryDataStore.isManaged() && volService.requiresAccessForMigration(volumeInfo, dataStore)) {
volService.grantAccess(volFactory.getVolume(vol.getId()), dest.getHost(), dataStore); volService.grantAccess(volFactory.getVolume(vol.getId()), dest.getHost(), dataStore);
} }

View File

@ -264,6 +264,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 @Override
public AsyncCallFuture<VolumeApiResult> createVolumeAsync(VolumeInfo volume, DataStore dataStore) { public AsyncCallFuture<VolumeApiResult> createVolumeAsync(VolumeInfo volume, DataStore dataStore) {
AsyncCallFuture<VolumeApiResult> future = new AsyncCallFuture<VolumeApiResult>(); AsyncCallFuture<VolumeApiResult> future = new AsyncCallFuture<VolumeApiResult>();

View File

@ -21,14 +21,14 @@ function usage() {
Usage: ./deploy-cloudstack-secret [OPTIONS]... Usage: ./deploy-cloudstack-secret [OPTIONS]...
To deploy the keys needed for the cloudstack kubernetes provider. To deploy the keys needed for the cloudstack kubernetes provider.
Arguments: Arguments:
-u, --url string ID of the cluster -u, --url string URL of the CloudStack API
-k, --key string API Key -k, --key string API Key
-s, --secret string Secret Key -s, --secret string Secret Key
-p, --project string Project ID -p, --project string Project ID
Other arguments: Other arguments:
-h, --help Display this help message and exit -h, --help Display this help message and exit
Examples: Examples:
./deploy-cloudstack-secret -u http://localhost:8080 -k abcd -s efgh ./deploy-cloudstack-secret -u http://10.10.10.10:8080/client/api -k abcd -s efgh
USAGE USAGE
exit 0 exit 0
} }

View File

@ -303,6 +303,11 @@ public class ScaleIOPrimaryDataStoreDriver implements PrimaryDataStoreDriver {
return null; return null;
} }
@Override
public boolean requiresAccessForMigration(DataObject dataObject) {
return true;
}
@Override @Override
public long getUsedBytes(StoragePool storagePool) { public long getUsedBytes(StoragePool storagePool) {
long usedSpaceBytes = 0; long usedSpaceBytes = 0;