Search in sources :

Example 11 with MigrationPolicy

use of org.ovirt.engine.core.common.migration.MigrationPolicy in project ovirt-engine by oVirt.

the class ClusterPopupView method edit.

@Override
public void edit(final ClusterModel object) {
    driver.edit(object);
    updateMacPool(object.getMacPoolModel());
    customPropertiesSheetEditor.edit(object.getCustomPropertySheet());
    enableOvirtServiceEditor.setVisible(object.getAllowClusterWithVirtGlusterEnabled());
    enableGlusterServiceEditor.setVisible(object.getAllowClusterWithVirtGlusterEnabled());
    enableOvirtServiceOptionEditor.setVisible(!object.getAllowClusterWithVirtGlusterEnabled());
    enableGlusterServiceOptionEditor.setVisible(!object.getAllowClusterWithVirtGlusterEnabled());
    serialNumberPolicyEditor.edit(object.getSerialNumberPolicy());
    optimizationForServerFormatter(object);
    optimizationForDesktopFormatter(object);
    optimizationCustomFormatter(object);
    object.getOptimizationForServer().getEntityChangedEvent().addListener((ev, sender, args) -> optimizationForServerFormatter(object));
    object.getOptimizationForDesktop().getEntityChangedEvent().addListener((ev, sender, args) -> optimizationForDesktopFormatter(object));
    object.getOptimizationCustom_IsSelected().getEntityChangedEvent().addListener((ev, sender, args) -> {
        if (object.getOptimizationCustom_IsSelected().getEntity()) {
            optimizationCustomFormatter(object);
            optimizationCustomEditor.setVisible(true);
        }
    });
    object.getDataCenter().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
        migrationTab.setVisible(object.isMigrationTabAvailable());
        applyModeCustomizations();
    });
    object.getEnableOvirtService().getEntityChangedEvent().addListener((ev, sender, args) -> updateGlusterFencingPolicyVisibility(object));
    object.getEnableGlusterService().getEntityChangedEvent().addListener((ev, sender, args) -> {
        importGlusterExplanationLabel.setVisible(object.getEnableGlusterService().getEntity() && object.getIsNew());
        updateGlusterFencingPolicyVisibility(object);
    });
    updateGlusterFencingPolicyVisibility(object);
    importGlusterExplanationLabel.setVisible(object.getEnableGlusterService().getEntity() && object.getIsNew());
    object.getVersionSupportsCpuThreads().getEntityChangedEvent().addListener((ev, sender, args) -> cpuThreadsRow.setVisible(object.getVersionSupportsCpuThreads().getEntity()));
    schedulerOptimizationInfoIcon.setText(SafeHtmlUtils.fromTrustedString(templates.italicText(object.getSchedulerOptimizationInfoMessage()).asString().replaceAll("(\r\n|\n)", // $NON-NLS-1$ //$NON-NLS-2$
    "<br />")));
    allowOverbookingInfoIcon.setText(SafeHtmlUtils.fromTrustedString(templates.italicText(object.getAllowOverbookingInfoMessage()).asString().replaceAll("(\r\n|\n)", // $NON-NLS-1$ //$NON-NLS-2$
    "<br />")));
    allowOverbookingRow.setVisible(allowOverbookingEditor.isVisible());
    object.getVersion().getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if (object.getVersion().getSelectedItem() != null) {
            Version clusterVersion = object.getVersion().getSelectedItem();
            migrationPolicyDetails.setVisible(AsyncDataProvider.getInstance().isMigrationPoliciesSupported(clusterVersion));
        }
    });
    object.getAdditionalClusterFeatures().getItemsChangedEvent().addListener((ev, sender, args) -> {
        List<List<AdditionalFeature>> items = (List<List<AdditionalFeature>>) object.getAdditionalClusterFeatures().getItems();
        // Hide the fields if there is no feature to show
        additionalFeaturesExpander.setVisible(!items.get(0).isEmpty());
        additionalFeaturesExpanderContent.setVisible(!items.get(0).isEmpty());
    });
    object.getMigrationPolicies().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
        MigrationPolicy selectedPolicy = object.getMigrationPolicies().getSelectedItem();
        if (selectedPolicy != null) {
            migrationPolicyDetails.setHTML(templates.migrationPolicyDetails(selectedPolicy.getName(), selectedPolicy.getDescription()));
        } else {
            // $NON-NLS-1$
            migrationPolicyDetails.setText("");
        }
    });
}
Also used : Version(org.ovirt.engine.core.compat.Version) List(java.util.List) AdditionalFeature(org.ovirt.engine.core.common.businessentities.AdditionalFeature) MigrationPolicy(org.ovirt.engine.core.common.migration.MigrationPolicy)

Aggregations

MigrationPolicy (org.ovirt.engine.core.common.migration.MigrationPolicy)11 NoMigrationPolicy (org.ovirt.engine.core.common.migration.NoMigrationPolicy)9 Version (org.ovirt.engine.core.compat.Version)5 Guid (org.ovirt.engine.core.compat.Guid)4 ConvergenceConfig (org.ovirt.engine.core.common.migration.ConvergenceConfig)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Test (org.junit.Test)2 ConvergenceItem (org.ovirt.engine.core.common.migration.ConvergenceItem)2 ConvergenceItemWithStallingLimit (org.ovirt.engine.core.common.migration.ConvergenceItemWithStallingLimit)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AdditionalFeature (org.ovirt.engine.core.common.businessentities.AdditionalFeature)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)1 StorageServerConnectionQueryParametersBase (org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase)1 MigrateVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.MigrateVDSCommandParameters)1 RpmVersion (org.ovirt.engine.core.compat.RpmVersion)1 AsyncQuery (org.ovirt.engine.ui.frontend.AsyncQuery)1