Gilad Chaplik has posted comments on this change. Change subject: core,engine,webadmin: Automatic power management of hosts ......................................................................
Patch Set 6: (19 comments) .................................................... Commit Message Line 9: Add bll and UI support for policy based power management Line 10: of hosts. Line 11: Line 12: VdsStatic contains a new flag that can disable the automatic Line 13: mechanisms. There is a new chackbox in the Host/Power management /s/chackbox/checkbox Line 14: subtab to control this. Line 15: Line 16: VdsDynamic contains a new flag that is used to distinguish Line 17: between hosts that were put to maintenance/down automatically Line 14: subtab to control this. Line 15: Line 16: VdsDynamic contains a new flag that is used to distinguish Line 17: between hosts that were put to maintenance/down automatically Line 18: and those that were put there by user. pls provide link to feature page Line 19: Line 20: Change-Id: Icdea8bdef15556be1591ffb7554f79238f865ec8 Line 21: Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1035238 .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java Line 119: boolean initSucceeded = true; Line 120: Line 121: /* Host is UP, re-set the policy controlled power management flag */ Line 122: getVds().setPowerManagementControlledByPolicy(true); Line 123: DbFacade.getInstance().getVdsDynamicDao().update(getVds().getDynamicData()); 1) updating VdsDynamic can be very risky - since it contains host status and can lead to races. I'd prefer updating only the specific field. 2) why we need to update if the feature is disabled? Line 124: Line 125: if (vdsGroup.supportsTrustedService()) { Line 126: initSucceeded = initTrustedService(); Line 127: } .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java Line 1305: } Line 1306: Line 1307: public void setDisablePowerManagementPolicy(boolean disablePowerManagementPolicy) { Line 1308: mVdsStatic.setDisablePowerManagementPolicy(disablePowerManagementPolicy); Line 1309: } not so sure about the naming, I'm a bit confused, both sound the same.. .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java Line 129: private java.util.HashSet<Version> _supportedENGINESVersionsSet; Line 130: Line 131: /** Line 132: * This flag is set to true if the host PM can be controlled Line 133: * by policy. If an user triggered action puts the host /s/an user/a user Line 134: * to maintenance or shuts it down, this flag is cleared. Line 135: * Line 136: * The flag should be re-set only by transitioning the host Line 137: * back to Up state. Line 177: transparentHugePagesState = VdsTransparentHugePagesState.Never; Line 178: vm_count = 0; Line 179: vms_cores_count = 0; Line 180: guest_overhead = 0; Line 181: powerManagementControlledByPolicy = false; its false by default, can be removed. Line 182: } Line 183: Line 184: public Integer getcpu_cores() { Line 185: return this.cpu_cores; Line 702: && ObjectUtils.objectsEqual(hwUUID, other.hwUUID) Line 703: && ObjectUtils.objectsEqual(hwFamily, other.hwFamily) Line 704: && ObjectUtils.objectsEqual(HBAs, other.HBAs) Line 705: && ObjectUtils.objectsEqual(supportedEmulatedMachines, other.supportedEmulatedMachines)) Line 706: && ObjectUtils.objectsEqual(powerManagementControlledByPolicy, other.powerManagementControlledByPolicy); use == opertor to compare natives Line 707: } Line 708: .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java Line 183: name = ""; Line 184: comment = ""; Line 185: vdsType = VDSType.VDS; Line 186: autoRecoverable = true; Line 187: disablePowerManagementPolicy = false; same Line 188: } Line 189: Line 190: public VdsStatic(String host_name, String ip, String uniqueId, int port, int ssh_port, String ssh_username, Guid vds_group_id, Guid vds_id, Line 191: String vds_name, boolean server_SSL_enabled, VDSType vds_type) { Line 616: && ObjectUtils.objectsEqual(vdsGroupId, other.vdsGroupId) Line 617: && ObjectUtils.objectsEqual(vdsStrength, other.vdsStrength) Line 618: && vdsType == other.vdsType Line 619: && ObjectUtils.objectsEqual(sshKeyFingerprint, other.sshKeyFingerprint)) Line 620: && ObjectUtils.objectsEqual(disablePowerManagementPolicy, other.disablePowerManagementPolicy); same Line 621: } .................................................... File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java Line 489: host.setPmSecondaryOptionsMap(model.getPmSecondaryOptionsMap()); Line 490: // Save other PM parameters. Line 491: host.setpm_enabled((Boolean) model.getIsPm().getEntity()); Line 492: host.setPmSecondaryConcurrent((Boolean) model.getPmSecondaryConcurrent().getEntity()); Line 493: host.setDisablePowerManagementPolicy((Boolean) model.getDisableAutomaticPowerManagement().getEntity()); no need to cast. set EntityModel generic type to Boolean Line 494: Line 495: AddVdsActionParameters vdsActionParams = new AddVdsActionParameters(); Line 496: vdsActionParams.setvds(host); Line 497: vdsActionParams.setVdsId(host.getId()); .................................................... File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java Line 1629: Line 1630: // Save other PM parameters. Line 1631: host.setpm_enabled((Boolean) model.getIsPm().getEntity()); Line 1632: host.setPmSecondaryConcurrent((Boolean) model.getPmSecondaryConcurrent().getEntity()); Line 1633: host.setDisablePowerManagementPolicy((Boolean) model.getDisableAutomaticPowerManagement().getEntity()); same. Line 1634: Line 1635: AddVdsActionParameters addVdsParams = new AddVdsActionParameters(); Line 1636: addVdsParams.setVdsId(host.getId()); Line 1637: addVdsParams.setvds(host); .................................................... File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java Line 892: Line 893: // Save other PM parameters. Line 894: host.setpm_enabled((Boolean) model.getIsPm().getEntity()); Line 895: host.setPmSecondaryConcurrent((Boolean) model.getPmSecondaryConcurrent().getEntity()); Line 896: host.setDisablePowerManagementPolicy((Boolean) model.getDisableAutomaticPowerManagement().getEntity()); same Line 897: Line 898: cancelConfirm(); Line 899: model.startProgress(null); Line 900: .................................................... File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java Line 933: Line 934: // Initialize other PM fields. Line 935: setPmSecondaryConcurrent(new EntityModel()); Line 936: getPmSecondaryConcurrent().setEntity(false); Line 937: setDisableAutomaticPowerManagement(new EntityModel()); set EntityModel generic type with boolean Line 938: getDisableAutomaticPowerManagement().setEntity(false); Line 939: Line 940: setPmVariants(new ListModel()); Line 941: List<String> pmVariants = new ArrayList<String>(); .................................................... File frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.java Line 287: Line 288: @UiField Line 289: @Path(value = "disableAutomaticPowerManagement.entity") Line 290: @WithElementId("disableAutomaticPowerManagementEditor") Line 291: EntityModelCheckBoxEditor disableAutomaticPowerManagementEditor; EntityModelCheckBoxEditor is deprecated. use the class from generics. Line 292: Line 293: @UiField Line 294: UiCommandButton testButton; Line 295: .................................................... File frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.ui.xml Line 319: </div> Line 320: <g:Label ui:field="testMessage" addStyleNames="{style.testMessage}"/> Line 321: </g:HTMLPanel> Line 322: </g:FlowPanel> Line 323: <e:EntityModelCheckBoxEditor ui:field="disableAutomaticPowerManagementEditor"/> notice that if you need another namespace for the generic.EntityModelCheckBoxEditor Line 324: </g:FlowPanel> Line 325: </t:content> Line 326: </t:DialogTab> Line 327: </t:tab> .................................................... File packaging/dbscripts/upgrade/03_04_0340_add_vds_pm_flags.sql Line 1: select fn_db_add_column('vds_static', 'disable_auto_pm', 'smallint default 0'); why not defining it as boolean? Line 2: select fn_db_add_column('vds_dynamic', 'controlled_by_pm_policy', 'smallint default 0'); Line 3: -- Enable automatic PM on all hosts in Up state Line 1: select fn_db_add_column('vds_static', 'disable_auto_pm', 'smallint default 0'); Line 2: select fn_db_add_column('vds_dynamic', 'controlled_by_pm_policy', 'smallint default 0'); same Line 3: -- Enable automatic PM on all hosts in Up state Line 1: select fn_db_add_column('vds_static', 'disable_auto_pm', 'smallint default 0'); Line 2: select fn_db_add_column('vds_dynamic', 'controlled_by_pm_policy', 'smallint default 0'); Line 3: -- Enable automatic PM on all hosts in Up state Line 4: UPDATE vds_dynamic set controlled_by_pm_policy=1 WHERE status=3; /s/=1/= true .................................................... File packaging/dbscripts/vds_sp.sql Line 187: v_hw_uuid VARCHAR(255), Line 188: v_hw_family VARCHAR(255), Line 189: v_hbas VARCHAR(255), Line 190: v_supported_emulated_machines VARCHAR(255), Line 191: v_controlled_by_pm_policy INTEGER) Boolean Line 192: RETURNS VOID Line 193: AS $procedure$ Line 194: BEGIN Line 195: -- To view, visit http://gerrit.ovirt.org/22376 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icdea8bdef15556be1591ffb7554f79238f865ec8 Gerrit-PatchSet: 6 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Sivák <[email protected]> Gerrit-Reviewer: Doron Fediuck <[email protected]> Gerrit-Reviewer: Eli Mesika <[email protected]> Gerrit-Reviewer: Gilad Chaplik <[email protected]> Gerrit-Reviewer: Martin Sivák <[email protected]> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
