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