Search in sources :

Example 6 with VdsActionParameters

use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.

the class FenceVdsManualyCommand method executeCommand.

@Override
protected void executeCommand() {
    setVdsName(problematicVds.getName());
    log.info("Start fence execution for Host '{}' (spm status: '{}')", problematicVds.getName(), problematicVds.getSpmStatus());
    if (problematicVds.getSpmStatus() == VdsSpmStatus.SPM) {
        activateDataCenter();
    }
    if (getParameters().getClearVMs()) {
        VdsActionParameters tempVar = new VdsActionParameters(problematicVds.getId());
        tempVar.setSessionId(getParameters().getSessionId());
        runInternalActionWithTasksContext(ActionType.ClearNonResponsiveVdsVms, tempVar);
    }
    setSucceeded(true);
    // Remove all alerts except NOT CONFIG alert
    alertDirector.removeAllVdsAlerts(problematicVds.getId(), false);
}
Also used : VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters)

Example 7 with VdsActionParameters

use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.

the class AddVdsCommand method executeCommand.

@Override
protected void executeCommand() {
    Guid oVirtId = getParameters().getVdsForUniqueId();
    if (oVirtId != null) {
        // if fails to remove deprecated entry, we might attempt to add new oVirt host with an existing unique-id.
        if (!removeDeprecatedOvirtEntry(oVirtId)) {
            log.error("Failed to remove duplicated oVirt entry with id '{}'. Abort adding oVirt Host type", oVirtId);
            throw new EngineException(EngineError.HOST_ALREADY_EXISTS);
        }
    }
    completeOpenstackNetworkProviderId();
    TransactionSupport.executeInNewTransaction(() -> {
        addVdsStaticToDb();
        addVdsDynamicToDb();
        addVdsStatisticsToDb();
        addAffinityLabels();
        getCompensationContext().stateChanged();
        return null;
    });
    if (getParameters().isProvisioned()) {
        HostProviderProxy proxy = providerProxyFactory.create(getHostProvider());
        proxy.provisionHost(getParameters().getvds(), getParameters().getHostGroup(), getParameters().getComputeResource(), getParameters().getHostMac(), getParameters().getDiscoverName(), getParameters().getPassword(), getParameters().getDiscoverIp());
        addCustomValue("HostGroupName", getParameters().getHostGroup().getName());
        auditLogDirector.log(this, AuditLogType.VDS_PROVISION);
    }
    // set vds spm id
    if (getCluster().getStoragePoolId() != null) {
        VdsActionParameters tempVar = new VdsActionParameters(getVdsIdRef());
        tempVar.setSessionId(getParameters().getSessionId());
        tempVar.setCompensationEnabled(true);
        ActionReturnValue addVdsSpmIdReturn = runInternalAction(ActionType.AddVdsSpmId, tempVar, cloneContext().withoutLock().withoutExecutionContext());
        if (!addVdsSpmIdReturn.getSucceeded()) {
            setSucceeded(false);
            getReturnValue().setFault(addVdsSpmIdReturn.getFault());
            return;
        }
    }
    TransactionSupport.executeInNewTransaction(() -> {
        initializeVds(true);
        alertIfPowerManagementNotConfigured(getParameters().getVdsStaticData());
        testVdsPowerManagementStatus(getParameters().getVdsStaticData());
        setSucceeded(true);
        setActionReturnValue(getVdsIdRef());
        // If the installation failed, we don't want to compensate for the failure since it will remove the
        // host, but instead the host should be left in an "install failed" status.
        getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand();
        return null;
    });
    // clients). they are installed as part of the approve process or automatically after provision
    if (Config.<Boolean>getValue(ConfigValues.InstallVds) && !getParameters().isPending() && !getParameters().isProvisioned()) {
        final InstallVdsParameters installVdsParameters = new InstallVdsParameters(getVdsId(), getParameters().getPassword());
        installVdsParameters.setAuthMethod(getParameters().getAuthMethod());
        installVdsParameters.setOverrideFirewall(getParameters().getOverrideFirewall());
        installVdsParameters.setActivateHost(getParameters().getActivateHost());
        installVdsParameters.setNetworkProviderId(getParameters().getVdsStaticData().getOpenstackNetworkProviderId());
        installVdsParameters.setNetworkMappings(getParameters().getNetworkMappings());
        installVdsParameters.setEnableSerialConsole(getParameters().getEnableSerialConsole());
        if (getParameters().getHostedEngineDeployConfiguration() != null) {
            Map<String, String> vdsDeployParams = hostedEngineHelper.createVdsDeployParams(getVdsId(), getParameters().getHostedEngineDeployConfiguration().getDeployAction());
            installVdsParameters.setHostedEngineConfiguration(vdsDeployParams);
        }
        Map<String, String> values = new HashMap<>();
        values.put(VdcObjectType.VDS.name().toLowerCase(), getParameters().getvds().getName());
        Step installStep = executionHandler.addSubStep(getExecutionContext(), getExecutionContext().getJob().getStep(StepEnum.EXECUTING), StepEnum.INSTALLING_HOST, ExecutionMessageDirector.resolveStepMessage(StepEnum.INSTALLING_HOST, values));
        final ExecutionContext installCtx = new ExecutionContext();
        installCtx.setJob(getExecutionContext().getJob());
        installCtx.setStep(installStep);
        installCtx.setMonitored(true);
        installCtx.setShouldEndJob(true);
        ThreadPoolUtil.execute(() -> runInternalAction(ActionType.InstallVdsInternal, installVdsParameters, cloneContextAndDetachFromParent().withExecutionContext(installCtx)));
        ExecutionHandler.setAsyncJob(getExecutionContext(), true);
    }
}
Also used : ExecutionContext(org.ovirt.engine.core.bll.job.ExecutionContext) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) HashMap(java.util.HashMap) InstallVdsParameters(org.ovirt.engine.core.common.action.hostdeploy.InstallVdsParameters) EngineException(org.ovirt.engine.core.common.errors.EngineException) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) Guid(org.ovirt.engine.core.compat.Guid) Step(org.ovirt.engine.core.common.job.Step) HostProviderProxy(org.ovirt.engine.core.bll.host.provider.HostProviderProxy)

Example 8 with VdsActionParameters

use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.

the class HostInterfaceListModel method onSyncAllHostNetworkConfirm.

private void onSyncAllHostNetworkConfirm() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    getWindow().startProgress();
    Frontend.getInstance().runAction(ActionType.SyncAllHostNetworks, new VdsActionParameters(getEntity().getId()), result -> {
        getWindow().stopProgress();
        cancel();
    }, null);
}
Also used : VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 9 with VdsActionParameters

use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.

the class HostListModel method enrollCertificate.

private void enrollCertificate() {
    final VDS host = getSelectedItem();
    Frontend.getInstance().runAction(ActionType.HostEnrollCertificate, new VdsActionParameters(host.getId()));
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters)

Example 10 with VdsActionParameters

use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.

the class HostListModel method activate.

public void activate() {
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    Collections.sort(getSelectedItems(), Comparator.comparing(VDS::getVdsSpmPriority).reversed());
    for (VDS vds : getSelectedItems()) {
        list.add(new VdsActionParameters(vds.getId()));
    }
    Frontend.getInstance().runMultipleAction(ActionType.ActivateVds, list, result -> {
    }, null);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Aggregations

VdsActionParameters (org.ovirt.engine.core.common.action.VdsActionParameters)22 VDS (org.ovirt.engine.core.common.businessentities.VDS)11 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)9 ArrayList (java.util.ArrayList)7 AddVdsActionParameters (org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters)7 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)6 FenceVdsActionParameters (org.ovirt.engine.core.common.action.FenceVdsActionParameters)5 UpdateVdsActionParameters (org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters)4 Guid (org.ovirt.engine.core.compat.Guid)4 EngineException (org.ovirt.engine.core.common.errors.EngineException)3 Timer (com.google.gwt.user.client.Timer)2 ChangeVDSClusterParameters (org.ovirt.engine.core.common.action.ChangeVDSClusterParameters)2 ApproveVdsParameters (org.ovirt.engine.core.common.action.hostdeploy.ApproveVdsParameters)2 InstallVdsParameters (org.ovirt.engine.core.common.action.hostdeploy.InstallVdsParameters)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 JsSingleValueStringObject (org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2 MoveHost (org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHost)2 MoveHostData (org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHostData)2 HashMap (java.util.HashMap)1