Vered Volansky has uploaded a new change for review. Change subject: core: Apply cluster level default ha to new Vms ......................................................................
core: Apply cluster level default ha to new Vms Change-Id: I5fff12f6f3bcba41089dbe3c57b89c6a173399f9 Signed-off-by: Vered Volansky <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java M backend/manager/modules/dal/src/test/resources/fixtures.xml M backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd M backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml M backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml M packaging/branding/ovirt.brand/ovirt-patternfly-compat.css A packaging/dbscripts/upgrade/03_06_0940_add_high_availability_to_vds_groups.sql M packaging/dbscripts/vds_groups_sp.sql 21 files changed, 121 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/71/38571/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java index f53c0b6..a7ee780 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java @@ -77,6 +77,8 @@ private boolean haReservation; + private boolean haVmDefault; + private boolean optionalReasonRequired; private Guid clusterPolicyId; @@ -278,6 +280,14 @@ this.haReservation = haReservation; } + public boolean getHaVmDefault() { + return haVmDefault; + } + + public void setHaVmDefault(boolean haVmDefault) { + this.haVmDefault = haVmDefault; + } + public boolean isOptionalReasonRequired() { return optionalReasonRequired; } @@ -436,6 +446,7 @@ result = prime * result + (emulatedMachine == null ? 0 : emulatedMachine.hashCode()); result = prime * result + (trustedService ? 1231 : 1237); result = prime * result + (haReservation ? 1231 : 1237); + result = prime * result + (haVmDefault ? 1231 : 1237); result = prime * result + (clusterPolicyName == null ? 0 : clusterPolicyName.hashCode()); result = prime * result + (clusterPolicyProperties == null ? 0 : clusterPolicyProperties.hashCode()); result = prime * result + (requiredRngSources == null ? 0 : requiredRngSources.hashCode()); @@ -480,6 +491,7 @@ && ObjectUtils.objectsEqual(emulatedMachine, other.emulatedMachine) && trustedService == other.trustedService && haReservation == other.haReservation + && haVmDefault == other.haVmDefault && ObjectUtils.objectsEqual(clusterPolicyId, other.clusterPolicyId) && ObjectUtils.objectsEqual(clusterPolicyName, other.clusterPolicyName) && ObjectUtils.objectsEqual(clusterPolicyProperties, other.clusterPolicyProperties) diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java index ebabdc5..002d95e 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java @@ -228,7 +228,8 @@ .addValue("hosts_with_broken_connectivity_threshold", group.getFencingPolicy().getHostsWithBrokenConnectivityThreshold()) .addValue("fencing_enabled", group.getFencingPolicy().isFencingEnabled()) .addValue("is_auto_converge", group.getAutoConverge()) - .addValue("is_migrate_compressed", group.getMigrateCompressed()); + .addValue("is_migrate_compressed", group.getMigrateCompressed()) + .addValue("ha_vm_default", group.getHaVmDefault()); return parameterSource; } @@ -295,6 +296,7 @@ entity.getFencingPolicy().setFencingEnabled(rs.getBoolean("fencing_enabled")); entity.setAutoConverge((Boolean) rs.getObject("is_auto_converge")); entity.setMigrateCompressed((Boolean) rs.getObject("is_migrate_compressed")); + entity.setHaVmDefault((Boolean) rs.getObject("ha_vm_default")); return entity; } diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java index 2436430..cde0a05 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java @@ -63,6 +63,7 @@ newGroup.setDetectEmulatedMachine(true); newGroup.setEmulatedMachine("rhel6.4.0"); newGroup.setArchitecture(ArchitectureType.x86_64); + newGroup.setHaVmDefault(true); } @@ -327,6 +328,7 @@ existingVdsGroup.setName("This is the new name"); existingVdsGroup.setVirtService(false); existingVdsGroup.setGlusterService(true); + existingVdsGroup.setHaVmDefault(true); dao.update(existingVdsGroup); diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index 67e8aaa..8e970fe 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -794,6 +794,8 @@ <column>fencing_enabled</column> <column>is_auto_converge</column> <column>is_migrate_compressed</column> + <column>is_migrate_compressed</column> + <column>ha_vm_default</column> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d1</value> <value>rhel6.iscsi</value> @@ -822,6 +824,7 @@ <value>false</value> <value>false</value> <value>50</value> + <value>true</value> <value>true</value> <value>true</value> <value>true</value> @@ -857,6 +860,7 @@ <value>true</value> <value>true</value> <value>false</value> + <value>true</value> </row> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d3</value> @@ -889,6 +893,7 @@ <value>true</value> <value>false</value> <value>true</value> + <value>false</value> </row> <row> <value>0e57070e-2469-4b38-84a2-f111aaabd49d</value> @@ -921,6 +926,7 @@ <value>true</value> <null /> <value>true</value> + <value>false</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7c</value> @@ -953,6 +959,7 @@ <value>true</value> <value>true</value> <null /> + <value>true</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7d</value> @@ -985,6 +992,7 @@ <value>false</value> <null /> <value>false</value> + <value>true</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7e</value> @@ -1017,6 +1025,7 @@ <value>true</value> <value>false</value> <null /> + <value>true</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7f</value> @@ -1049,6 +1058,7 @@ <value>true</value> <null /> <null /> + <value>true</value> </row> <row> <value>ae956031-6be2-43d6-bb8f-5191c9253314</value> @@ -1081,6 +1091,7 @@ <value>false</value> <null /> <null /> + <value>true</value> </row> </table> diff --git a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd index f7febd8..71dd772 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd +++ b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd @@ -1705,6 +1705,7 @@ <xs:element name="tunnel_migration" type="xs:boolean" minOccurs="0" maxOccurs="1"/> <xs:element name="trusted_service" type="xs:boolean" minOccurs="0" maxOccurs="1"/> <xs:element name="ha_reservation" type="xs:boolean" minOccurs="0" maxOccurs="1"/> + <xs:element name="ha_vm_default" type="xs:boolean" minOccurs="0" maxOccurs="1"/> <xs:element name="optional_reason" type="xs:boolean" minOccurs="0" maxOccurs="1"/> <xs:element name="ballooning_enabled" type="xs:boolean" minOccurs="0" maxOccurs="1"/> <xs:element ref="display" minOccurs="0" maxOccurs="1"/> diff --git a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml index 36236a3..b10dd8a 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml +++ b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml @@ -1938,6 +1938,7 @@ cluster.memory_policy.overcommit.percent: 'xs:double', cluster.memory_policy.transparent_hugepages.enabled: 'xs:boolean', cluster.scheduling_policy.policy--DEPRECATED: 'xs:string', cluster.scheduling_policy.thresholds.low--DEPRECATED: 'xs:int', cluster.scheduling_policy.thresholds.high--DEPRECATED: 'xs:int', cluster.scheduling_policy.thresholds.duration--DEPRECATED: 'xs:int', cluster.scheduling_policy.id: 'xs:string', cluster.scheduling_policy.properties.property--COLLECTION: {property.name: 'xs:string', property.value: 'xs:string'}, + cluster.ha_vm_default: 'xs:boolean', cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 'xs:boolean', cluster.tunnel_migration: 'xs:boolean', cluster.ballooning_enabled: 'xs:boolean', cluster.cpu.architecture: 'xs:string', cluster.display.proxy: 'xs:string', cluster.ksm.enabled: 'xs:boolean', cluster.fencing_policy.enabled: 'xs:boolean', cluster.fencing_policy.skip_if_sd_active.enabled: 'xs:boolean', cluster.fencing_policy.skip_if_connectivity_broken.enabled: 'xs:boolean', cluster.fencing_policy.skip_if_connectivity_broken.threshold: 'xs:int'} @@ -1956,7 +1957,7 @@ optionalArguments: {cluster.description: 'xs:string', cluster.comment: 'xs:string', cluster.memory_policy.overcommit.percent: 'xs:double', cluster.memory_policy.transparent_hugepages.enabled: 'xs:boolean', cluster.scheduling_policy.policy--DEPRECATED: 'xs:string', cluster.scheduling_policy.thresholds.low--DEPRECATED: 'xs:int', cluster.scheduling_policy.thresholds.high--DEPRECATED: 'xs:int', cluster.scheduling_policy.thresholds.duration--DEPRECATED: 'xs:int', cluster.scheduling_policy.id: 'xs:string', cluster.scheduling_policy.properties.property--COLLECTION: {property.name: 'xs:string', property.value: 'xs:string'}, cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 'xs:boolean', - cluster.tunnel_migration: 'xs:boolean', cluster.trusted_service: 'xs:boolean', cluster.ha_reservation: 'xs:boolean', cluster.ballooning_enabled: 'xs:boolean', cluster.cpu.architecture: 'xs:string', cluster.display.proxy: 'xs:string', + cluster.tunnel_migration: 'xs:boolean', cluster.trusted_service: 'xs:boolean', cluster.ha_reservation: 'xs:boolean', cluster.ha_vm_default: 'xs:boolean', cluster.ballooning_enabled: 'xs:boolean', cluster.cpu.architecture: 'xs:string', cluster.display.proxy: 'xs:string', cluster.ksm.enabled: 'xs:boolean', cluster.fencing_policy.enabled: 'xs:boolean', cluster.fencing_policy.skip_if_sd_active.enabled: 'xs:boolean', cluster.fencing_policy.skip_if_connectivity_broken.enabled: 'xs:boolean', cluster.fencing_policy.skip_if_connectivity_broken.threshold: 'xs:int', cluster.management_network.id|name: 'xs:string'} @@ -2364,7 +2365,8 @@ cluster.memory_policy.overcommit.percent: 'xs:double', cluster.memory_policy.transparent_hugepages.enabled: 'xs:boolean', cluster.scheduling_policy.policy--DEPRECATED: 'xs:string', cluster.scheduling_policy.thresholds.low--DEPRECATED: 'xs:int', cluster.scheduling_policy.thresholds.high--DEPRECATED: 'xs:int', cluster.scheduling_policy.thresholds.duration--DEPRECATED: 'xs:int', cluster.scheduling_policy.id: 'xs:string', cluster.scheduling_policy.properties.property--COLLECTION: {property.name: 'xs:string', property.value: 'xs:string'}, - cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 'xs:boolean', cluster.tunnel_migration: 'xs:boolean', cluster.trusted_service: 'xs:boolean', cluster.ha_reservation: 'xs:boolean', cluster.ballooning_enabled: 'xs:boolean', + cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 'xs:boolean', cluster.tunnel_migration: 'xs:boolean', cluster.trusted_service: 'xs:boolean', + cluster.ha_reservation: 'xs:boolean', cluster.ha_vm_default: 'xs:boolean', cluster.ballooning_enabled: 'xs:boolean', cluster.cpu.architecture: 'xs:string', cluster.display.proxy: 'xs:string', cluster.ksm.enabled: 'xs:boolean',} description: update specified cluster in the data center urlparams: {} @@ -2381,7 +2383,8 @@ optionalArguments: {cluster.description: 'xs:string', cluster.memory_policy.overcommit.percent: 'xs:double', cluster.memory_policy.transparent_hugepages.enabled: 'xs:boolean', cluster.scheduling_policy.policy--DEPRECATED: 'xs:string', cluster.scheduling_policy.thresholds.low--DEPRECATED: 'xs:int', cluster.scheduling_policy.thresholds.high--DEPRECATED: 'xs:int', cluster.scheduling_policy.thresholds.duration--DEPRECATED: 'xs:int', cluster.scheduling_policy.id: 'xs:string', - cluster.scheduling_policy.properties.property--COLLECTION: {property.name: 'xs:string', property.value: 'xs:string'}, cluster.error_handling.on_error: 'xs:string', + cluster.scheduling_policy.properties.property--COLLECTION: {property.name: 'xs:string', property.value: 'xs:string'}, + cluster.ha_reservation: 'xs:boolean', cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 'xs:boolean', cluster.tunnel_migration: 'xs:boolean', cluster.ballooning_enabled: 'xs:boolean', cluster.cpu.architecture: 'xs:string', cluster.display.proxy: 'xs:string', cluster.ksm.enabled: 'xs:boolean', cluster.management_network.id|name: 'xs:string'} diff --git a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java index 4428f6b..05f8155 100644 --- a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java +++ b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java @@ -93,6 +93,9 @@ if (model.isSetHaReservation()) { entity.setHaReservation(model.isHaReservation()); } + if (model.isSetHaVmDefault()) { + entity.setHaVmDefault(model.isHaVmDefault()); + } if (model.isSetOptionalReason()) { entity.setOptionalReasonRequired(model.isOptionalReason()); } @@ -156,6 +159,7 @@ model.setTunnelMigration(entity.isTunnelMigration()); model.setTrustedService(entity.supportsTrustedService()); model.setHaReservation(entity.supportsHaReservation()); + model.setHaVmDefault(entity.getHaVmDefault()); model.setOptionalReason(entity.isOptionalReasonRequired()); model.setBallooningEnabled(entity.isEnableBallooning()); model.setKsm(new KSM()); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java index b6b0116..f7b8372 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java @@ -142,6 +142,9 @@ " Please consult documentation for your guest operating system to ensure it has proper support for CPU Hot Add") String hotPlugUnplugCpuWarning(); + /*@DefaultMessage("Policy of for new VMs high availability. Applies only to new VMs in this cluster.") + String clusterHighAvailabilityInfo();*/ + @DefaultMessage("Policy of assigning serial numbers to running VMs. Can be Host''s UUID, Vm''s UUID or any custom value.") String serialNumberInfo(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java index aca1c32..8c9e039 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java @@ -322,6 +322,7 @@ obj.setFencingPolicy(new FencingPolicy(instance.getFencingPolicy())); obj.setAutoConverge(instance.getAutoConverge()); obj.setMigrateCompressed(instance.getMigrateCompressed()); + obj.setHaVmDefault(instance.getHaVmDefault()); return obj; } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java index c7a431b..e2bc158 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java @@ -369,6 +369,7 @@ clusterModel.init(true); clusterModel.getEnableTrustedService().setEntity(cluster.supportsTrustedService()); clusterModel.getEnableHaReservation().setEntity(cluster.supportsHaReservation()); + clusterModel.getHaVmDefault().setEntity(cluster.getHaVmDefault()); clusterModel.getEnableOptionalReason().setEntity(cluster.isOptionalReasonRequired()); setWindow(clusterModel); clusterModel.setTitle(ConstantsManager.getInstance().getConstants().editClusterTitle()); @@ -689,6 +690,7 @@ cluster.setGlusterService(model.getEnableGlusterService().getEntity()); cluster.setTrustedService(model.getEnableTrustedService().getEntity()); cluster.setHaReservation(model.getEnableHaReservation().getEntity()); + cluster.setHaVmDefault(model.getHaVmDefault().getEntity()); cluster.setOptionalReasonRequired(model.getEnableOptionalReason().getEntity()); cluster.setClusterPolicyId(model.getClusterPolicy().getSelectedItem().getId()); cluster.setClusterPolicyProperties(KeyValueModel.convertProperties(model.getCustomPropertySheet().serialize())); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java index 79af157..f01358d 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java @@ -714,6 +714,16 @@ this.privateEnableHaReservation = value; } + private EntityModel<Boolean> HaVmDefault; + + public EntityModel<Boolean> getHaVmDefault() { + return HaVmDefault; + } + + public void setHaVmDefault(EntityModel<Boolean> value) { + this.HaVmDefault = value; + } + public EntityModel<Boolean> getEnableTrustedService() { return privateEnableTrustedService; } @@ -848,6 +858,7 @@ setComment(new EntityModel<String>()); setEnableTrustedService(new EntityModel<Boolean>(false)); setEnableHaReservation(new EntityModel<Boolean>(false)); + setHaVmDefault(new EntityModel<Boolean>(false)); setEnableOptionalReason(new EntityModel<Boolean>(false)); setAllowClusterWithVirtGlusterEnabled(true); AsyncDataProvider.getInstance().getAllowClusterWithVirtGlusterEnabled(new AsyncQuery(this, new INewAsyncCallback() { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java index 3071dae..9a847c7 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java @@ -76,6 +76,7 @@ true, false); + //getModel().getIsHighlyAvailable().setEntity(getModel().getSelectedCluster().getHaVmDefault()); initPriority(0); getModel().getVmInitModel().init(null); @@ -188,7 +189,7 @@ updateCpuSharesAvailability(); updateVirtioScsiAvailability(); activateInstanceTypeManager(); - + updateHighAvailability(); } private boolean profilesExist(List<VnicProfileView> profiles) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java index 02c2deb..8989034 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java @@ -1509,6 +1509,7 @@ setIsHighlyAvailable(new NotChangableForVmInPoolEntityModel<Boolean>()); getIsHighlyAvailable().getEntityChangedEvent().addListener(this); + //getIsHighlyAvailable().setEntity(getIsHighlyAvailableValue()); setIsTemplatePublic(new NotChangableForVmInPoolEntityModel<Boolean>()); setKernel_parameters(new NotChangableForVmInPoolEntityModel<String>()); setKernel_path(new NotChangableForVmInPoolEntityModel<String>()); @@ -1758,6 +1759,7 @@ initUsbPolicy(); behavior.updateEmulatedMachines(); behavior.updateCustomCpu(); + behavior.updateHaAvailability(); } else if (sender == getTemplateWithVersion()) { @@ -3084,4 +3086,11 @@ initialsNumaNodeCount = size; getNumaNodeCount().setEntity(size); } + + /*private boolean getIsHighlyAvailableValue() { + if (getIsNew()) { + return getSelectedCluster().getHaVmDefault(); + } + getWidgetModel() + }*/ } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java index 6ffd0dd..80b8a20 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java @@ -788,6 +788,7 @@ model.getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); //$NON-NLS-1$ model.getCommands().add(tempVar2); + } private void editConsole() { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java index e2b6323..230fcac 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java @@ -752,6 +752,13 @@ .compareTo(VmListModel.BALLOON_DEVICE_MIN_VERSION) >= 0; getModel().getMemoryBalloonDeviceEnabled().setIsAvailable(hasMemoryBalloon); } + + protected void updateHighAvailability() { + if (getModel().getSelectedCluster() != null) { + getModel().getIsHighlyAvailable().setEntity(getModel().getSelectedCluster().getHaVmDefault()); + } + } + private boolean isRngDeviceSupported(UnitVmModel model) { Version clusterVersion = clusterVersionOrNull(model); return clusterVersion == null ? false : (Boolean) AsyncDataProvider.getInstance().getConfigValuePreConverted( @@ -883,6 +890,8 @@ if (!automaticMigrationAllowed) { getModel().getIsHighlyAvailable().setChangeProhibitionReason(constants.hostNonMigratable()); getModel().getIsHighlyAvailable().setEntity(false); + } else { + updateHighAvailability(); } getModel().getIsHighlyAvailable().setIsChangable(automaticMigrationAllowed); } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java index c72bec5..4751a50 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java @@ -187,6 +187,9 @@ @DefaultStringValue("Enable HA Reservation") String clusterPolicyEnableHaReservationLabel(); + @DefaultStringValue("Highly Available VMs") + String clusterPolicyHighlyAvailableVMsLabel(); + @DefaultStringValue("Enable to set VM maintenance reason") String clusterPolicyEnableReasonLabel(); @@ -3905,6 +3908,9 @@ @DefaultStringValue("This will skip fencing if the percentage of Cluster Hosts with connectivity issues is greater than or equal to the defined threshold") String skipFencingWhenConnectivityBrokenInfo(); + @DefaultStringValue("Policy of for new VMs high availability. Applies only to new VMs in this cluster.") + String clusterHighAvailabilityInfo(); + @DefaultStringValue("It is suggested to optimise a Volume for virt store if the volume is of replica-3 type") String newVolumeOptimiseForVirtStoreWarning(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java index c4fa5e5..43fb50e 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java @@ -278,6 +278,13 @@ @WithElementId EntityModelCheckBoxEditor enableHaReservationEditor; + @UiField(provided = true) + InfoIcon haVmDefaultInfoIcon; + + @UiField(provided = true) + @Path(value = "haVmDefault.entity") + @WithElementId + EntityModelCheckBoxEditor haVmDefaultCheckBox; @UiField(provided = true) @Path(value = "clusterPolicy.selectedItem") @@ -485,6 +492,7 @@ additionPropsPanelTitle.setText(constants.clusterPolicyAdditionalPropsPanelTitle()); enableTrustedServiceEditor.setLabel(constants.clusterPolicyEnableTrustedServiceLabel()); enableHaReservationEditor.setLabel(constants.clusterPolicyEnableHaReservationLabel()); + haVmDefaultCheckBox.setLabel(constants.clusterPolicyHighlyAvailableVMsLabel()); enableOptionalReasonEditor.setLabel(constants.clusterPolicyEnableReasonLabel()); clusterPolicyEditor.setLabel(constants.clusterPolicySelectPolicyLabel()); @@ -607,6 +615,9 @@ skipFencingIfConnectivityBrokenCheckBox = new EntityModelCheckBoxEditor(Align.RIGHT); skipFencingIfConnectivityBrokenCheckBox.getContentWidgetContainer().setWidth("420px"); //$NON-NLS-1$ + + haVmDefaultCheckBox = new EntityModelCheckBoxEditor(Align.RIGHT); + haVmDefaultCheckBox.getContentWidgetContainer().setWidth("100%"); //$NON-NLS-1$ } private void initInfoIcons(ApplicationResources resources, ApplicationConstants constants, ApplicationTemplates templates) { @@ -633,6 +644,9 @@ skipFencingIfConnectivityBrokenInfo = new InfoIcon( templates.italicFixedWidth("400px", constants.skipFencingWhenConnectivityBrokenInfo()), //$NON-NLS-1$ resources); + + haVmDefaultInfoIcon = new InfoIcon(templates.italicFixedWidth("400px", constants.clusterHighAvailabilityInfo()), //$NON-NLS-1$ + resources); } @Override diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml index ac87edf..f71281c 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml @@ -156,6 +156,12 @@ margin-bottom: 20px; } + .haDefaultInfoIcon { + position: relative; + top: 5px; + left: 5px; + } + </ui:style> <d:SimpleDialogPanel width="800px" height="560px"> @@ -264,6 +270,10 @@ <g:Label ui:field="additionPropsPanelTitle" addStyleNames="{style.panelTitle}" /> <ge:EntityModelCheckBoxEditor ui:field="enableTrustedServiceEditor" /> <ge:EntityModelCheckBoxEditor ui:field="enableHaReservationEditor" /> + <g:HorizontalPanel> + <ge:EntityModelCheckBoxEditor ui:field="haVmDefaultCheckBox" /> + <d:InfoIcon ui:field="haVmDefaultInfoIcon" addStyleNames="{style.haDefaultInfoIcon}" /> + </g:HorizontalPanel> </g:FlowPanel> <vm:SerialNumberPolicyWidget ui:field="serialNumberPolicyEditor" /> <e:ListModelListBoxEditor ui:field="autoConvergeEditor" label="{constants.autoConvergeLabel}" /> diff --git a/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css b/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css index 9e48a00..1afdeec 100644 --- a/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css +++ b/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css @@ -410,6 +410,11 @@ top: 5px; left: 5px; } +.cpv_haVmDefaultInfo_pfly_fix { + position: relative; + top: 5px; + left: 5px; +} .cpv_skipFencingIfSDActiveInfo_line_pfly_fix { position: relative; left: 20px; diff --git a/packaging/dbscripts/upgrade/03_06_0940_add_high_availability_to_vds_groups.sql b/packaging/dbscripts/upgrade/03_06_0940_add_high_availability_to_vds_groups.sql new file mode 100644 index 0000000..0e48c3b --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_0940_add_high_availability_to_vds_groups.sql @@ -0,0 +1 @@ +select fn_db_add_column('vds_groups', 'ha_vm_default', 'BOOLEAN DEFAULT FALSE'); \ No newline at end of file diff --git a/packaging/dbscripts/vds_groups_sp.sql b/packaging/dbscripts/vds_groups_sp.sql index bc796a9..600cc07 100644 --- a/packaging/dbscripts/vds_groups_sp.sql +++ b/packaging/dbscripts/vds_groups_sp.sql @@ -42,7 +42,8 @@ v_hosts_with_broken_connectivity_threshold SMALLINT, v_fencing_enabled BOOLEAN, v_is_auto_converge BOOLEAN, - v_is_migrate_compressed BOOLEAN + v_is_migrate_compressed BOOLEAN, + v_ha_vm_default BOOLEAN ) RETURNS VOID AS $procedure$ @@ -50,11 +51,11 @@ INSERT INTO vds_groups(vds_group_id,description, name, free_text_comment, cpu_name, storage_pool_id, max_vds_memory_over_commit, count_threads_as_cores, compatibility_version, transparent_hugepages, migrate_on_error, virt_service, gluster_service, tunnel_migration, emulated_machine, detect_emulated_machine, trusted_service, ha_reservation, optional_reason, cluster_policy_id, cluster_policy_custom_properties, enable_balloon, architecture, optimization_type, spice_proxy, enable_ksm, serial_number_policy, custom_serial_number, required_rng_sources, skip_fencing_if_sd_active, skip_fencing_if_connectivity_broken, hosts_with_broken_connectivity_threshold, fencing_enabled, - is_auto_converge, is_migrate_compressed) + is_auto_converge, is_migrate_compressed, ha_vm_default) VALUES(v_vds_group_id,v_description, v_name, v_free_text_comment, v_cpu_name, v_storage_pool_id, v_max_vds_memory_over_commit, v_count_threads_as_cores, v_compatibility_version, v_transparent_hugepages, v_migrate_on_error, v_virt_service, v_gluster_service, v_tunnel_migration, v_emulated_machine, v_detect_emulated_machine, v_trusted_service, v_ha_reservation, v_optional_reason, v_cluster_policy_id, v_cluster_policy_custom_properties, v_enable_balloon, v_architecture, v_optimization_type, v_spice_proxy, v_enable_ksm, v_serial_number_policy, v_custom_serial_number, v_required_rng_sources, v_skip_fencing_if_sd_active, v_skip_fencing_if_connectivity_broken, v_hosts_with_broken_connectivity_threshold, v_fencing_enabled, - v_is_auto_converge, v_is_migrate_compressed); + v_is_auto_converge, v_is_migrate_compressed, v_ha_vm_default); END; $procedure$ LANGUAGE plpgsql; @@ -96,7 +97,8 @@ v_hosts_with_broken_connectivity_threshold SMALLINT, v_fencing_enabled BOOLEAN, v_is_auto_converge BOOLEAN, - v_is_migrate_compressed BOOLEAN + v_is_migrate_compressed BOOLEAN, + v_ha_vm_default BOOLEAN ) RETURNS VOID @@ -121,7 +123,8 @@ hosts_with_broken_connectivity_threshold = v_hosts_with_broken_connectivity_threshold, fencing_enabled = v_fencing_enabled, is_auto_converge = v_is_auto_converge, - is_migrate_compressed = v_is_migrate_compressed + is_migrate_compressed = v_is_migrate_compressed, + ha_vm_default = v_ha_vm_default WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; -- To view, visit https://gerrit.ovirt.org/38571 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5fff12f6f3bcba41089dbe3c57b89c6a173399f9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vered Volansky <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
