Search in sources :

Example 1 with HostedEngineDeployConfiguration

use of org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration in project ovirt-engine by oVirt.

the class HostListModel method onSaveInternal.

public void onSaveInternal(boolean approveInitiated) {
    HostModel model = (HostModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    VDS host = model.getIsNew() ? new VDS() : (VDS) Cloner.clone(getSelectedItem());
    // Save changes.
    host.setVdsName(model.getName().getEntity());
    host.setComment(model.getComment().getEntity());
    host.setHostName(model.getHost().getEntity().trim());
    host.setPort(Integer.parseInt(model.getPort().getEntity().toString()));
    host.setSshPort(Integer.parseInt(model.getAuthSshPort().getEntity().toString()));
    boolean sshUsernameSet = model.getUserName().getEntity() != null;
    host.setSshUsername(sshUsernameSet ? model.getUserName().getEntity() : null);
    boolean sshFpSet = model.getFetchSshFingerprint().getEntity() != null;
    host.setSshKeyFingerprint(!sshFpSet ? null : model.getFetchSshFingerprint().getEntity());
    host.setVdsSpmPriority(model.getSpmPriorityValue());
    boolean consoleAddressSet = model.getConsoleAddressEnabled().getEntity();
    host.setConsoleAddress(!consoleAddressSet ? null : model.getConsoleAddress().getEntity());
    Guid oldClusterId = host.getClusterId();
    Guid newClusterId = model.getCluster().getSelectedItem().getId();
    host.setClusterId(newClusterId);
    host.setVdsSpmPriority(model.getSpmPriorityValue());
    host.setFenceProxySources(FenceProxySourceTypeHelper.parseFromString(model.getPmProxyPreferences()));
    // Save other PM parameters.
    host.setPmEnabled(model.getIsPm().getEntity());
    host.setDisablePowerManagementPolicy(model.getDisableAutomaticPowerManagement().getEntity());
    host.setPmKdumpDetection(model.getPmKdumpDetection().getEntity());
    host.setCurrentKernelCmdline(model.getKernelCmdline().getEntity());
    host.setKernelCmdlineBlacklistNouveau(model.getKernelCmdlineBlacklistNouveau().getEntity());
    host.setKernelCmdlineParsable(model.isKernelCmdlineParsable());
    host.setKernelCmdlineIommu(model.getKernelCmdlineIommu().getEntity());
    host.setKernelCmdlineKvmNested(model.getKernelCmdlineKvmNested().getEntity());
    host.setKernelCmdlineUnsafeInterrupts(model.getKernelCmdlineUnsafeInterrupts().getEntity());
    host.setKernelCmdlinePciRealloc(model.getKernelCmdlinePciRealloc().getEntity());
    cancelConfirm();
    model.startProgress();
    if (model.getIsNew()) {
        AddVdsActionParameters parameters = new AddVdsActionParameters();
        parameters.setVdsId(host.getId());
        parameters.setvds(host);
        parameters.setFenceAgents(model.getFenceAgentListModel().getFenceAgents());
        if (model.getUserPassword().getEntity() != null) {
            parameters.setPassword(model.getUserPassword().getEntity());
        }
        parameters.setOverrideFirewall(model.getOverrideIpTables().getEntity());
        parameters.setAuthMethod(model.getAuthenticationMethod());
        Provider<?> networkProvider = model.getNetworkProviders().getSelectedItem();
        if (networkProvider != null) {
            parameters.getVdsStaticData().setOpenstackNetworkProviderId(networkProvider.getId());
            parameters.setNetworkMappings(model.getInterfaceMappings().getEntity());
        }
        if (model.getProviders().getSelectedItem() != null) {
            parameters.getVdsStaticData().setHostProviderId(model.getProviders().getSelectedItem().getId());
        }
        if (Boolean.TRUE.equals(model.getIsDiscoveredHosts().getEntity())) {
            Provider<?> provider = model.getProviders().getSelectedItem();
            ExternalHostGroup hostGroup = (ExternalHostGroup) model.getExternalHostGroups().getSelectedItem();
            ExternalComputeResource computeResource = (ExternalComputeResource) model.getExternalComputeResource().getSelectedItem();
            ExternalDiscoveredHost discoveredHost = (ExternalDiscoveredHost) model.getExternalDiscoveredHosts().getSelectedItem();
            parameters.initVdsActionParametersForProvision(provider.getId(), hostGroup, computeResource, discoveredHost.getMac(), discoveredHost.getName(), discoveredHost.getIp());
        }
        parameters.setHostedEngineDeployConfiguration(new HostedEngineDeployConfiguration(model.getHostedEngineHostModel().getSelectedItem()));
        parameters.setAffinityLabels(model.getLabelList().getSelectedItems());
        Frontend.getInstance().runAction(ActionType.AddVds, parameters, result -> {
            Object[] array = (Object[]) result.getState();
            HostListModel<Void> localModel = (HostListModel<Void>) array[0];
            boolean localApproveInitiated = (Boolean) array[1];
            localModel.postOnSaveInternal(result.getReturnValue(), localApproveInitiated);
        }, new Object[] { this, approveInitiated });
    } else {
        // Update VDS -> consists of changing VDS cluster first and then updating rest of VDS properties:
        UpdateVdsActionParameters parameters = new UpdateVdsActionParameters();
        parameters.setvds(host);
        parameters.setVdsId(host.getId());
        // $NON-NLS-1$
        parameters.setPassword("");
        parameters.setInstallHost(false);
        parameters.setAuthMethod(model.getAuthenticationMethod());
        parameters.setFenceAgents(model.getFenceAgentListModel().getFenceAgents());
        parameters.setAffinityLabels(model.getLabelList().getSelectedItems());
        if (model.getExternalHostProviderEnabled().getEntity() && model.getProviders().getSelectedItem() != null) {
            host.setHostProviderId(model.getProviders().getSelectedItem().getId());
        }
        if (!oldClusterId.equals(newClusterId)) {
            Frontend.getInstance().runAction(ActionType.ChangeVDSCluster, new ChangeVDSClusterParameters(newClusterId, host.getId()), result -> {
                Object[] array = (Object[]) result.getState();
                HostListModel<Void> localModel = (HostListModel<Void>) array[0];
                UpdateVdsActionParameters localParameters = (UpdateVdsActionParameters) array[1];
                boolean localApproveInitiated = (Boolean) array[2];
                ActionReturnValue localReturnValue = result.getReturnValue();
                if (localReturnValue != null && localReturnValue.getSucceeded()) {
                    localModel.postOnSaveInternalChangeCluster(localParameters, localApproveInitiated);
                } else {
                    localModel.getWindow().stopProgress();
                }
            }, new Object[] { this, parameters, approveInitiated });
        } else {
            postOnSaveInternalChangeCluster(parameters, approveInitiated);
        }
    }
}
Also used : ExternalComputeResource(org.ovirt.engine.core.common.businessentities.ExternalComputeResource) ExternalDiscoveredHost(org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost) VDS(org.ovirt.engine.core.common.businessentities.VDS) ExternalHostGroup(org.ovirt.engine.core.common.businessentities.ExternalHostGroup) Guid(org.ovirt.engine.core.compat.Guid) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) HostedEngineDeployConfiguration(org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration)

Example 2 with HostedEngineDeployConfiguration

use of org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration in project ovirt-engine by oVirt.

the class HostListModel method onInstall.

public void onInstall() {
    final VDS host = getSelectedItem();
    InstallModel model = (InstallModel) getWindow();
    if (!model.validate(host.isOvirtVintageNode())) {
        model.setValidationFailed(new EntityModel<>(true));
        return;
    }
    final UpdateVdsActionParameters param = new UpdateVdsActionParameters();
    param.setvds(host);
    param.setVdsId(host.getId());
    param.setPassword(model.getUserPassword().getEntity());
    param.setReinstallOrUpgrade(true);
    param.setInstallHost(true);
    param.setoVirtIsoFile(null);
    param.setOverrideFirewall(model.getOverrideIpTables().getEntity());
    param.setActivateHost(model.getActivateHostAfterInstall().getEntity());
    param.setAuthMethod(model.getAuthenticationMethod());
    // Explicitly set null, to be clear we don't want to update fence agents.
    param.setFenceAgents(null);
    param.setHostedEngineDeployConfiguration(new HostedEngineDeployConfiguration(model.getHostedEngineHostModel().getSelectedItem()));
    Provider<?> networkProvider = (Provider<?>) model.getNetworkProviders().getSelectedItem();
    if (networkProvider == null) {
        param.getVdsStaticData().setOpenstackNetworkProviderId(null);
    } else {
        param.getVdsStaticData().setOpenstackNetworkProviderId(networkProvider.getId());
        param.setNetworkMappings((String) model.getInterfaceMappings().getEntity());
    }
    AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(returnValue -> Frontend.getInstance().runAction(ActionType.InstallVds, param, result -> {
        ActionReturnValue returnValue1 = result.getReturnValue();
        if (returnValue1 != null && returnValue1.getSucceeded()) {
            cancel();
        }
    })), host.getClusterId());
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) TagModel(org.ovirt.engine.ui.uicommonweb.models.tags.TagModel) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) Arrays(java.util.Arrays) AttachEntityToTagParameters(org.ovirt.engine.core.common.action.AttachEntityToTagParameters) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) SetHaMaintenanceParameters(org.ovirt.engine.core.common.action.SetHaMaintenanceParameters) Inject(com.google.inject.Inject) Provider(org.ovirt.engine.core.common.businessentities.Provider) TagListModel(org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel) Event(org.ovirt.engine.ui.uicompat.Event) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Map(java.util.Map) Tags(org.ovirt.engine.core.common.businessentities.Tags) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) ActionUtils(org.ovirt.engine.core.common.ActionUtils) RoleType(org.ovirt.engine.core.common.businessentities.RoleType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VdsPowerDownParameters(org.ovirt.engine.core.common.action.VdsPowerDownParameters) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) BusinessEntitiesDefinitions(org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions) StringHelper(org.ovirt.engine.core.compat.StringHelper) FrontendUrlUtils(org.ovirt.engine.ui.frontend.utils.FrontendUrlUtils) VdsSpmStatus(org.ovirt.engine.core.common.businessentities.VdsSpmStatus) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Cloner(org.ovirt.engine.ui.uicommonweb.Cloner) HostGeneralModel.createUpgradeModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostGeneralModel.createUpgradeModel) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) HostErrataCountModel(org.ovirt.engine.ui.uicommonweb.models.HostErrataCountModel) FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent) Uri(org.ovirt.engine.ui.uicommonweb.Uri) VdcObjectType(org.ovirt.engine.core.common.VdcObjectType) HostedEngineDeployConfiguration(org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) QueryType(org.ovirt.engine.core.common.queries.QueryType) ExternalHostGroup(org.ovirt.engine.core.common.businessentities.ExternalHostGroup) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) Guid(org.ovirt.engine.core.compat.Guid) HostGlusterSwiftListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterSwiftListModel) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ExternalDiscoveredHost(org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost) HashMap(java.util.HashMap) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) HostGlusterStorageDevicesListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterStorageDevicesListModel) HashSet(java.util.HashSet) FenceVdsManualyParameters(org.ovirt.engine.core.common.action.FenceVdsManualyParameters) Frontend(org.ovirt.engine.ui.frontend.Frontend) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel) NumaSupportModel(org.ovirt.engine.ui.uicommonweb.models.hosts.numa.NumaSupportModel) Permission(org.ovirt.engine.core.common.businessentities.Permission) Window(com.google.gwt.user.client.Window) ForceSelectSPMParameters(org.ovirt.engine.core.common.action.ForceSelectSPMParameters) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) ReversibleFlow(org.ovirt.engine.ui.uicompat.ReversibleFlow) RemoveVdsParameters(org.ovirt.engine.core.common.action.RemoveVdsParameters) ExternalComputeResource(org.ovirt.engine.core.common.businessentities.ExternalComputeResource) Model(org.ovirt.engine.ui.uicommonweb.models.Model) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) ApproveVdsParameters(org.ovirt.engine.core.common.action.hostdeploy.ApproveVdsParameters) HaMaintenanceMode(org.ovirt.engine.core.common.businessentities.HaMaintenanceMode) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) TaskListModel(org.ovirt.engine.ui.uicommonweb.models.events.TaskListModel) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters) FenceProxySourceTypeHelper(org.ovirt.engine.core.common.utils.pm.FenceProxySourceTypeHelper) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) HostAffinityLabelListModel(org.ovirt.engine.ui.uicommonweb.models.configure.labels.list.HostAffinityLabelListModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) TagAssigningModel(org.ovirt.engine.ui.uicommonweb.TagAssigningModel) HostDeviceListModel(org.ovirt.engine.ui.uicommonweb.models.vms.hostdev.HostDeviceListModel) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) Comparator(java.util.Comparator) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) MaintenanceNumberOfVdssParameters(org.ovirt.engine.core.common.action.MaintenanceNumberOfVdssParameters) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) VDS(org.ovirt.engine.core.common.businessentities.VDS) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) HostedEngineDeployConfiguration(org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration) Provider(org.ovirt.engine.core.common.businessentities.Provider) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)

Example 3 with HostedEngineDeployConfiguration

use of org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration in project ovirt-engine by oVirt.

the class HostValidatorTest method allow36HostWithoutDeployingHostedEngine.

@Test
public void allow36HostWithoutDeployingHostedEngine() {
    HostedEngineDeployConfiguration heConfig = new HostedEngineDeployConfiguration(HostedEngineDeployConfiguration.Action.NONE);
    assertThat(validator.supportsDeployingHostedEngine(heConfig), isValid());
}
Also used : HostedEngineDeployConfiguration(org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration) Test(org.junit.Test)

Aggregations

HostedEngineDeployConfiguration (org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration)3 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 ChangeVDSClusterParameters (org.ovirt.engine.core.common.action.ChangeVDSClusterParameters)2 AddVdsActionParameters (org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters)2 UpdateVdsActionParameters (org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters)2 ExternalComputeResource (org.ovirt.engine.core.common.businessentities.ExternalComputeResource)2 ExternalDiscoveredHost (org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost)2 ExternalHostGroup (org.ovirt.engine.core.common.businessentities.ExternalHostGroup)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 Guid (org.ovirt.engine.core.compat.Guid)2 JsSingleValueStringObject (org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject)2 Window (com.google.gwt.user.client.Window)1 Inject (com.google.inject.Inject)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1