Martin Peřina has uploaded a new change for review.

Change subject: core: Add host kdump status to VdsDynamic
......................................................................

core: Add host kdump status to VdsDynamic

Adds host kdump configuration status to VdsDynamic.

Change-Id: I3284c8b9d99b2cabda51558aac92ed0f37262537
Bug-Url: https://bugzilla.redhat.com/1079821
Signed-off-by: Martin Perina <[email protected]>
---
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/KdumpStatus.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 backend/manager/modules/dal/src/test/resources/fixtures.xml
M 
frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
M packaging/dbscripts/create_views.sql
A packaging/dbscripts/upgrade/03_05_0160_add_host_kdump_status.sql
M packaging/dbscripts/vds_sp.sql
10 files changed, 92 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/26146/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/KdumpStatus.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/KdumpStatus.java
new file mode 100644
index 0000000..798867e
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/KdumpStatus.java
@@ -0,0 +1,43 @@
+package org.ovirt.engine.core.common.businessentities;
+
+/**
+ * Status of kdump configuration
+ */
+public enum KdumpStatus {
+    UNKNOWN(-1),
+    DISABLED(0),
+    ENABLED(1);
+
+    /**
+     * External numeric representation
+     */
+    private int value;
+
+    private KdumpStatus(int value) {
+        this.value = value;
+    }
+
+    public int getAsNumber() {
+        return value;
+    }
+
+    /**
+     * Converts numeric representation to enum value.
+     *
+     * @param value
+     *            numeric representation
+     * @return enum value ({@code null} or undefined numeric representation 
are converted to {@code UNKNOWN}
+     */
+    public static KdumpStatus valueOfNumber(Integer value) {
+        KdumpStatus result = UNKNOWN;
+        if (value != null) {
+            for (KdumpStatus s : KdumpStatus.values()) {
+                if (s.getAsNumber() == value) {
+                    result = s;
+                    break;
+                }
+            }
+        }
+        return result;
+    }
+}
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 7f976c7..6ff33c8 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
@@ -1313,4 +1313,12 @@
     public void setDisablePowerManagementPolicy(boolean 
disablePowerManagementPolicy) {
         
mVdsStatic.setDisablePowerManagementPolicy(disablePowerManagementPolicy);
     }
+
+    public KdumpStatus getKdumpStatus() {
+        return mVdsDynamic.getKdumpStatus();
+    }
+
+    public void setKdumpStatus(KdumpStatus kdumpStatus) {
+        mVdsDynamic.setKdumpStatus(kdumpStatus);
+    }
 }
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 b3fcc25..f4d67b1 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
@@ -85,6 +85,8 @@
 
     private String iScsiInitiatorName;
 
+    private KdumpStatus kdumpStatus;
+
     private VdsTransparentHugePagesState transparentHugePagesState;
 
     @Size(max = BusinessEntitiesDefinitions.GENERAL_NAME_SIZE)
@@ -179,6 +181,7 @@
         vms_cores_count = 0;
         guest_overhead = 0;
         powerManagementControlledByPolicy = false;
+        kdumpStatus = KdumpStatus.UNKNOWN;
     }
 
     public Integer getcpu_cores() {
@@ -585,6 +588,14 @@
         this.powerManagementControlledByPolicy = 
powerManagementControlledByPolicy;
     }
 
+    public KdumpStatus getKdumpStatus() {
+        return kdumpStatus;
+    }
+
+    public void setKdumpStatus(KdumpStatus kdumpStatus) {
+        this.kdumpStatus = kdumpStatus;
+    }
+
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -638,6 +649,7 @@
         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 + ((kdumpStatus == null) ? 0 : 
kdumpStatus.hashCode());
 
         return result;
     }
@@ -703,7 +715,8 @@
                 && ObjectUtils.objectsEqual(hwFamily, other.hwFamily)
                 && ObjectUtils.objectsEqual(HBAs, other.HBAs)
                 && ObjectUtils.objectsEqual(supportedEmulatedMachines, 
other.supportedEmulatedMachines))
-                && powerManagementControlledByPolicy == 
other.powerManagementControlledByPolicy;
+                && powerManagementControlledByPolicy == 
other.powerManagementControlledByPolicy
+                && kdumpStatus == other.kdumpStatus;
     }
 
 }
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 f4c7f50..0dbb03d 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
@@ -6,6 +6,7 @@
 import java.util.HashMap;
 import java.util.List;
 
+import org.ovirt.engine.core.common.businessentities.KdumpStatus;
 import org.ovirt.engine.core.common.businessentities.NonOperationalReason;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
@@ -345,6 +346,7 @@
             entity.setHighlyAvailableIsActive(rs.getBoolean("ha_active"));
             
entity.setHighlyAvailableGlobalMaintenance(rs.getBoolean("ha_global_maintenance"));
             
entity.setHighlyAvailableLocalMaintenance(rs.getBoolean("ha_local_maintenance"));
+            
entity.setKdumpStatus(KdumpStatus.valueOfNumber(rs.getInt("kdump_status")));
             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 1d7f0b0..4f8c28d 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
@@ -6,6 +6,7 @@
 import java.util.List;
 
 import org.apache.commons.lang.NotImplementedException;
+import org.ovirt.engine.core.common.businessentities.KdumpStatus;
 import org.ovirt.engine.core.common.businessentities.NonOperationalReason;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.VdsDynamic;
@@ -97,6 +98,7 @@
             entity.setHardwareFamily(rs.getString("hw_family"));
             entity.setHBAs(new 
JsonObjectDeserializer().deserialize(rs.getString("hbas"), HashMap.class));
             
entity.setPowerManagementControlledByPolicy(rs.getBoolean("controlled_by_pm_policy"));
+            
entity.setKdumpStatus(KdumpStatus.valueOfNumber(rs.getInt("kdump_status")));
 
             return entity;
         }
@@ -252,7 +254,8 @@
                 .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("kdump_status", vds.getKdumpStatus().getAsNumber());
 
         return parameterSource;
     }
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 842994f..42ec88a 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -2543,6 +2543,7 @@
         <column>hw_uuid</column>
         <column>hw_family</column>
         <column>supported_emulated_machines</column>
+        <column>kdump_status</column>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e6</value>
             <value>3</value>
@@ -2590,6 +2591,7 @@
             <null />
             <null />
             <null />
+            <value>-1</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e7</value>
@@ -2638,6 +2640,7 @@
             <null />
             <null />
             <value>rhel6.4,rhel6.4,pc-1.1,pc-1.0</value>
+            <value>0</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e8</value>
@@ -2686,6 +2689,7 @@
             <null />
             <null />
             <value>rhel6.4,rhel6.4,pc-1.1,pc-1.0</value>
+            <value>1</value>
         </row>
         <row>
             <value>23f6d691-5dfb-472b-86dc-9e1d2d3c18f3</value>
@@ -2734,6 +2738,7 @@
             <null />
             <null />
             <value>rhel6.4,rhel6.4,pc-1.1,pc-1.0</value>
+            <value>-1</value>
         </row>
         <row>
             <value>2001751e-549b-4e7a-aff6-32d36856c125</value>
@@ -2782,6 +2787,7 @@
             <null />
             <null />
             <value>rhel6.4,rhel6.4,pc-1.1,pc-1.0</value>
+            <value>-1</value>
         </row>
     </table>
 
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
 
b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
index 46412db..1317a5c 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
@@ -57,6 +57,7 @@
         <include name="common/businessentities/HaMaintenanceMode.java" />
     <include name="common/businessentities/HasSerialNumberPolicy.java" />
     <include name="common/businessentities/SerialNumberPolicy.java" />
+    <include name="common/businessentities/KdumpStatus.java" />
 
                <!-- Network business entities -->
                <include 
name="common/businessentities/network/VdsNetworkInterface.java" />
diff --git a/packaging/dbscripts/create_views.sql 
b/packaging/dbscripts/create_views.sql
index 2e823d7..848da29 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -732,7 +732,8 @@
                       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_statistics.ha_configured as ha_configured, 
vds_statistics.ha_active as ha_active, vds_statistics.ha_global_maintenance as 
ha_global_maintenance,
-                      vds_statistics.ha_local_maintenance as 
ha_local_maintenance, vds_static.disable_auto_pm as disable_auto_pm, 
vds_dynamic.controlled_by_pm_policy as controlled_by_pm_policy
+                      vds_statistics.ha_local_maintenance as 
ha_local_maintenance, vds_static.disable_auto_pm as disable_auto_pm, 
vds_dynamic.controlled_by_pm_policy as controlled_by_pm_policy,
+                      vds_dynamic.kdump_status as kdump_status
 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
@@ -775,7 +776,8 @@
                       vds_dynamic.transparent_hugepages_state, 
vds_statistics.anonymous_hugepages, vds_dynamic.non_operational_reason,
                       storage_pool_iso_map.storage_id, vds_static.ssh_port, 
vds_static.ssh_username, vds_statistics.ha_score,
                       vds_statistics.ha_configured, vds_statistics.ha_active, 
vds_statistics.ha_global_maintenance, vds_statistics.ha_local_maintenance,
-                      vds_static.disable_auto_pm as disable_auto_pm, 
vds_dynamic.controlled_by_pm_policy as controlled_by_pm_policy
+                      vds_static.disable_auto_pm as disable_auto_pm, 
vds_dynamic.controlled_by_pm_policy as controlled_by_pm_policy,
+                      vds_dynamic.kdump_status as kdump_status
 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_05_0160_add_host_kdump_status.sql 
b/packaging/dbscripts/upgrade/03_05_0160_add_host_kdump_status.sql
new file mode 100644
index 0000000..cf69580
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_05_0160_add_host_kdump_status.sql
@@ -0,0 +1,2 @@
+SELECT fn_db_add_column('vds_dynamic', 'kdump_status', 'SMALLINT NOT NULL 
DEFAULT -1');
+
diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql
index 1afb8d3..0abb3db 100644
--- a/packaging/dbscripts/vds_sp.sql
+++ b/packaging/dbscripts/vds_sp.sql
@@ -198,14 +198,15 @@
  v_hw_family VARCHAR(255),
  v_hbas VARCHAR(255),
  v_supported_emulated_machines VARCHAR(255),
- v_controlled_by_pm_policy BOOLEAN)
+ v_controlled_by_pm_policy BOOLEAN,
+ v_kdump_status SMALLINT)
 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, hooks, hw_manufacturer, hw_product_name, 
hw_version, hw_serial_number, hw_uuid, hw_family, hbas, 
supported_emulated_machines, 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_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_controlled_by_pm_policy);
+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, hooks, hw_manufacturer, hw_product_name, 
hw_version, hw_serial_number, hw_uuid, hw_family, hbas, 
supported_emulated_machines, controlled_by_pm_policy, kdump_status)
+       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_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_controlled_by_pm_policy, v_kdump_status);
    END;
 
    RETURN;
@@ -274,7 +275,8 @@
  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_kdump_status SMALLINT)
 RETURNS VOID
 
        --The [vds_dynamic] table doesn't have a timestamp column. Optimistic 
concurrency logic cannot be generated
@@ -305,7 +307,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,
+      kdump_status = v_kdump_status
       WHERE vds_id = v_vds_id;
    END;
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3284c8b9d99b2cabda51558aac92ed0f37262537
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to