Search in sources :

Example 6 with PreparingEnlistment

use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.

the class AddStorageDomainRM method prepare5.

private void prepare5() {
    PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
    EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
    HostListModel<?> model = enlistmentContext.getModel();
    ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
    ActionReturnValue returnValue = context.addStorageServerConnectionReturnValue;
    if (returnValue == null || !returnValue.getSucceeded()) {
        // Don't rollback.
        context.enlistment = null;
        enlistment.done();
    } else {
        StorageDomainStatic storage = new StorageDomainStatic();
        storage.setStorageType(StorageType.LOCALFS);
        storage.setStorageDomainType(StorageDomainType.Data);
        storage.setStorageName(configureModel.getFormattedStorageName().getEntity());
        storage.setStorage((String) returnValue.getActionReturnValue());
        StorageDomainManagementParameter parameters = new StorageDomainManagementParameter(storage);
        parameters.setVdsId(context.host.getId());
        parameters.setCorrelationId(getCorrelationId());
        Frontend.getInstance().runAction(ActionType.AddLocalStorageDomain, parameters, result -> {
            ActionReturnValue returnValue1 = result.getReturnValue();
            context.addLocalStorageDomainReturnValue = returnValue1;
            prepare6();
        });
    }
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) PreparingEnlistment(org.ovirt.engine.ui.uicompat.PreparingEnlistment) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) StorageDomainManagementParameter(org.ovirt.engine.core.common.action.StorageDomainManagementParameter)

Example 7 with PreparingEnlistment

use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.

the class ChangeHostClusterRM method prepare2.

public void prepare2() {
    PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
    ActionReturnValue returnValue = context.changeVDSClusterReturnValue;
    context.enlistment = null;
    if (returnValue != null && returnValue.getSucceeded()) {
        enlistment.prepared();
    } else {
        enlistment.forceRollback();
    }
}
Also used : PreparingEnlistment(org.ovirt.engine.ui.uicompat.PreparingEnlistment) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Example 8 with PreparingEnlistment

use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.

the class ChangeHostClusterRM method prepare1.

public void prepare1() {
    PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
    EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext();
    HostListModel<?> model = enlistmentContext.getModel();
    VDS host = model.getSelectedItem();
    if (!enlistmentContext.getClusterId().equals(host.getClusterId())) {
        enlistmentContext.setOldClusterId(host.getClusterId());
        ChangeVDSClusterParameters parameters = new ChangeVDSClusterParameters(enlistmentContext.getClusterId(), host.getId());
        parameters.setCorrelationId(getCorrelationId());
        Frontend.getInstance().runAction(ActionType.ChangeVDSCluster, parameters, result -> {
            ActionReturnValue returnValue = result.getReturnValue();
            context.changeVDSClusterReturnValue = returnValue;
            prepare2();
        });
    } else {
        context.enlistment = null;
        enlistment.prepared();
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) PreparingEnlistment(org.ovirt.engine.ui.uicompat.PreparingEnlistment) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters)

Example 9 with PreparingEnlistment

use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.

the class AddClusterRM method prepare3.

private void prepare3() {
    PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
    EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
    ActionReturnValue returnValue = context.addClusterReturnValue;
    context.enlistment = null;
    if (returnValue != null && returnValue.getSucceeded()) {
        enlistmentContext.setClusterId((Guid) returnValue.getActionReturnValue());
        context.enlistment = null;
        enlistment.prepared();
    } else {
        enlistment.forceRollback();
    }
}
Also used : PreparingEnlistment(org.ovirt.engine.ui.uicompat.PreparingEnlistment) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Example 10 with PreparingEnlistment

use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.

the class AddClusterRM method prepare2.

public void prepare2() {
    PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
    EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
    HostListModel<?> model = enlistmentContext.getModel();
    ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
    Cluster candidate = configureModel.getCandidateCluster();
    ClusterModel clusterModel = configureModel.getCluster();
    String clusterName = clusterModel.getName().getEntity();
    if (candidate == null || !Objects.equals(candidate.getName(), clusterName)) {
        // Try to find existing cluster with the specified name.
        Cluster cluster = context.clusterFoundByName;
        if (cluster != null) {
            enlistmentContext.setClusterId(cluster.getId());
            context.enlistment = null;
            enlistment.prepared();
        } else {
            Version version = clusterModel.getVersion().getSelectedItem();
            cluster = new Cluster();
            cluster.setName(clusterName);
            cluster.setDescription(clusterModel.getDescription().getEntity());
            cluster.setStoragePoolId(enlistmentContext.getDataCenterId());
            cluster.setCpuName(clusterModel.getCPU().getSelectedItem().getCpuName());
            cluster.setMaxVdsMemoryOverCommit(clusterModel.getMemoryOverCommit());
            cluster.setCountThreadsAsCores(Boolean.TRUE.equals(clusterModel.getVersionSupportsCpuThreads().getEntity()) && Boolean.TRUE.equals(clusterModel.getCountThreadsAsCores().getEntity()));
            cluster.setTransparentHugepages(true);
            cluster.setCompatibilityVersion(version);
            cluster.setMigrateOnError(clusterModel.getMigrateOnErrorOption());
            ClusterOperationParameters parameters = new ManagementNetworkOnClusterOperationParameters(cluster);
            parameters.setCorrelationId(getCorrelationId());
            Frontend.getInstance().runAction(ActionType.AddCluster, parameters, result -> {
                ActionReturnValue returnValue = result.getReturnValue();
                context.addClusterReturnValue = returnValue;
                prepare3();
            });
        }
    } else {
        enlistmentContext.setClusterId(configureModel.getCluster().getClusterId());
        context.enlistment = null;
        enlistment.prepared();
    }
}
Also used : ClusterModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) PreparingEnlistment(org.ovirt.engine.ui.uicompat.PreparingEnlistment) Version(org.ovirt.engine.core.compat.Version) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ClusterOperationParameters(org.ovirt.engine.core.common.action.ClusterOperationParameters) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters)

Aggregations

PreparingEnlistment (org.ovirt.engine.ui.uicompat.PreparingEnlistment)11 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)10 StorageDomainManagementParameter (org.ovirt.engine.core.common.action.StorageDomainManagementParameter)2 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)2 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 Timer (com.google.gwt.user.client.Timer)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 ChangeVDSClusterParameters (org.ovirt.engine.core.common.action.ChangeVDSClusterParameters)1 ClusterOperationParameters (org.ovirt.engine.core.common.action.ClusterOperationParameters)1 ManagementNetworkOnClusterOperationParameters (org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters)1 StoragePoolManagementParameter (org.ovirt.engine.core.common.action.StoragePoolManagementParameter)1 VdsActionParameters (org.ovirt.engine.core.common.action.VdsActionParameters)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 VDSStatus (org.ovirt.engine.core.common.businessentities.VDSStatus)1 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)1 Version (org.ovirt.engine.core.compat.Version)1