use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class DataCenterGuideModel method onSaveSanStorage.
private void onSaveSanStorage() {
ConfirmationModel confirmationModel = (ConfirmationModel) getConfirmWindow();
if (confirmationModel != null && !confirmationModel.validate()) {
return;
}
cancelConfirm();
getWindow().startProgress();
StorageModel model = (StorageModel) getWindow();
SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem();
VDS host = model.getHost().getSelectedItem();
boolean force = sanModel.isForce();
HashSet<String> lunIds = new HashSet<>();
for (LunModel lun : sanModel.getAddedLuns()) {
lunIds.add(lun.getLunId());
}
AddSANStorageDomainParameters params = new AddSANStorageDomainParameters(storageDomain);
params.setVdsId(host.getId());
params.setLunIds(new HashSet<>(lunIds));
params.setForce(force);
Frontend.getInstance().runAction(ActionType.AddSANStorageDomain, params, result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
StorageModel storageModel = (StorageModel) dataCenterGuideModel.getWindow();
StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem();
if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
ActionReturnValue returnValue = result.getReturnValue();
Guid storageId = returnValue.getActionReturnValue();
dataCenterGuideModel.attachStorageToDataCenter(storageId, dataCenter.getId());
}
dataCenterGuideModel.onFinish(dataCenterGuideModel.context, true, dataCenterGuideModel.storageModel);
}, this);
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class EditNetworkModel method executeSave.
@Override
public void executeSave() {
Frontend.getInstance().runAction(ActionType.UpdateNetwork, new AddNetworkStoragePoolParameters(getSelectedDc().getId(), getNetwork()), result -> {
ActionReturnValue retVal = result.getReturnValue();
postSaveAction(null, retVal != null && retVal.getSucceeded());
}, null);
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class EditNetworkQoSModel method executeSave.
@Override
public void executeSave() {
QosParametersBase<NetworkQoS> parameters = new QosParametersBase<>();
parameters.setQos(networkQoS);
Frontend.getInstance().runAction(ActionType.UpdateNetworkQoS, parameters, result -> {
ActionReturnValue retVal = result.getReturnValue();
boolean succeeded = false;
if (retVal != null && retVal.getSucceeded()) {
succeeded = true;
}
postSaveAction(succeeded);
});
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class QosModel method executeSave.
protected void executeSave() {
final QosParametersBase<T> parameters = getParameters();
parameters.setQos(getQos());
Frontend.getInstance().runAction(getAction(), parameters, result -> {
ActionReturnValue retVal = result.getReturnValue();
boolean succeeded = false;
if (retVal != null && retVal.getSucceeded()) {
succeeded = true;
getQos().setId((Guid) retVal.getActionReturnValue());
}
postSaveAction(succeeded);
});
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class SpiceConsoleModel method invokeConsole.
public void invokeConsole() {
// we attempt to perform SSO (otherwise an error will be thrown)
if (!getConfigurator().getIsAdmin() && getEntity().getStatus() == VMStatus.Up && SsoMethod.GUEST_AGENT.equals(getEntity().getSsoMethod())) {
getLogger().info(// $NON-NLS-1$
"SpiceConsoleManager::Connect: Attempting to perform SSO on Desktop " + getEntity().getName());
Frontend.getInstance().runAction(ActionType.VmLogon, new VmOperationParameterBase(getEntity().getId()), result -> {
final ActionReturnValue logonCommandReturnValue = result.getReturnValue();
boolean isLogonSucceeded = logonCommandReturnValue != null && logonCommandReturnValue.getSucceeded();
if (isLogonSucceeded) {
invokeClient();
} else {
if (logonCommandReturnValue != null && logonCommandReturnValue.getFault().getError() == EngineError.nonresp) {
UICommand okCommand = new UICommand("SpiceWithoutAgentOK", new // $NON-NLS-1$
BaseCommandTarget() {
@Override
public void executeCommand(UICommand uiCommand) {
logSsoOnDesktopFailedAgentNonResp(getLogger(), logonCommandReturnValue != null ? logonCommandReturnValue.getDescription() : // $NON-NLS-1$
"");
invokeClient();
getParentModel().setWindow(null);
}
});
UICommand cancelCommand = new UICommand("SpiceWithoutAgentCancel", new // $NON-NLS-1$
BaseCommandTarget() {
@Override
public void executeCommand(UICommand uiCommand) {
getParentModel().setWindow(null);
}
});
createConnectWithoutAgentConfirmationPopup(okCommand, cancelCommand);
} else {
logSsoOnDesktopFailed(getLogger(), logonCommandReturnValue != null ? logonCommandReturnValue.getDescription() : // $NON-NLS-1$
"");
}
}
}, this);
} else {
invokeClient();
}
}
Aggregations