Search in sources :

Example 1 with Cluster

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

the class AbstractVmPopupWidget method getDefaultEmulatedMachineLabel.

private String getDefaultEmulatedMachineLabel() {
    Cluster cluster = getModel().getSelectedCluster();
    String newClusterEmulatedMachine = constants.clusterDefaultOption();
    if (cluster != null) {
        // $NON-NLS-1$
        String emulatedMachine = (cluster.getEmulatedMachine() == null) ? "" : cluster.getEmulatedMachine();
        // $NON-NLS-1$ //$NON-NLS-2$
        newClusterEmulatedMachine += "(" + emulatedMachine + ")";
    }
    return newClusterEmulatedMachine;
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) DataCenterWithCluster(org.ovirt.engine.ui.uicommonweb.models.vms.DataCenterWithCluster)

Example 2 with Cluster

use of org.ovirt.engine.core.common.businessentities.Cluster 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 3 with Cluster

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

the class ClusterListModel method remove.

public void remove() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeClusterTitle());
    model.setHelpTag(HelpTag.remove_cluster);
    // $NON-NLS-1$
    model.setHashName("remove_cluster");
    ArrayList<String> list = new ArrayList<>();
    for (Cluster a : getSelectedItems()) {
        list.add(a.getName());
    }
    model.setItems(list);
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar2);
}
Also used : ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 4 with Cluster

use of org.ovirt.engine.core.common.businessentities.Cluster 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 5 with Cluster

use of org.ovirt.engine.core.common.businessentities.Cluster 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)

Aggregations

Cluster (org.ovirt.engine.core.common.businessentities.Cluster)346 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)80 Guid (org.ovirt.engine.core.compat.Guid)77 VDS (org.ovirt.engine.core.common.businessentities.VDS)54 List (java.util.List)50 VM (org.ovirt.engine.core.common.businessentities.VM)36 HashMap (java.util.HashMap)35 Map (java.util.Map)33 HashSet (java.util.HashSet)30 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)30 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)28 Version (org.ovirt.engine.core.compat.Version)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)26 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)26 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)25 Set (java.util.Set)24 QueryType (org.ovirt.engine.core.common.queries.QueryType)23 Collections (java.util.Collections)22 Frontend (org.ovirt.engine.ui.frontend.Frontend)22