use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class ClusterListModel method onResetClusterEmulatedMachine.
public void onResetClusterEmulatedMachine() {
final ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> prms = new ArrayList<>();
for (Cluster cluster : getSelectedItems()) {
ManagementNetworkOnClusterOperationParameters currentParam = new ManagementNetworkOnClusterOperationParameters(cluster);
currentParam.setForceResetEmulatedMachine(true);
prms.add(currentParam);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.UpdateCluster, prms, result -> {
model.stopProgress();
cancel();
});
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class ClusterListModel method addHosts.
private void addHosts(final MultipleHostsModel hostsModel) {
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 then using defaults.
host.setSshPort(22);
// $NON-NLS-1$
host.setSshUsername("root");
host.setClusterId(hostsModel.getClusterModel().getClusterId());
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 = returnValueBase.isValid();
if (!isAllValidatePassed) {
break;
}
}
if (isAllValidatePassed) {
cancel();
}
}, null);
}
use of org.ovirt.engine.core.common.action.ActionParametersBase 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.ActionParametersBase in project ovirt-engine by oVirt.
the class ClusterGeneralModel method onDetachNewGlusterHosts.
public void onDetachNewGlusterHosts() {
if (getWindow() == null) {
return;
}
final DetachGlusterHostsModel hostsModel = (DetachGlusterHostsModel) getWindow();
if (!hostsModel.validate()) {
return;
}
boolean force = hostsModel.getForce().getEntity();
ArrayList<ActionParametersBase> parametersList = new ArrayList<>();
for (Object model : hostsModel.getHosts().getSelectedItems()) {
String host = (String) ((EntityModel) model).getEntity();
parametersList.add(new RemoveGlusterServerParameters(getEntity().getId(), host, force));
}
Frontend.getInstance().runMultipleAction(ActionType.RemoveGlusterServer, parametersList);
cancel();
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class ClusterGeneralModel method onManageGlusterSwiftServices.
private void onManageGlusterSwiftServices() {
if (getWindow() == null) {
return;
}
ManageGlusterSwiftModel glusterSwiftModel = (ManageGlusterSwiftModel) getWindow();
glusterSwiftModel.startProgress();
if (glusterSwiftModel.getIsManageServerLevel().getEntity()) {
ArrayList<ActionParametersBase> parametersList = new ArrayList<>();
for (Object model : glusterSwiftModel.getHostServicesList().getItems()) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) model;
GlusterSwiftAction action = getGlusterSwiftAction(swiftServiceModel.getStartSwift().getEntity(), swiftServiceModel.getStopSwift().getEntity(), swiftServiceModel.getRestartSwift().getEntity());
if (action != null) {
GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getId(), swiftServiceModel.getEntity().getServerId(), ServiceType.GLUSTER_SWIFT, action.name().toLowerCase());
parametersList.add(parameters);
}
}
// should check what is the required behaviour and return to true if required.
if (!parametersList.isEmpty()) {
Frontend.getInstance().runMultipleAction(ActionType.ManageGlusterService, parametersList, false, result -> {
ManageGlusterSwiftModel innerGlusterSwiftModel = (ManageGlusterSwiftModel) result.getState();
innerGlusterSwiftModel.stopProgress();
cancel();
updateGlusterDetails();
}, glusterSwiftModel);
} else {
glusterSwiftModel.stopProgress();
glusterSwiftModel.setMessage(ConstantsManager.getInstance().getConstants().noActionSelectedManageGlusterSwift());
}
} else {
GlusterSwiftAction action = getGlusterSwiftAction(glusterSwiftModel.getStartSwift().getEntity(), glusterSwiftModel.getStopSwift().getEntity(), glusterSwiftModel.getRestartSwift().getEntity());
if (action != null) {
GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getId(), null, ServiceType.GLUSTER_SWIFT, action.name().toLowerCase());
Frontend.getInstance().runAction(ActionType.ManageGlusterService, parameters, result -> {
ManageGlusterSwiftModel innerGlusterSwiftModel = (ManageGlusterSwiftModel) result.getState();
innerGlusterSwiftModel.stopProgress();
if (result.getReturnValue().getSucceeded()) {
cancel();
updateGlusterDetails();
}
}, glusterSwiftModel);
} else {
glusterSwiftModel.stopProgress();
glusterSwiftModel.setMessage(ConstantsManager.getInstance().getConstants().noActionSelectedManageGlusterSwift());
}
}
}
Aggregations