Martin Sivák has uploaded a new change for review.

Change subject: [WIP] core,engine,webadmin: Automatic power management of hosts
......................................................................

[WIP] core,engine,webadmin: Automatic power management of hosts

Longer description using lines' length under 72 chars.

With multiple paragraphs if necessary.

Change-Id: Icdea8bdef15556be1591ffb7554f79238f865ec8
Bug-Url:
Signed-off-by: Martin Sivak <msi...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.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/ClusterGuideModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.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/host/HostPopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.ui.xml
M packaging/dbscripts/create_views.sql
A packaging/dbscripts/upgrade/03_04_0230_add_vds_pm_flags.sql
M packaging/dbscripts/vds_sp.sql
16 files changed, 112 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/22376/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java
index d6e5cae..b4930d5 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java
@@ -115,6 +115,10 @@
 
         boolean initSucceeded = true;
 
+        /* Host is UP, clear the policy controlled power management flag */
+        getVds().setPowerManagementControlledByPolicy(false);
+        
DbFacade.getInstance().getVdsDynamicDao().update(getVds().getDynamicData());
+
         if (vdsGroup.supportsTrustedService()) {
             initSucceeded = initTrustedService();
         }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
index 7f7be68..f13420d 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
@@ -175,6 +175,8 @@
         vds.setGlusterVersion(getGlusterVersion());
         vds.setHooksStr(getHooksStr());
         vds.setActiveNic(getActiveNic());
+        
vds.setPowerManagementControlledByPolicy(isPowerManagementControlledByPolicy());
+        vds.setDisablePowerManagementPolicy(isDisablePowerManagementPolicy());
 
         return vds;
     }
@@ -1289,4 +1291,20 @@
     public String getSupportedEmulatedMachines() {
         return mVdsDynamic.getSupportedEmulatedMachines();
     }
+
+    public boolean isPowerManagementControlledByPolicy() {
+        return mVdsDynamic.isPowerManagementControlledByPolicy();
+    }
+
+    public void setPowerManagementControlledByPolicy(boolean 
powerManagementControlledByPolicy) {
+        
mVdsDynamic.setPowerManagementControlledByPolicy(powerManagementControlledByPolicy);
+    }
+
+    public boolean isDisablePowerManagementPolicy() {
+        return mVdsDynamic.isDisablePowerManagementPolicy();
+    }
+
+    public void setDisablePowerManagementPolicy(boolean 
disablePowerManagementPolicy) {
+        
mVdsDynamic.setDisablePowerManagementPolicy(disablePowerManagementPolicy);
+    }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
index 8c36f2a..7d9311f 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
@@ -131,6 +131,19 @@
     private java.util.HashSet<Version> _supportedENGINESVersionsSet;
 
     /**
+     * This flag is set to true when the host was shut down
+     * or went into maintenance as a result of automatic
+     * power management policy.
+     */
+    private boolean powerManagementControlledByPolicy;
+
+    /**
+     * When this flag is true, the automatic power management
+     * is not allowed to touch this host.
+     */
+    private boolean disablePowerManagementPolicy;
+
+    /**
      * comma separated list of emulated machines the host supports
      */
     private String supportedEmulatedMachines;
@@ -167,6 +180,8 @@
         vm_count = 0;
         vms_cores_count = 0;
         guest_overhead = 0;
+        disablePowerManagementPolicy = false;
+        powerManagementControlledByPolicy = false;
     }
 
     public Integer getcpu_cores() {
@@ -573,6 +588,22 @@
         this.nonOperationalReason = (nonOperationalReason == null ? 
NonOperationalReason.NONE : nonOperationalReason);
     }
 
+    public boolean isPowerManagementControlledByPolicy() {
+        return powerManagementControlledByPolicy;
+    }
+
+    public void setPowerManagementControlledByPolicy(boolean 
powerManagementControlledByPolicy) {
+        this.powerManagementControlledByPolicy = 
powerManagementControlledByPolicy;
+    }
+
+    public boolean isDisablePowerManagementPolicy() {
+        return disablePowerManagementPolicy;
+    }
+
+    public void setDisablePowerManagementPolicy(boolean 
disablePowerManagementPolicy) {
+        this.disablePowerManagementPolicy = disablePowerManagementPolicy;
+    }
+
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -626,6 +657,9 @@
         result = prime * result + ((hwUUID == null) ? 0 : hwUUID.hashCode());
         result = prime * result + ((hwFamily == null) ? 0 : 
hwFamily.hashCode());
         result = prime * result + ((HBAs == null) ? 0 : HBAs.hashCode());
+        result = prime * result + (powerManagementControlledByPolicy ? 0 : 1);
+        result = prime * result + (disablePowerManagementPolicy ? 0 : 1);
+
         return result;
     }
 
@@ -690,7 +724,9 @@
                 && ObjectUtils.objectsEqual(hwUUID, other.hwUUID)
                 && ObjectUtils.objectsEqual(hwFamily, other.hwFamily)
                 && ObjectUtils.objectsEqual(HBAs, other.HBAs)
-                && ObjectUtils.objectsEqual(supportedEmulatedMachines, 
other.supportedEmulatedMachines));
+                && ObjectUtils.objectsEqual(supportedEmulatedMachines, 
other.supportedEmulatedMachines))
+                && ObjectUtils.objectsEqual(powerManagementControlledByPolicy, 
other.powerManagementControlledByPolicy)
+                && ObjectUtils.objectsEqual(disablePowerManagementPolicy, 
other.disablePowerManagementPolicy);
     }
 
 }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
index 1f26158..4c66558 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
@@ -339,6 +339,8 @@
             entity.setConsoleAddress(rs.getString("console_address"));
             
entity.setSupportedEmulatedMachines(rs.getString("supported_emulated_machines"));
             entity.setHighlyAvailableScore(rs.getInt("ha_score"));
+            
entity.setDisablePowerManagementPolicy(rs.getBoolean("disable_auto_pm"));
+            
entity.setPowerManagementControlledByPolicy(rs.getBoolean("controlled_by_pm_policy"));
             entity.calculateFreeVirtualMemory();
             return entity;
         }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
index 171ab20..4103d95 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
@@ -88,6 +88,9 @@
             entity.setHardwareUUID(rs.getString("hw_uuid"));
             entity.setHardwareFamily(rs.getString("hw_family"));
             entity.setHBAs(new 
JsonObjectDeserializer().deserialize(rs.getString("hbas"), HashMap.class));
+            
entity.setDisablePowerManagementPolicy(rs.getBoolean("disable_auto_pm"));
+            
entity.setPowerManagementControlledByPolicy(rs.getBoolean("controlled_by_pm_policy"));
+
             return entity;
         }
     }
@@ -154,7 +157,9 @@
                 .addValue("hw_uuid", vds.getHardwareUUID())
                 .addValue("hw_family", vds.getHardwareFamily())
                 .addValue("hbas", new 
JsonObjectSerializer().serialize(vds.getHBAs()))
-                .addValue("supported_emulated_machines", 
vds.getSupportedEmulatedMachines());
+                .addValue("supported_emulated_machines", 
vds.getSupportedEmulatedMachines())
+                .addValue("disable_auto_pm", 
vds.isDisablePowerManagementPolicy())
+                .addValue("controlled_by_pm_policy", 
vds.isPowerManagementControlledByPolicy());
 
         getCallsHandler().executeModification("InsertVdsDynamic", 
parameterSource);
     }
@@ -213,7 +218,9 @@
                 .addValue("hw_uuid", vds.getHardwareUUID())
                 .addValue("hw_family", vds.getHardwareFamily())
                 .addValue("hbas", new 
JsonObjectSerializer().serialize(vds.getHBAs()))
-                .addValue("supported_emulated_machines", 
vds.getSupportedEmulatedMachines());
+                .addValue("supported_emulated_machines", 
vds.getSupportedEmulatedMachines())
+                .addValue("disable_auto_pm", 
vds.isDisablePowerManagementPolicy())
+                .addValue("controlled_by_pm_policy", 
vds.isPowerManagementControlledByPolicy());
 
         getCallsHandler().executeModification("UpdateVdsDynamic", 
parameterSource);
     }
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 6e1a1e8..1cb804c 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
@@ -241,6 +241,7 @@
 
         obj.setpm_enabled(instance.getpm_enabled());
         obj.setPmSecondaryConcurrent(instance.isPmSecondaryConcurrent());
+        
obj.setDisablePowerManagementPolicy(instance.isDisablePowerManagementPolicy());
 
         obj.setPort(instance.getPort());
         obj.setServerSslEnabled(instance.isServerSslEnabled());
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
index 0d48713..3ee8d72 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
@@ -490,7 +490,7 @@
         // Save other PM parameters.
         host.setpm_enabled((Boolean) model.getIsPm().getEntity());
         host.setPmSecondaryConcurrent((Boolean) 
model.getPmSecondaryConcurrent().getEntity());
-
+        host.setDisablePowerManagementPolicy((Boolean) 
model.getDisableAutomaticPowerManagement().getEntity());
 
         AddVdsActionParameters vdsActionParams = new AddVdsActionParameters();
         vdsActionParams.setvds(host);
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
index 4798f2b..8b8db96 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
@@ -1630,7 +1630,7 @@
         // Save other PM parameters.
         host.setpm_enabled((Boolean) model.getIsPm().getEntity());
         host.setPmSecondaryConcurrent((Boolean) 
model.getPmSecondaryConcurrent().getEntity());
-
+        host.setDisablePowerManagementPolicy((Boolean) 
model.getDisableAutomaticPowerManagement().getEntity());
 
         AddVdsActionParameters addVdsParams = new AddVdsActionParameters();
         addVdsParams.setVdsId(host.getId());
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
index 4500a5f..53b8c35 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
@@ -893,7 +893,7 @@
         // Save other PM parameters.
         host.setpm_enabled((Boolean) model.getIsPm().getEntity());
         host.setPmSecondaryConcurrent((Boolean) 
model.getPmSecondaryConcurrent().getEntity());
-
+        host.setDisablePowerManagementPolicy((Boolean) 
model.getDisableAutomaticPowerManagement().getEntity());
 
         cancelConfirm();
         model.startProgress(null);
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
index 429269d..54bb14d 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
@@ -562,6 +562,15 @@
         pmVariants = value;
     }
 
+    private EntityModel disableAutomaticPowerManagement;
+
+    public EntityModel getDisableAutomaticPowerManagement() {
+        return disableAutomaticPowerManagement;
+    }
+
+    private void setDisableAutomaticPowerManagement(EntityModel value) {
+        disableAutomaticPowerManagement = value;
+    }
 
     private boolean isGeneralTabValid;
 
@@ -925,6 +934,8 @@
         // Initialize other PM fields.
         setPmSecondaryConcurrent(new EntityModel());
         getPmSecondaryConcurrent().setEntity(false);
+        setDisableAutomaticPowerManagement(new EntityModel());
+        getDisableAutomaticPowerManagement().setEntity(false);
 
         setPmVariants(new ListModel());
         List<String> pmVariants = new ArrayList<String>();
@@ -1635,6 +1646,7 @@
         }
 
         getPmSecondaryConcurrent().setEntity(vds.isPmSecondaryConcurrent());
+        
getDisableAutomaticPowerManagement().setEntity(vds.isDisablePowerManagementPolicy());
 
         updateModelDataCenterFromVds(dataCenters, vds);
 
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 2e64161..ab8f11d 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
@@ -509,6 +509,9 @@
     @DefaultStringValue("Secure")
     String hostPopupPmSecureLabel();
 
+    @DefaultStringValue("Disable automatic power management")
+    String hostPopupPmDisableAutoPM();
+
     @DefaultStringValue("Test")
     String hostPopupTestButtonLabel();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.java
index 86e508f..d35a144 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.java
@@ -286,6 +286,11 @@
     EntityModelCheckBoxEditor pmSecondarySecureEditor;
 
     @UiField
+    @Path(value = "disableAutomaticPowerManagement.entity")
+    @WithElementId("disableAutomaticPowerManagementEditor")
+    EntityModelCheckBoxEditor disableAutomaticPowerManagementEditor;
+
+    @UiField
     UiCommandButton testButton;
 
     @UiField
@@ -561,6 +566,9 @@
         consoleAddress.setLabel(constants.consoleAddress());
         consoleAddressLabel.setText(constants.enableConsoleAddressOverride());
 
+        // Auto PM
+        
disableAutomaticPowerManagementEditor.setLabel(constants.hostPopupPmDisableAutoPM());
+
         // SPM tab
         spmTab.setLabel(constants.spmTestButtonLabel());
         consoleTab.setLabel(constants.consoleButtonLabel());
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.ui.xml
index 80e261f..aca74bd 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostPopupView.ui.xml
@@ -320,6 +320,7 @@
                                         <g:Label ui:field="testMessage" 
addStyleNames="{style.testMessage}"/>
                                     </g:HTMLPanel>
                                 </g:FlowPanel>
+                                <e:EntityModelCheckBoxEditor 
ui:field="disableAutomaticPowerManagementEditor"/>
                             </g:FlowPanel>
                         </t:content>
                     </t:DialogTab>
diff --git a/packaging/dbscripts/create_views.sql 
b/packaging/dbscripts/create_views.sql
index ebcc883..47903c7 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -702,7 +702,8 @@
                       vds_dynamic.transparent_hugepages_state as 
transparent_hugepages_state, vds_dynamic.anonymous_hugepages as 
anonymous_hugepages, vds_dynamic.non_operational_reason as 
non_operational_reason,
                        vds_static.recoverable as recoverable, 
vds_static.sshKeyFingerprint as sshKeyFingerprint, vds_dynamic.hw_manufacturer 
as hw_manufacturer, vds_dynamic.hw_product_name as hw_product_name, 
vds_dynamic.hw_version as hw_version,
                       vds_dynamic.hw_serial_number as hw_serial_number, 
vds_dynamic.hw_uuid as hw_uuid, vds_dynamic.hw_family as hw_family, 
vds_static.console_address as console_address,
-                      vds_dynamic.hbas as hbas, 
vds_dynamic.supported_emulated_machines as supported_emulated_machines, 
vds_static.ssh_port as ssh_port, vds_static.ssh_username as ssh_username, 
vds_statistics.ha_score as ha_score
+                      vds_dynamic.hbas as hbas, 
vds_dynamic.supported_emulated_machines as supported_emulated_machines, 
vds_static.ssh_port as ssh_port, vds_static.ssh_username as ssh_username, 
vds_statistics.ha_score as ha_score,
+                      vds_dynamic.disable_auto_pm as disable_auto_pm, 
vds_dynamic.controlled_by_pm_policy as controlled_by_pm_policy
 FROM         vds_groups INNER JOIN
 vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id INNER JOIN
 vds_dynamic ON vds_static.vds_id = vds_dynamic.vds_id INNER JOIN
diff --git a/packaging/dbscripts/upgrade/03_04_0230_add_vds_pm_flags.sql 
b/packaging/dbscripts/upgrade/03_04_0230_add_vds_pm_flags.sql
new file mode 100644
index 0000000..9f7b442
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_04_0230_add_vds_pm_flags.sql
@@ -0,0 +1,2 @@
+select fn_db_add_column('vds_dynamic', 'disable_auto_pm', 'smallint default 
0');
+select fn_db_add_column('vds_dynamic', 'controlled_by_pm_policy', 'smallint 
default 0');
diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql
index e8ebdcc..9e4362d 100644
--- a/packaging/dbscripts/vds_sp.sql
+++ b/packaging/dbscripts/vds_sp.sql
@@ -185,14 +185,16 @@
  v_hw_uuid VARCHAR(255),
  v_hw_family VARCHAR(255),
  v_hbas VARCHAR(255),
- v_supported_emulated_machines VARCHAR(255))
+ v_supported_emulated_machines VARCHAR(255),
+ v_disable_auto_pm INTEGER,
+ v_controlled_by_pm_policy INTEGER)
 RETURNS VOID
    AS $procedure$
 BEGIN
 
    BEGIN
-INSERT INTO vds_dynamic(cpu_cores, cpu_threads, cpu_model, cpu_speed_mh, 
if_total_speed, kvm_enabled, mem_commited, physical_mem_mb,   status, vds_id, 
vm_active, vm_count, vm_migrating, reserved_mem, guest_overhead, rpm_version, 
software_version, version_name, build_name, previous_status, cpu_flags, 
cpu_over_commit_time_stamp, vms_cores_count, pending_vcpus_count, 
pending_vmem_size, cpu_sockets,net_config_dirty, supported_cluster_levels, 
supported_engines, host_os, kvm_version, libvirt_version, spice_version, 
gluster_version, kernel_version, iscsi_initiator_name, 
transparent_hugepages_state, anonymous_hugepages,hooks, hw_manufacturer, 
hw_product_name, hw_version, hw_serial_number, hw_uuid, hw_family, hbas, 
supported_emulated_machines)
-       VALUES(v_cpu_cores,     v_cpu_threads, v_cpu_model,     v_cpu_speed_mh, 
v_if_total_speed, v_kvm_enabled, v_mem_commited, v_physical_mem_mb,     
v_status, v_vds_id, v_vm_active, v_vm_count, v_vm_migrating,    v_reserved_mem, 
v_guest_overhead, v_rpm_version, v_software_version, v_version_name, 
v_build_name, v_previous_status, v_cpu_flags, v_cpu_over_commit_time_stamp, 
v_vms_cores_count,v_pending_vcpus_count, v_pending_vmem_size, v_cpu_sockets, 
v_net_config_dirty, v_supported_cluster_levels, v_supported_engines, v_host_os, 
v_kvm_version, v_libvirt_version, v_spice_version, v_gluster_version, 
v_kernel_version, v_iscsi_initiator_name, v_transparent_hugepages_state, 
v_anonymous_hugepages,v_hooks, v_hw_manufacturer, v_hw_product_name, 
v_hw_version, v_hw_serial_number, v_hw_uuid, v_hw_family, v_hbas, 
v_supported_emulated_machines);
+INSERT INTO vds_dynamic(cpu_cores, cpu_threads, cpu_model, cpu_speed_mh, 
if_total_speed, kvm_enabled, mem_commited, physical_mem_mb,   status, vds_id, 
vm_active, vm_count, vm_migrating, reserved_mem, guest_overhead, rpm_version, 
software_version, version_name, build_name, previous_status, cpu_flags, 
cpu_over_commit_time_stamp, vms_cores_count, pending_vcpus_count, 
pending_vmem_size, cpu_sockets,net_config_dirty, supported_cluster_levels, 
supported_engines, host_os, kvm_version, libvirt_version, spice_version, 
gluster_version, kernel_version, iscsi_initiator_name, 
transparent_hugepages_state, anonymous_hugepages,hooks, hw_manufacturer, 
hw_product_name, hw_version, hw_serial_number, hw_uuid, hw_family, hbas, 
supported_emulated_machines, disable_auto_pm, controlled_by_pm_policy)
+       VALUES(v_cpu_cores,     v_cpu_threads, v_cpu_model,     v_cpu_speed_mh, 
v_if_total_speed, v_kvm_enabled, v_mem_commited, v_physical_mem_mb,     
v_status, v_vds_id, v_vm_active, v_vm_count, v_vm_migrating,    v_reserved_mem, 
v_guest_overhead, v_rpm_version, v_software_version, v_version_name, 
v_build_name, v_previous_status, v_cpu_flags, v_cpu_over_commit_time_stamp, 
v_vms_cores_count,v_pending_vcpus_count, v_pending_vmem_size, v_cpu_sockets, 
v_net_config_dirty, v_supported_cluster_levels, v_supported_engines, v_host_os, 
v_kvm_version, v_libvirt_version, v_spice_version, v_gluster_version, 
v_kernel_version, v_iscsi_initiator_name, v_transparent_hugepages_state, 
v_anonymous_hugepages,v_hooks, v_hw_manufacturer, v_hw_product_name, 
v_hw_version, v_hw_serial_number, v_hw_uuid, v_hw_family, v_hbas, 
v_supported_emulated_machines, v_disable_auto_pm, v_controlled_by_pm_policy);
    END;
 
    RETURN;
@@ -250,7 +252,9 @@
  v_hw_uuid VARCHAR(255),
  v_hw_family VARCHAR(255),
  v_hbas VARCHAR(255),
- v_supported_emulated_machines VARCHAR(255))
+ v_supported_emulated_machines VARCHAR(255),
+ v_disable_auto_pm INTEGER,
+ v_controlled_by_pm_policy INTEGER)
 RETURNS VOID
 
        --The [vds_dynamic] table doesn't have a timestamp column. Optimistic 
concurrency logic cannot be generated
@@ -281,7 +285,8 @@
       _update_date = LOCALTIMESTAMP,non_operational_reason = 
v_non_operational_reason,
       hw_manufacturer = v_hw_manufacturer, hw_product_name = v_hw_product_name,
       hw_version = v_hw_version, hw_serial_number = v_hw_serial_number,
-      hw_uuid = v_hw_uuid, hw_family = v_hw_family, hbas = v_hbas, 
supported_emulated_machines = v_supported_emulated_machines
+      hw_uuid = v_hw_uuid, hw_family = v_hw_family, hbas = v_hbas, 
supported_emulated_machines = v_supported_emulated_machines,
+      disable_auto_pm = v_disable_auto_pm, controlled_by_pm_policy = 
v_controlled_by_pm_policy
       WHERE vds_id = v_vds_id;
    END;
 


-- 
To view, visit http://gerrit.ovirt.org/22376
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icdea8bdef15556be1591ffb7554f79238f865ec8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msi...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to