use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.
the class VmBaseListModel method showWarningOnExistingEntities.
protected void showWarningOnExistingEntities(final ExportVmModel model, final QueryType getVmOrTemplateQuery) {
Guid storageDomainId = model.getStorage().getSelectedItem().getId();
AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(storagePools -> postShowWarningOnExistingVms(model, storagePools, getVmOrTemplateQuery)), storageDomainId);
}
use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.
the class RemoveQosModel method setMessage.
private void setMessage() {
ArrayList<QueryParametersBase> parameters = new ArrayList<>();
ArrayList<QueryType> queryTypes = new ArrayList<>();
for (T qos : sourceListModel.getSelectedItems()) {
QueryParametersBase parameter = new IdQueryParameters(qos.getId());
parameters.add(parameter);
queryTypes.add(getUsingEntitiesByQosIdQueryType());
}
Frontend.getInstance().runMultipleQueries(queryTypes, parameters, result -> handleSetMessageQueryResult(result));
}
use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.
the class RemoveNetworkQoSModel method setMessage.
private void setMessage() {
ArrayList<QueryParametersBase> parameters = new ArrayList<>();
ArrayList<QueryType> queryTypes = new ArrayList<>();
for (Object networkQoS : sourceListModel.getSelectedItems()) {
QueryParametersBase parameter = new IdQueryParameters(((NetworkQoS) networkQoS).getId());
parameters.add(parameter);
queryTypes.add(QueryType.GetVnicProfilesByNetworkQosId);
}
Frontend.getInstance().runMultipleQueries(queryTypes, parameters, result -> {
ArrayList<VnicProfileView> vnicProfiles = new ArrayList<>();
setHelpTag(HelpTag.remove_network_qos);
// $NON-NLS-1$
setHashName("remove_network_qos");
for (QueryReturnValue returnValue : result.getReturnValues()) {
vnicProfiles.addAll((ArrayList<VnicProfileView>) returnValue.getReturnValue());
}
if (vnicProfiles.isEmpty()) {
ArrayList<String> list = new ArrayList<>();
for (Object item : sourceListModel.getSelectedItems()) {
NetworkQoS i = (NetworkQoS) item;
list.add(i.getName());
}
setItems(list);
} else {
setMessage(ConstantsManager.getInstance().getMessages().removeNetworkQoSMessage(vnicProfiles.size()));
ArrayList<String> list = new ArrayList<>();
for (VnicProfileView item : vnicProfiles) {
list.add(item.getName());
}
setItems(list);
}
});
}
use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderModel method initQuotaForStorageDomains.
private void initQuotaForStorageDomains() {
List<QueryType> queryTypeList = new ArrayList<>();
List<QueryParametersBase> queryParamsList = new ArrayList<>();
for (StorageDomain storage : getStorage().getItems()) {
queryTypeList.add(QueryType.GetAllRelevantQuotasForStorage);
queryParamsList.add(new IdQueryParameters(storage.getId()));
}
storageQuotaMap = new HashMap<>();
Frontend.getInstance().runMultipleQueries(queryTypeList, queryParamsList, result -> {
Iterator<QueryReturnValue> returnValuesIter = result.getReturnValues().iterator();
Iterator<StorageDomain> domainsIter = getStorage().getItems().iterator();
boolean noQuota = true;
while (domainsIter.hasNext()) {
ArrayList<Quota> quotaList = returnValuesIter.next().getReturnValue();
noQuota = noQuota && quotaList.isEmpty();
storageQuotaMap.put(domainsIter.next().getId(), quotaList);
}
if (noQuota && QuotaEnforcementTypeEnum.HARD_ENFORCEMENT.equals(storagePool.getQuotaEnforcementType())) {
showCloseMessage(ConstantsManager.getInstance().getConstants().missingQuotaStorageEnforceMode());
}
initDisksStorageDomainsList();
});
}
use of org.ovirt.engine.core.common.queries.QueryType in project ovirt-engine by oVirt.
the class BackendVmResource method update.
@Override
public Vm update(Vm incoming) {
validateParameters(incoming);
if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) {
Guid clusterId = lookupClusterId(incoming);
if (!clusterId.toString().equals(get().getCluster().getId())) {
performAction(ActionType.ChangeVMCluster, // TODO: change 'null' to 'incoming.getVmCompa...' when REST support is added
new ChangeVMClusterParameters(clusterId, guid, null));
}
}
if (!isFiltered()) {
if (incoming.isSetPlacementPolicy()) {
parent.validateAndUpdateHostsInPlacementPolicy(incoming.getPlacementPolicy());
}
} else {
incoming.setPlacementPolicy(null);
}
QueryType queryType = isNextRunRequested() ? QueryType.GetVmNextRunConfiguration : QueryType.GetVmByVmId;
Vm vm = performUpdate(incoming, new QueryIdResolver<>(queryType, IdQueryParameters.class), ActionType.UpdateVm, new UpdateParametersProvider());
if (vm != null) {
DisplayHelper.adjustDisplayData(this, vm, false);
removeRestrictedInfo(vm);
}
return vm;
}
Aggregations