use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class VnicProfileModel method initCustomPropertySheet.
private void initCustomPropertySheet(Version dcCompatibilityVersion) {
if (!customPropertiesVisible) {
return;
}
GetDeviceCustomPropertiesParameters params = new GetDeviceCustomPropertiesParameters();
params.setVersion(dcCompatibilityVersion);
params.setDeviceType(VmDeviceGeneralType.INTERFACE);
startProgress();
Frontend.getInstance().runQuery(QueryType.GetDeviceCustomProperties, params, new AsyncQuery<QueryReturnValue>(returnValue -> {
if (returnValue != null) {
Map<String, String> customPropertiesList = returnValue.getReturnValue();
getCustomPropertySheet().setKeyValueMap(customPropertiesList);
getCustomPropertySheet().setIsChangeable(!customPropertiesList.isEmpty());
initCustomProperties();
}
stopProgress();
}));
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class VnicProfileTemplateListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
IdQueryParameters params = new IdQueryParameters(getEntity().getId());
params.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetTemplatesByVnicProfileId, params, new AsyncQuery<QueryReturnValue>(returnValue -> setItems((Collection<VmTemplate>) returnValue.getReturnValue())));
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class VnicProfileVmListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
IdQueryParameters params = new IdQueryParameters(getEntity().getId());
params.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetVmsByVnicProfileId, params, new AsyncQuery<QueryReturnValue>(returnValue -> setItems((Collection<VM>) returnValue.getReturnValue())));
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class ImportSanStorageModel method getUnregisteredStorageDomains.
protected void getUnregisteredStorageDomains(List<StorageServerConnections> connections) {
VDS vds = getContainer().getHost().getSelectedItem();
Frontend.getInstance().runQuery(QueryType.GetUnregisteredBlockStorageDomains, new GetUnregisteredBlockStorageDomainsParameters(vds.getId(), getType(), connections), new AsyncQuery<QueryReturnValue>(returnValue -> {
Pair<List<StorageDomain>, List<StorageServerConnections>> returnValuePair = returnValue.getReturnValue();
ArrayList<StorageDomain> storageDomains = (ArrayList<StorageDomain>) returnValuePair.getFirst();
ArrayList<StorageServerConnections> connections1 = (ArrayList<StorageServerConnections>) returnValuePair.getSecond();
if (storageDomains != null) {
addStorageDomains(storageDomains);
}
postGetUnregisteredStorageDomains(storageDomains, connections1);
}));
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class VmListModel method updateVM.
@Override
protected void updateVM(final UnitVmModel model) {
final VM selectedItem = getSelectedItem();
// explicitly pass non-editable field from the original VM
getcurrentVm().setCreatedByUserId(selectedItem.getCreatedByUserId());
getcurrentVm().setUseLatestVersion(model.getTemplateWithVersion().getSelectedItem().isLatest());
if (selectedItem.isRunningOrPaused() && !selectedItem.isHostedEngine()) {
AsyncDataProvider.getInstance().getVmChangedFieldsForNextRun(editedVm, getcurrentVm(), getUpdateVmParameters(false), new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {
@Override
public void onSuccess(QueryReturnValue returnValue) {
List<String> changedFields = returnValue.getReturnValue();
final boolean cpuHotPluggable = VmCommonUtils.isCpusToBeHotpluggedOrUnplugged(selectedItem, getcurrentVm());
final boolean isHeadlessModeChanged = isHeadlessModeChanged(editedVm, getUpdateVmParameters(false));
final boolean memoryHotPluggable = VmCommonUtils.isMemoryToBeHotplugged(selectedItem, getcurrentVm());
final boolean minAllocatedMemoryChanged = selectedItem.getMinAllocatedMem() != getcurrentVm().getMinAllocatedMem();
final boolean vmLeaseUpdated = VmCommonUtils.isVmLeaseToBeHotPluggedOrUnplugged(selectedItem, getcurrentVm());
if (isHeadlessModeChanged) {
changedFields.add(constants.headlessMode());
}
// provide warnings if isVmUnpinned()
if (!changedFields.isEmpty() || isVmUnpinned() || memoryHotPluggable || cpuHotPluggable || vmLeaseUpdated) {
VmNextRunConfigurationModel confirmModel = new VmNextRunConfigurationModel();
if (isVmUnpinned()) {
confirmModel.setVmUnpinned();
}
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().editNextRunConfigurationTitle());
confirmModel.setHelpTag(HelpTag.edit_next_run_configuration);
// $NON-NLS-1$
confirmModel.setHashName("edit_next_run_configuration");
confirmModel.setChangedFields(changedFields);
confirmModel.setCpuPluggable(cpuHotPluggable);
confirmModel.setMemoryPluggable(memoryHotPluggable);
// it can be plugged only together with the memory, never alone
confirmModel.setMinAllocatedMemoryPluggable(memoryHotPluggable && minAllocatedMemoryChanged);
confirmModel.setVmLeaseUpdated(vmLeaseUpdated);
confirmModel.getCommands().add(// $NON-NLS-1$
new UICommand("updateExistingVm", VmListModel.this).setTitle(ConstantsManager.getInstance().getConstants().ok()).setIsDefault(true));
// $NON-NLS-1$
confirmModel.getCommands().add(UICommand.createCancelUiCommand("CancelConfirmation", VmListModel.this));
setConfirmWindow(confirmModel);
} else {
updateExistingVm(false);
}
}
private boolean isVmUnpinned() {
if (selectedItem.isRunning()) {
if (selectedItem.getMigrationSupport() == MigrationSupport.PINNED_TO_HOST && getcurrentVm().getMigrationSupport() != MigrationSupport.PINNED_TO_HOST) {
return true;
}
}
return false;
}
}));
} else {
updateExistingVm(false);
}
}
Aggregations