Search in sources :

Example 1 with AddVdsActionParameters

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);
}
Also used : HostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel) NewHostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.NewHostModel) VDS(org.ovirt.engine.core.common.businessentities.VDS) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters)

Example 2 with AddVdsActionParameters

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);
}
Also used : HostDetailModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel) VDS(org.ovirt.engine.core.common.businessentities.VDS) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ArrayList(java.util.ArrayList) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with AddVdsActionParameters

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);
}
Also used : MultipleHostsModel(org.ovirt.engine.ui.uicommonweb.models.hosts.MultipleHostsModel) HostDetailModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel) VDS(org.ovirt.engine.core.common.businessentities.VDS) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ArrayList(java.util.ArrayList) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 4 with AddVdsActionParameters

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);
}
Also used : NewHostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.NewHostModel) HostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel) VDS(org.ovirt.engine.core.common.businessentities.VDS) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters)

Example 5 with AddVdsActionParameters

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));
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Host(org.ovirt.engine.api.model.Host) VdsOperationActionParameters(org.ovirt.engine.core.common.action.VdsOperationActionParameters) Guid(org.ovirt.engine.core.compat.Guid) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters)

Aggregations

AddVdsActionParameters (org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters)8 VDS (org.ovirt.engine.core.common.businessentities.VDS)6 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)4 ArrayList (java.util.ArrayList)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)2 Guid (org.ovirt.engine.core.compat.Guid)2 HostDetailModel (org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel)2 HostModel (org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel)2 NewHostModel (org.ovirt.engine.ui.uicommonweb.models.hosts.NewHostModel)2 Host (org.ovirt.engine.api.model.Host)1 ChangeVDSClusterParameters (org.ovirt.engine.core.common.action.ChangeVDSClusterParameters)1 VdsOperationActionParameters (org.ovirt.engine.core.common.action.VdsOperationActionParameters)1 UpdateVdsActionParameters (org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters)1 ExternalComputeResource (org.ovirt.engine.core.common.businessentities.ExternalComputeResource)1 ExternalDiscoveredHost (org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost)1 ExternalHostGroup (org.ovirt.engine.core.common.businessentities.ExternalHostGroup)1 HostedEngineDeployConfiguration (org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 JsSingleValueStringObject (org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject)1