Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ enum QualityOfServiceState { MIGRATION, NO_MIGRATION }

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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public VolumeInfo getVolume() {

void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);

boolean requiresAccessForMigration(DataObject dataObject, DataStore dataStore);

/**
* Creates the volume based on the given criteria
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1228,8 +1228,8 @@ public void release(long vmId, long hostId) {
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);
}
}
Expand Down Expand Up @@ -1507,8 +1507,8 @@ public void prepareForMigration(VirtualMachineProfile vm, DeployDestination dest
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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,19 @@ public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore)
}
}

@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>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ public String getConnectedSdc(long poolId, long hostId) {
return null;
}

@Override
public boolean requiresAccessForMigration(DataObject dataObject) {
return true;
}

@Override
public long getUsedBytes(StoragePool storagePool) {
long usedSpaceBytes = 0;
Expand Down