Search in sources :

Example 1 with ManagementNetworkOnClusterOperationParameters

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

the class ClusterGuideModel method onAddDataCenter.

public void onAddDataCenter() {
    @SuppressWarnings("unchecked") ListModel<EntityModel<StoragePool>> dataCentersModel = (ListModel<EntityModel<StoragePool>>) getWindow();
    EntityModel<StoragePool> dataCenter = dataCentersModel.getSelectedItem();
    if (dataCenter != null) {
        Cluster cluster = getEntity();
        cluster.setStoragePoolId(dataCenter.getEntity().getId());
        dataCentersModel.startProgress();
        Frontend.getInstance().runAction(ActionType.UpdateCluster, new ManagementNetworkOnClusterOperationParameters(cluster), result -> {
            if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
                // Succeeded, close this window.
                ClusterGuideModel guideModel = (ClusterGuideModel) result.getState();
                guideModel.postAction();
            }
            // Close popup window.
            setWindow(null);
        }, this);
    } else {
        setWindow(null);
    }
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 2 with ManagementNetworkOnClusterOperationParameters

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

the class ClusterListModel method onResetClusterEmulatedMachine.

public void onResetClusterEmulatedMachine() {
    final ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> prms = new ArrayList<>();
    for (Cluster cluster : getSelectedItems()) {
        ManagementNetworkOnClusterOperationParameters currentParam = new ManagementNetworkOnClusterOperationParameters(cluster);
        currentParam.setForceResetEmulatedMachine(true);
        prms.add(currentParam);
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.UpdateCluster, prms, result -> {
        model.stopProgress();
        cancel();
    });
}
Also used : ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with ManagementNetworkOnClusterOperationParameters

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

the class ClusterListModel method onSaveInternalWithModel.

private void onSaveInternalWithModel(final ClusterModel model) {
    Cluster cluster = buildCluster(model, model.getIsNew() ? new Cluster() : (Cluster) Cloner.clone(getSelectedItem()));
    model.startProgress();
    final Network managementNetwork = model.getManagementNetwork().getSelectedItem();
    final ManagementNetworkOnClusterOperationParameters clusterOperationParameters = new ManagementNetworkOnClusterOperationParameters(cluster, managementNetwork.getId());
    final ActionType actionType = model.getIsNew() ? ActionType.AddCluster : ActionType.UpdateCluster;
    Frontend.getInstance().runAction(actionType, clusterOperationParameters, result -> {
        ClusterListModel<Void> localModel = (ClusterListModel<Void>) result.getState();
        if (model.getIsImportGlusterConfiguration().getEntity()) {
            localModel.postOnSaveInternalWithImport(result.getReturnValue());
        } else {
            localModel.postOnSaveInternal(result.getReturnValue());
        }
    }, this);
}
Also used : ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) ActionType(org.ovirt.engine.core.common.action.ActionType) Network(org.ovirt.engine.core.common.businessentities.network.Network) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 4 with ManagementNetworkOnClusterOperationParameters

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

the class BackendClusterEnabledFeaturesResource method add.

@Override
public Response add(ClusterFeature feature) {
    validateParameters(feature);
    org.ovirt.engine.core.common.businessentities.AdditionalFeature featureEntity = map(feature, null);
    org.ovirt.engine.core.common.businessentities.Cluster cluster = BackendClusterFeatureHelper.getClusterEntity(this, clusterId);
    SupportedAdditionalClusterFeature supportedFeature = new SupportedAdditionalClusterFeature();
    supportedFeature.setFeature(featureEntity);
    supportedFeature.setEnabled(true);
    supportedFeature.setClusterId(clusterId);
    cluster.getAddtionalFeaturesSupported().add(supportedFeature);
    ManagementNetworkOnClusterOperationParameters param = new ManagementNetworkOnClusterOperationParameters(cluster);
    return performCreate(ActionType.UpdateCluster, param, new ClusterFeatureIdResolver(clusterId, featureEntity.getId()));
}
Also used : AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) SupportedAdditionalClusterFeature(org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature)

Example 5 with ManagementNetworkOnClusterOperationParameters

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

the class BackendClusterResource method resetEmulatedMachine.

@Override
public Response resetEmulatedMachine(Action action) {
    QueryReturnValue result = runQuery(QueryType.GetClusterById, new IdQueryParameters(guid));
    if (result != null && result.getSucceeded() && result.getReturnValue() != null) {
        ManagementNetworkOnClusterOperationParameters param = new ManagementNetworkOnClusterOperationParameters(result.getReturnValue());
        param.setForceResetEmulatedMachine(true);
        return doAction(ActionType.UpdateCluster, param, action);
    } else {
        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
    }
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) WebApplicationException(javax.ws.rs.WebApplicationException)

Aggregations

ManagementNetworkOnClusterOperationParameters (org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters)11 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)8 ClusterModel (org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel)2 ArrayList (java.util.ArrayList)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 ClusterOperationParameters (org.ovirt.engine.core.common.action.ClusterOperationParameters)1 SetNonOperationalVdsParameters (org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters)1 AdditionalFeature (org.ovirt.engine.core.common.businessentities.AdditionalFeature)1 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 SupportedAdditionalClusterFeature (org.ovirt.engine.core.common.businessentities.SupportedAdditionalClusterFeature)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 Guid (org.ovirt.engine.core.compat.Guid)1 Version (org.ovirt.engine.core.compat.Version)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1