use of org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver in project cloudstack by apache.
the class QueryManagerImpl method searchForVolumes.
@Override
public ListResponse<VolumeResponse> searchForVolumes(ListVolumesCmd cmd) {
Pair<List<VolumeJoinVO>, Integer> result = searchForVolumesInternal(cmd);
ListResponse<VolumeResponse> response = new ListResponse<VolumeResponse>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListVolumesCmdByAdmin) {
respView = ResponseView.Full;
}
List<VolumeResponse> volumeResponses = ViewResponseHelper.createVolumeResponse(respView, result.first().toArray(new VolumeJoinVO[result.first().size()]));
for (VolumeResponse vr : volumeResponses) {
String poolId = vr.getStoragePoolId();
if (poolId == null) {
continue;
}
DataStore store = dataStoreManager.getPrimaryDataStore(poolId);
if (store == null) {
continue;
}
DataStoreDriver driver = store.getDriver();
if (driver == null) {
continue;
}
Map<String, String> caps = driver.getCapabilities();
if (caps != null) {
boolean quiescevm = Boolean.parseBoolean(caps.get(DataStoreCapabilities.VOLUME_SNAPSHOT_QUIESCEVM.toString()));
vr.setNeedQuiescevm(quiescevm);
}
}
response.setResponses(volumeResponses, result.second());
return response;
}
Aggregations