use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class ClusterGeneralModel method onSaveHosts.
public void onSaveHosts() {
final MultipleHostsModel hostsModel = (MultipleHostsModel) getWindow();
if (hostsModel == null) {
return;
}
if (!hostsModel.validate()) {
return;
}
hostsModel.startProgress();
ArrayList<ActionParametersBase> parametersList = new ArrayList<>();
for (Object object : hostsModel.getHosts().getItems()) {
HostDetailModel hostDetailModel = (HostDetailModel) ((EntityModel) object).getEntity();
VDS host = new VDS();
host.setVdsName(hostDetailModel.getName());
host.setHostName(hostDetailModel.getAddress());
host.setSshKeyFingerprint(hostDetailModel.getFingerprint());
host.setPort(54321);
// TODO: get from UI, till than using defaults.
host.setSshPort(22);
// $NON-NLS-1$
host.setSshUsername("root");
host.setClusterId(getEntity().getId());
host.setPmEnabled(false);
AddVdsActionParameters parameters = new AddVdsActionParameters();
parameters.setVdsId(host.getId());
parameters.setvds(host);
parameters.setPassword(hostDetailModel.getPassword());
parameters.setOverrideFirewall(hostsModel.isConfigureFirewall());
parametersList.add(parameters);
}
// Todo: calling the runMultipleAction() with isRunOnlyIfAllValidationPass=false
// becuase this flag is now supported.
// should check what is the required behaviour and return to true if required.
Frontend.getInstance().runMultipleAction(ActionType.AddVds, parametersList, false, result -> {
hostsModel.stopProgress();
boolean isAllValidatePassed = true;
for (ActionReturnValue returnValueBase : result.getReturnValue()) {
isAllValidatePassed = isAllValidatePassed && returnValueBase.isValid();
if (!isAllValidatePassed) {
break;
}
}
if (isAllValidatePassed) {
updateAlerts();
cancel();
}
}, null);
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class ProviderModel method testProviderConnectivity.
private void testProviderConnectivity() {
Frontend.getInstance().runAction(ActionType.TestProviderConnectivity, new ProviderParameters(provider), result -> {
ActionReturnValue res = result.getReturnValue();
// If the connection failed on SSL issues, we try to fetch the provider
// certificate chain, and import it to the engine
stopProgress();
setTestResultValue(res);
}, null, false);
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class VnicProfileModel method onSave.
private void onSave() {
if (getProgress() != null) {
return;
}
if (!validate()) {
return;
}
// Save changes.
flush();
startProgress();
Frontend.getInstance().runAction(getActionType(), getActionParameters(), result -> {
ActionReturnValue returnValue = result.getReturnValue();
stopProgress();
if (returnValue != null && returnValue.getSucceeded()) {
cancel();
}
}, this);
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class VmListModel method updateExistingVm.
private void updateExistingVm(final boolean applyCpuChangesLater) {
final UnitVmModel model = (UnitVmModel) getWindow();
if (model.getProgress() != null) {
return;
}
// runEditVM: should be true if Cluster hasn't changed or if
// Cluster has changed and Editing it in the Backend has succeeded:
VM selectedItem = getSelectedItem();
Guid oldClusterID = selectedItem.getClusterId();
Guid newClusterID = model.getSelectedCluster().getId();
if (!oldClusterID.equals(newClusterID)) {
ChangeVMClusterParameters parameters = new ChangeVMClusterParameters(newClusterID, getcurrentVm().getId(), model.getCustomCompatibilityVersion().getSelectedItem());
model.startProgress();
Frontend.getInstance().runAction(ActionType.ChangeVMCluster, parameters, result -> {
final VmListModel<Void> vmListModel = (VmListModel<Void>) result.getState();
ActionReturnValue returnValueBase = result.getReturnValue();
if (returnValueBase != null && returnValueBase.getSucceeded()) {
VM vm = vmListModel.getcurrentVm();
VmManagementParametersBase updateVmParams = vmListModel.getUpdateVmParameters(applyCpuChangesLater);
Frontend.getInstance().runAction(ActionType.UpdateVm, updateVmParams, new UnitVmModelNetworkAsyncCallback(model, defaultNetworkCreatingManager, vm.getId()), vmListModel);
} else {
vmListModel.getWindow().stopProgress();
}
}, this);
} else {
model.startProgress();
VmManagementParametersBase updateVmParams = getUpdateVmParameters(applyCpuChangesLater);
Frontend.getInstance().runAction(ActionType.UpdateVm, updateVmParams, new UnitVmModelNetworkAsyncCallback(model, defaultNetworkCreatingManager, getcurrentVm().getId()), this);
}
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class VmSnapshotListModel method postNameUniqueCheck.
private void postNameUniqueCheck(VM vm) {
UnitVmModel model = (UnitVmModel) getWindow();
VM newVm = buildVmOnNewTemplate(model, vm);
AddVmTemplateFromSnapshotParameters parameters = new AddVmTemplateFromSnapshotParameters(newVm.getStaticData(), model.getName().getEntity(), model.getDescription().getEntity(), getSelectedItem().getId());
BuilderExecutor.build(model, parameters, new UnitToAddVmTemplateParametersBuilder());
model.startProgress();
Frontend.getInstance().runAction(ActionType.AddVmTemplateFromSnapshot, parameters, result -> {
VmSnapshotListModel vmSnapshotListModel = (VmSnapshotListModel) result.getState();
vmSnapshotListModel.getWindow().stopProgress();
ActionReturnValue returnValueBase = result.getReturnValue();
if (returnValueBase != null && returnValueBase.getSucceeded()) {
vmSnapshotListModel.cancel();
}
}, this);
}
Aggregations