@Mapping(from = FencingPolicy.class, to = org.ovirt.engine.core.common.businessentities.FencingPolicy.class) public static org.ovirt.engine.core.common.businessentities.FencingPolicy map(FencingPolicy model, org.ovirt.engine.core.common.businessentities.FencingPolicy template) { org.ovirt.engine.core.common.businessentities.FencingPolicy entity = template != null ? template : new org.ovirt.engine.core.common.businessentities.FencingPolicy(); if(model.isSetEnabled()) { entity.setFencingEnabled(model.isEnabled()); } if (model.isSetSkipIfSdActive()) { entity.setSkipFencingIfSDActive(model.getSkipIfSdActive().isEnabled()); } if (model.isSetSkipIfConnectivityBroken()) { entity.setSkipFencingIfConnectivityBroken(model.getSkipIfConnectivityBroken().isEnabled()); if (model.getSkipIfConnectivityBroken().getThreshold() != null) { entity.setHostsWithBrokenConnectivityThreshold(model.getSkipIfConnectivityBroken().getThreshold()); } else { entity.setHostsWithBrokenConnectivityThreshold(50); } } if (model.isSetSkipIfGlusterBricksUp()) { entity.setSkipFencingIfGlusterBricksUp(model.isSkipIfGlusterBricksUp()); } if (model.isSetSkipIfGlusterQuorumNotMet()) { entity.setSkipFencingIfGlusterQuorumNotMet(model.isSkipIfGlusterQuorumNotMet()); } return entity; }
@Mapping(from = org.ovirt.engine.core.common.businessentities.FencingPolicy.class, to = FencingPolicy.class) public static FencingPolicy map(org.ovirt.engine.core.common.businessentities.FencingPolicy entity, FencingPolicy template) { FencingPolicy model = template != null ? template : new FencingPolicy(); SkipIfSdActive skipIfSdActive = new SkipIfSdActive(); SkipIfConnectivityBroken skipIfConnBroken = new SkipIfConnectivityBroken(); skipIfSdActive.setEnabled(entity.isSkipFencingIfSDActive()); skipIfConnBroken.setEnabled(entity.isSkipFencingIfConnectivityBroken()); skipIfConnBroken.setThreshold(entity.getHostsWithBrokenConnectivityThreshold()); model.setEnabled(entity.isFencingEnabled()); model.setSkipIfSdActive(skipIfSdActive); model.setSkipIfConnectivityBroken(skipIfConnBroken); model.setSkipIfGlusterBricksUp(entity.isSkipFencingIfGlusterBricksUp()); model.setSkipIfGlusterQuorumNotMet(entity.isSkipFencingIfGlusterQuorumNotMet()); return model; } }
public Cluster() { migrateOnError = MigrateOnErrorOptions.YES; name = ""; virtService = true; optimizationType = OptimizationType.NONE; additionalRngSources = new HashSet<>(); fencingPolicy = new FencingPolicy(); addtionalFeaturesSupported = new HashSet<>(); ksmMergeAcrossNumaNodes = true; migrationBandwidthLimitType = MigrationBandwidthLimitType.DEFAULT; requiredSwitchTypeForCluster = SwitchType.LEGACY; logMaxMemoryUsedThresholdType = LogMaxMemoryUsedThresholdType.PERCENTAGE; description = ""; comment = ""; cpuName = ""; vncEncryptionEnabled = true; }
protected void cluster_SelectedItemChanged() { Cluster cluster = getCluster().getSelectedItem(); if (cluster == null) { return; } getFencingEnabled().setEntity(cluster.getFencingPolicy().isFencingEnabled()); AsyncDataProvider.getInstance().getPmTypeList(new AsyncQuery<>(pmTypes -> updatePmTypeList(pmTypes)), cluster.getCompatibilityVersion()); //Match the appropriate selected data center to the selected cluster, don't fire update events. if (getDataCenter() != null && getDataCenter().getItems() != null) { for (StoragePool datacenter : getDataCenter().getItems()) { if (datacenter.getId().equals(cluster.getStoragePoolId())) { getDataCenter().setSelectedItem(datacenter, false); break; } } } final CpuVendor newCpuVendor = getCurrentCpuVendor(); if (newCpuVendor != null && !newCpuVendor.equals(lastNonNullCpuVendor)) { lastNonNullCpuVendor = newCpuVendor; cpuVendorChanged(); } getNetworkProviderModel().setDefaultProviderId(cluster.getDefaultNetworkProviderId()); setVgpuPlacementChangeability(cluster.getCompatibilityVersion()); }
private void updateFencingPolicyContent(Version ver) { // skipFencingIfConnectivityBroken option is enabled when fencing is enabled for all cluster versions getSkipFencingIfConnectivityBrokenEnabled().setIsChangeable(getFencingEnabledModel().getEntity()); getHostsWithBrokenConnectivityThreshold().setIsChangeable(getFencingEnabledModel().getEntity()); getSkipFencingIfGlusterBricksUp().setIsChangeable(getFencingEnabledModel().getEntity()); getSkipFencingIfGlusterQuorumNotMet().setIsChangeable(getFencingEnabledModel().getEntity()); if (ver == null) { if (!getFencingEnabledModel().getEntity()) { // fencing is disabled and cluster version not selected yet, so disable skipFencingIfSDActive getSkipFencingIfSDActiveEnabled().setIsChangeable(false); } } else { // skipFencingIfSDActive is enabled for supported cluster level if fencing is not disabled getSkipFencingIfSDActiveEnabled().setIsChangeable(getFencingEnabledModel().getEntity()); if (getEntity() == null) { // this can happen when creating new cluster and cluster dialog is shown getSkipFencingIfSDActiveEnabled().setEntity(true); } else { getSkipFencingIfSDActiveEnabled().setEntity( getEntity().getFencingPolicy().isSkipFencingIfSDActive()); } } }
private static Cluster cloneCluster(Cluster instance) { Cluster obj = new Cluster(); obj.setId(instance.getId()); obj.setName(instance.getName()); obj.setDescription(instance.getDescription()); obj.setComment(instance.getComment()); obj.setCpuName(instance.getCpuName()); obj.setClusterCompatibilityLevelUpgradeNeeded(instance.isClusterCompatibilityLevelUpgradeNeeded()); obj.setCompatibilityVersion(instance.getCompatibilityVersion()); obj.setMigrateOnError(instance.getMigrateOnError()); obj.setTransparentHugepages(instance.getTransparentHugepages()); obj.setStoragePoolId(instance.getStoragePoolId()); obj.setMaxVdsMemoryOverCommit(instance.getMaxVdsMemoryOverCommit()); obj.setCountThreadsAsCores(instance.getCountThreadsAsCores()); obj.setEmulatedMachine(instance.getEmulatedMachine()); obj.setDetectEmulatedMachine(instance.isDetectEmulatedMachine()); obj.setArchitecture(instance.getArchitecture()); obj.setSerialNumberPolicy(instance.getSerialNumberPolicy()); obj.setCustomSerialNumber(instance.getCustomSerialNumber()); obj.setFencingPolicy(new FencingPolicy(instance.getFencingPolicy())); obj.setAutoConverge(instance.getAutoConverge()); obj.setMigrateCompressed(instance.getMigrateCompressed()); return obj; }
getFencingEnabledModel().setEntity(getEntity().getFencingPolicy().isFencingEnabled()); getSkipFencingIfSDActiveEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfSDActive()); getSkipFencingIfConnectivityBrokenEnabled().setEntity(getEntity().getFencingPolicy() .isSkipFencingIfConnectivityBroken()); getHostsWithBrokenConnectivityThreshold().setSelectedItem(getEntity().getFencingPolicy() .getHostsWithBrokenConnectivityThreshold()); getSkipFencingIfGlusterBricksUp().setEntity(getEntity().getFencingPolicy().isSkipFencingIfGlusterBricksUp()); getSkipFencingIfGlusterQuorumNotMet().setEntity(getEntity().getFencingPolicy().isSkipFencingIfGlusterQuorumNotMet());
cluster.getFencingPolicy().setFencingEnabled(model.getFencingEnabledModel().getEntity()); cluster.getFencingPolicy().setSkipFencingIfSDActive(model.getSkipFencingIfSDActiveEnabled().getEntity()); cluster.getFencingPolicy().setSkipFencingIfConnectivityBroken(model.getSkipFencingIfConnectivityBrokenEnabled().getEntity()); cluster.getFencingPolicy().setHostsWithBrokenConnectivityThreshold(model.getHostsWithBrokenConnectivityThreshold().getSelectedItem().intValue()); cluster.getFencingPolicy().setSkipFencingIfGlusterBricksUp(model.getSkipFencingIfGlusterBricksUp().getEntity()); cluster.getFencingPolicy().setSkipFencingIfGlusterQuorumNotMet(model.getSkipFencingIfGlusterQuorumNotMet().getEntity());
.addValue("serial_number_policy", cluster.getSerialNumberPolicy() == null ? null : cluster.getSerialNumberPolicy().getValue()) .addValue("custom_serial_number", cluster.getCustomSerialNumber()) .addValue("skip_fencing_if_sd_active", cluster.getFencingPolicy().isSkipFencingIfSDActive()) .addValue("skip_fencing_if_connectivity_broken", cluster.getFencingPolicy().isSkipFencingIfConnectivityBroken()) .addValue("hosts_with_broken_connectivity_threshold", cluster.getFencingPolicy().getHostsWithBrokenConnectivityThreshold()) .addValue("fencing_enabled", cluster.getFencingPolicy().isFencingEnabled()) .addValue("is_auto_converge", cluster.getAutoConverge()) .addValue("is_migrate_compressed", cluster.getMigrateCompressed()) .addValue("mac_pool_id", cluster.getMacPoolId()) .addValue("switch_type", cluster.getRequiredSwitchTypeForCluster().getOptionValue()) .addValue("skip_fencing_if_gluster_bricks_up", cluster.getFencingPolicy().isSkipFencingIfGlusterBricksUp()) .addValue("skip_fencing_if_gluster_quorum_not_met", cluster.getFencingPolicy().isSkipFencingIfGlusterQuorumNotMet()) .addValue("firewall_type", cluster.getFirewallType()) .addValue("default_network_provider_id", cluster.getDefaultNetworkProviderId())