Search in sources :

Example 16 with VdsActionParameters

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

the class PersistentHostSetupNetworksCommand method executeCommand.

@Override
protected void executeCommand() {
    if (getParameters().getShouldBeLogged()) {
        auditLogDirector.log(this, AuditLogType.PERSIST_HOST_SETUP_NETWORK_ON_HOST);
    }
    ActionReturnValue returnValue = runInternalAction(ActionType.HostSetupNetworks, getParameters(), cloneContextAndDetachFromParent());
    if (returnValue.getSucceeded()) {
        boolean changesDetected = checkForChanges();
        if (changesDetected) {
            VdsActionParameters parameters = new VdsActionParameters(getParameters().getVdsId());
            parameters.setShouldBeLogged(false);
            parameters.setCorrelationId(getCorrelationId());
            returnValue = runInternalAction(ActionType.CommitNetworkChanges, parameters, cloneContextAndDetachFromParent());
        }
    }
    if (!returnValue.getSucceeded()) {
        propagateFailure(returnValue);
    }
    setSucceeded(returnValue.getSucceeded());
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters)

Example 17 with VdsActionParameters

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

the class RefreshHostCommand method executeCommand.

@Override
protected void executeCommand() {
    VdsActionParameters parameters = new VdsActionParameters(getVdsId());
    parameters.setLockProperties(LockProperties.create(LockProperties.Scope.Execution).withWait(isInternalExecution()));
    ActionReturnValue returnValue = runInternalAction(ActionType.RefreshHostCapabilities, parameters);
    if (!returnValue.getSucceeded()) {
        return;
    }
    returnValue = runInternalAction(ActionType.RefreshHostDevices, parameters);
    if (!returnValue.getSucceeded()) {
        return;
    }
    setSucceeded(true);
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters)

Example 18 with VdsActionParameters

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

the class AddStorageDomainRM method prepare1.

public void prepare1() {
    EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext();
    HostListModel<?> model = enlistmentContext.getModel();
    final VDS host = model.getSelectedItem();
    VdsActionParameters parameters = new VdsActionParameters(host.getId());
    parameters.setCorrelationId(getCorrelationId());
    Frontend.getInstance().runAction(ActionType.ActivateVds, parameters, result -> {
        ActionReturnValue returnValue = result.getReturnValue();
        context.activateVdsReturnValue = returnValue;
        prepare2();
    });
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters)

Example 19 with VdsActionParameters

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

the class InitVdsOnUpCommand method refreshHostDeviceList.

private void refreshHostDeviceList() {
    try {
        CommandContext ctx = cloneContext();
        ctx.getExecutionContext().setJobRequired(false);
        runInternalAction(ActionType.RefreshHostDevices, new VdsActionParameters(getVdsId()), ctx);
    } catch (EngineException e) {
        log.error("Could not refresh host devices for host '{}'", getVds().getName());
    }
}
Also used : CommandContext(org.ovirt.engine.core.bll.context.CommandContext) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) EngineException(org.ovirt.engine.core.common.errors.EngineException)

Example 20 with VdsActionParameters

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

the class ChangeVDSClusterCommand method executeCommand.

@Override
protected void executeCommand() {
    final Guid targetClusterId = getParameters().getClusterId();
    if (getSourceCluster().getId().equals(targetClusterId)) {
        setSucceeded(true);
        return;
    }
    // save the new cluster id
    TransactionSupport.executeInNewTransaction(() -> {
        VdsStatic staticData = getVds().getStaticData();
        getCompensationContext().snapshotEntity(staticData);
        // of the host is needed to reconfigure the firewall.
        if (targetCluster.getFirewallType() != getSourceCluster().getFirewallType()) {
            staticData.setReinstallRequired(true);
        }
        staticData.setClusterId(targetClusterId);
        vdsStaticDao.update(staticData);
        getCompensationContext().stateChanged();
        // remove the server from resource manager and add it back
        initializeVds();
        return null;
    });
    if (targetStoragePool != null && (getSourceCluster().getStoragePoolId() == null || !targetStoragePool.getId().equals(getSourceCluster().getStoragePoolId()))) {
        VdsActionParameters addVdsSpmIdParams = new VdsActionParameters(getVdsIdRef());
        addVdsSpmIdParams.setSessionId(getParameters().getSessionId());
        addVdsSpmIdParams.setCompensationEnabled(true);
        ActionReturnValue addVdsSpmIdReturn = runInternalAction(ActionType.AddVdsSpmId, addVdsSpmIdParams, cloneContext().withoutLock().withoutExecutionContext());
        if (!addVdsSpmIdReturn.getSucceeded()) {
            setSucceeded(false);
            getReturnValue().setFault(addVdsSpmIdReturn.getFault());
            return;
        }
    }
    if (getSourceCluster().supportsGlusterService() && clusterUtils.hasServers(getSourceCluster().getId())) {
        if (!glusterHostRemove(getSourceCluster().getId())) {
            setSucceeded(false);
            return;
        }
    }
    if (getTargetCluster().supportsGlusterService() && clusterUtils.hasMultipleServers(getTargetCluster().getId())) {
        if (!glusterHostAdd(getTargetCluster().getId())) {
            setSucceeded(false);
            return;
        }
    }
    if (getSourceCluster().getStoragePoolId() != null && (targetStoragePool == null || !getSourceCluster().getStoragePoolId().equals(targetStoragePool.getId()))) {
        vdsSpmIdMapDao.removeByVdsAndStoragePool(getVds().getId(), getSourceCluster().getStoragePoolId());
    }
    HostNetworkAttachmentsPersister persister = new HostNetworkAttachmentsPersister(this.networkAttachmentDao, getVdsId(), interfaceDao.getAllInterfacesForVds(getVdsId()), Collections.emptyList(), getTargetClusterNetworks());
    persister.persistNetworkAttachments();
    if (VDSStatus.PendingApproval != getVds().getStatus()) {
        configureNetworks();
    }
    setSucceeded(true);
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) Guid(org.ovirt.engine.core.compat.Guid) HostNetworkAttachmentsPersister(org.ovirt.engine.core.vdsbroker.vdsbroker.HostNetworkAttachmentsPersister)

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