use of org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters in project ovirt-engine by oVirt.
the class GetUnregisteredBlockStorageDomainsQuery method getDeviceList.
/**
* Get devices (LUNs) that are visible by the host.
*
* @return the list of LUNs.
*/
protected List<LUNs> getDeviceList() {
List<LUNs> luns = new ArrayList<>();
QueryReturnValue returnValue = executeGetDeviceList(new GetDeviceListQueryParameters(getParameters().getVdsId(), getParameters().getStorageType(), false, null, false));
if (returnValue.getSucceeded()) {
luns.addAll(returnValue.<List<LUNs>>getReturnValue());
} else {
throw new RuntimeException(String.format("GetDeviceList execution failed. Exception message: %1$s", returnValue.getExceptionString()));
}
return luns;
}
use of org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters in project ovirt-engine by oVirt.
the class SanStorageModelBase method updateInternal.
protected void updateInternal() {
if (!(getContainer().isNewStorage() || getContainer().isStorageActive())) {
return;
}
VDS host = getContainer().getHost().getSelectedItem();
if (host == null) {
proposeDiscover();
return;
}
final Collection<EntityModel<?>> prevSelected = Linq.findSelectedItems((Collection<EntityModel<?>>) getSelectedItem());
clearItems();
initializeItems(null, null);
final SanStorageModelBase model = this;
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(response -> {
if (response.getSucceeded()) {
setValuesForMaintenance(model);
model.applyData((ArrayList<LUNs>) response.getReturnValue(), false, prevSelected, isInMaintenance, metadata);
model.initLunSelection();
// $NON-NLS-1$
model.setGetLUNsFailure("");
model.stopProgress();
} else {
model.setGetLUNsFailure(ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure());
}
}, true);
Frontend.getInstance().runQuery(QueryType.GetDeviceList, new GetDeviceListQueryParameters(host.getId(), getType(), false, null, false), asyncQuery);
getContainer().startProgress();
}
use of org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters in project ovirt-engine by oVirt.
the class BackendHostStorageResource method getLogicalUnits.
protected List<LUNs> getLogicalUnits() {
boolean reportStatus = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, REPORT_STATUS, true, true);
GetDeviceListQueryParameters params = new GetDeviceListQueryParameters(asGuid(hostId), StorageType.UNKNOWN, reportStatus, null, true);
return getBackendCollection(QueryType.GetDeviceList, params);
}
use of org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters in project ovirt-engine by oVirt.
the class StorageListModel method saveSanStorage.
private void saveSanStorage() {
StorageModel storageModel = (StorageModel) getWindow();
final SanStorageModelBase sanStorageModelBase = (SanStorageModelBase) storageModel.getCurrentStorageItem();
Guid hostId = sanStorageModelBase.getContainer().getHost().getSelectedItem().getId();
if (sanStorageModelBase.getAddedLuns().isEmpty()) {
onSaveSanStorage();
return;
}
Set<String> unkownStatusLuns = new HashSet<>();
for (LunModel lunModel : sanStorageModelBase.getAddedLuns()) {
unkownStatusLuns.add(lunModel.getLunId());
}
Frontend.getInstance().runQuery(QueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModelBase.getType(), true, unkownStatusLuns, false), new AsyncQuery<QueryReturnValue>(response -> {
if (response.getSucceeded()) {
List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue();
postGetLunsMessages(sanStorageModelBase.getUsedLunsMessages(checkedLuns));
} else {
sanStorageModelBase.setGetLUNsFailure(ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure());
}
}, true));
}
use of org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveNewSanStorage.
public void saveNewSanStorage() {
StorageModel storageModel = (StorageModel) getWindow();
final SanStorageModelBase sanStorageModelBase = (SanStorageModelBase) storageModel.getCurrentStorageItem();
Guid hostId = sanStorageModelBase.getContainer().getHost().getSelectedItem().getId();
Set<String> unkownStatusLuns = new HashSet<>();
for (LunModel lunModel : sanStorageModelBase.getAddedLuns()) {
unkownStatusLuns.add(lunModel.getLunId());
}
Frontend.getInstance().runQuery(QueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModelBase.getType(), true, unkownStatusLuns, false), new AsyncQuery<QueryReturnValue>(response -> {
if (response.getSucceeded()) {
List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue();
postGetLunsMessages(sanStorageModelBase.getUsedLunsMessages(checkedLuns));
} else {
sanStorageModelBase.setGetLUNsFailure(ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure());
}
}, true));
}
Aggregations