use of org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters in project ovirt-engine by oVirt.
the class ClusterGuideModel method onAddHost.
public void onAddHost() {
cancelConfirm();
HostModel model = (HostModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (!model.validate()) {
return;
}
// Save changes.
VDS host = new VDS();
host.setVdsName(model.getName().getEntity());
host.setHostName(model.getHost().getEntity());
host.setPort(model.getPort().getEntity());
host.setSshPort(model.getAuthSshPort().getEntity());
host.setSshUsername(model.getUserName().getEntity());
host.setSshKeyFingerprint(model.getFetchSshFingerprint().getEntity());
host.setClusterId(model.getCluster().getSelectedItem().getId());
host.setVdsSpmPriority(model.getSpmPriorityValue());
// Save other PM parameters.
host.setPmEnabled(model.getIsPm().getEntity());
host.setDisablePowerManagementPolicy(model.getDisableAutomaticPowerManagement().getEntity());
host.setPmKdumpDetection(model.getPmKdumpDetection().getEntity());
AddVdsActionParameters vdsActionParams = new AddVdsActionParameters();
vdsActionParams.setvds(host);
vdsActionParams.setVdsId(host.getId());
if (model.getUserPassword().getEntity() != null) {
vdsActionParams.setPassword(model.getUserPassword().getEntity());
}
vdsActionParams.setAuthMethod(model.getAuthenticationMethod());
vdsActionParams.setOverrideFirewall(model.getOverrideIpTables().getEntity());
vdsActionParams.setFenceAgents(model.getFenceAgentListModel().getFenceAgents());
model.startProgress();
Frontend.getInstance().runAction(ActionType.AddVds, vdsActionParams, result -> {
ClusterGuideModel localModel = (ClusterGuideModel) result.getState();
localModel.postOnAddHost(result.getReturnValue());
}, this);
}
use of org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters 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.hostdeploy.AddVdsActionParameters 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.hostdeploy.AddVdsActionParameters in project ovirt-engine by oVirt.
the class DataCenterGuideModel method onAddHost.
public void onAddHost() {
cancelConfirm();
HostModel model = (HostModel) getWindow();
if (model.getProgress() != null) {
return;
}
// Save changes.
VDS host = new VDS();
host.setVdsName(model.getName().getEntity());
host.setHostName(model.getHost().getEntity());
host.setPort(model.getPort().getEntity());
host.setSshPort(model.getAuthSshPort().getEntity());
host.setSshUsername(model.getUserName().getEntity());
host.setSshKeyFingerprint(model.getFetchSshFingerprint().getEntity());
host.setClusterId(model.getCluster().getSelectedItem().getId());
host.setVdsSpmPriority(model.getSpmPriorityValue());
// Save other PM parameters.
host.setPmEnabled(model.getIsPm().getEntity());
host.setDisablePowerManagementPolicy(model.getDisableAutomaticPowerManagement().getEntity());
host.setPmKdumpDetection(model.getPmKdumpDetection().getEntity());
AddVdsActionParameters addVdsParams = new AddVdsActionParameters();
addVdsParams.setVdsId(host.getId());
addVdsParams.setvds(host);
if (model.getUserPassword().getEntity() != null) {
addVdsParams.setPassword(model.getUserPassword().getEntity());
}
addVdsParams.setOverrideFirewall(model.getOverrideIpTables().getEntity());
addVdsParams.setFenceAgents(model.getFenceAgentListModel().getFenceAgents());
model.startProgress();
Frontend.getInstance().runAction(ActionType.AddVds, addVdsParams, result -> {
DataCenterGuideModel localModel = (DataCenterGuideModel) result.getState();
localModel.postOnAddHost(result.getReturnValue());
}, this);
}
use of org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters in project ovirt-engine by oVirt.
the class BackendHostsResource method add.
@Override
public Response add(Host host) {
validateParameters(host, "name", "address");
VdsStatic staticHost = getMapper(Host.class, VdsStatic.class).map(host, null);
staticHost.setClusterId(getClusterId(host));
BackendExternalProviderHelper.completeExternalNetworkProviderConfigurations(this, host.getExternalNetworkProviderConfigurations());
AddVdsActionParameters addParams = new AddVdsActionParameters(staticHost, host.getRootPassword());
if (host.isSetOverrideIptables()) {
addParams.setOverrideFirewall(host.isOverrideIptables());
}
addParams.setHostedEngineDeployConfiguration(HostResourceParametersUtil.getHostedEngineDeployConfiguration(this));
addParams = (AddVdsActionParameters) getMapper(Host.class, VdsOperationActionParameters.class).map(host, addParams);
return performCreate(ActionType.AddVds, addParams, new QueryIdResolver<Guid>(QueryType.GetVdsByVdsId, IdQueryParameters.class));
}
Aggregations