private void clusterPolicyChanged() { ClusterPolicy clusterPolicy = getClusterPolicy().getSelectedItem(); Map<String, String> policyProperties = new HashMap<>(); Map<Guid, PolicyUnit> allPolicyUnits = new HashMap<>(); if (clusterPolicy.getFilters() != null) { for (Guid policyUnitId : clusterPolicy.getFilters()) { allPolicyUnits.put(policyUnitId, policyUnitMap.get(policyUnitId)); } } if (clusterPolicy.getFunctions() != null) { for (Pair<Guid, Integer> pair : clusterPolicy.getFunctions()) { allPolicyUnits.put(pair.getFirst(), policyUnitMap.get(pair.getFirst())); } } if (clusterPolicy.getBalance() != null) { allPolicyUnits.put(clusterPolicy.getBalance(), policyUnitMap.get(clusterPolicy.getBalance())); } for (PolicyUnit policyUnit : allPolicyUnits.values()) { if (policyUnit.getParameterRegExMap() != null) { policyProperties.putAll(policyUnit.getParameterRegExMap()); } } getCustomPropertySheet().setKeyValueMap(policyProperties); if (getIsEdit() && clusterPolicy.getId().equals(getEntity().getClusterPolicyId())) { getCustomPropertySheet().deserialize(KeyValueModel.convertProperties(getEntity().getClusterPolicyProperties())); } else { getCustomPropertySheet().deserialize(KeyValueModel.convertProperties(clusterPolicy.getParameterMap())); } }
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); existingCluster = dao.get(FixturesTool.CLUSTER_RHEL6_ISCSI); groupWithNoRunningVms = dao.get(FixturesTool.CLUSTER_NO_RUNNING_VMS); newGroup = new Cluster(); newGroup.setName("New VDS Group"); newGroup.setCompatibilityVersion(Version.getLast()); newGroup.setVirtService(true); newGroup.setGlusterService(false); newGroup.setClusterPolicyId(existingCluster.getClusterPolicyId()); // set cluster policy name to allow equals method to succeed newGroup.setClusterPolicyName(clusterPolicyDao.get(existingCluster.getClusterPolicyId(), Collections.emptyMap()).getName()); newGroup.setClusterPolicyProperties(new LinkedHashMap<>()); newGroup.setDetectEmulatedMachine(true); newGroup.setEmulatedMachine("rhel6.4.0"); newGroup.setArchitecture(ArchitectureType.x86_64); newGroup.setGlusterCliBasedSchedulingOn(true); newGroup.setMigrationBandwidthLimitType(MigrationBandwidthLimitType.CUSTOM); newGroup.setCustomMigrationNetworkBandwidth(1000); newGroup.setMigrationPolicyId(Guid.newGuid()); newGroup.setMacPoolId(FixturesTool.DEFAULT_MAC_POOL_ID); newGroup.setFirewallType(FirewallType.FIREWALLD); newGroup.setLogMaxMemoryUsedThreshold(95); newGroup.setLogMaxMemoryUsedThresholdType(LogMaxMemoryUsedThresholdType.PERCENTAGE); newGroup.setVncEncryptionEnabled(true); }
Guid clusterPolicyId = entity.getClusterPolicyId(); if (clusterPolicyId != null) { SchedulingPolicy schedulingPolicy = model.getSchedulingPolicy();
.addValue("trusted_service", cluster.supportsTrustedService()) .addValue("ha_reservation", cluster.supportsHaReservation()) .addValue("cluster_policy_id", cluster.getClusterPolicyId()) .addValue("cluster_policy_custom_properties", SerializationFactory.getSerializer().serialize(cluster.getClusterPolicyProperties()))
if (getIsEdit() && getEntity() != null && clusterPolicy.getId() .equals(getEntity().getClusterPolicyId())) { selectedClusterPolicy = clusterPolicy;