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

Change subject: core: Add flag to detect host kdump before fencing
......................................................................

core: Add flag to detect host kdump before fencing

Adds pmKdumpDetection flag to VdsStatic, to allow host kdump flow
detection before execution of fencing for host. This flag is part of
power management configuration.

Change-Id: Id72ea0e461d79df26873e93ef91ce9470a897a54
Bug-Url: https://bugzilla.redhat.com/1079821
Signed-off-by: Martin Perina <mper...@redhat.com>
---
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/VdsStatic.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/VdsStaticDAODbFacadeImpl.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
M packaging/dbscripts/create_views.sql
A packaging/dbscripts/upgrade/03_05_0300_add_host_kdump_detection.sql
M 
packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
M packaging/dbscripts/vds_sp.sql
9 files changed, 41 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/26719/1

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 d8a970e..0079176 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
@@ -161,6 +161,7 @@
         vds.setPmSecondaryPassword(getPmSecondaryPassword());
         vds.setPmSecondaryConcurrent(isPmSecondaryConcurrent());
         vds.setPmPort(getPmPort());
+        vds.setPmKdumpDetection(isPmKdumpDetection());
         vds.setConsoleAddress(getConsoleAddress());
         vds.setHBAs(getHBAs());
         vds.setVdsSpmPriority(getVdsSpmPriority());
@@ -949,6 +950,14 @@
         mVdsStatic.setPmSecondaryOptionsMap(value);
     }
 
+    public boolean isPmKdumpDetection() {
+        return mVdsStatic.isPmKdumpDetection();
+    }
+
+    public void setPmKdumpDetection(boolean pmKdumpDetection) {
+        mVdsStatic.setPmKdumpDetection(pmKdumpDetection);
+    }
+
     public void setPmOptionsMap(HashMap<String, String> value) {
         mVdsStatic.setPmOptionsMap(value);
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java
index af6611b..1437a51 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java
@@ -142,6 +142,8 @@
     @EditableField
     private HashMap<String, String> pmSecondaryOptionsMap;
 
+    @EditableField
+    private boolean pmKdumpDetection;
 
     /**
      * When this flag is true, the automatic power management
@@ -185,6 +187,7 @@
         vdsType = VDSType.VDS;
         autoRecoverable = true;
         disablePowerManagementPolicy = false;
+        pmKdumpDetection = true;
     }
 
     public VdsStatic(String host_name, String ip, String uniqueId, int port, 
int ssh_port, String ssh_username, Guid vds_group_id, Guid vds_id,
@@ -447,6 +450,14 @@
         pmSecondaryOptions = pmOptionsMapToString(value);
     }
 
+    public boolean isPmKdumpDetection() {
+        return pmKdumpDetection;
+    }
+
+    public void setPmKdumpDetection(boolean pmKdumpDetection) {
+        this.pmKdumpDetection = pmKdumpDetection;
+    }
+
     public boolean isDisablePowerManagementPolicy() {
         return disablePowerManagementPolicy;
     }
@@ -563,6 +574,7 @@
         result = prime * result + ((pmSecondaryPort == null) ? 0 : 
pmSecondaryPort.hashCode());
         result = prime * result + ((pmSecondaryType == null) ? 0 : 
pmSecondaryType.hashCode());
         result = prime * result + ((pmSecondaryUser == null) ? 0 : 
pmSecondaryUser.hashCode());
+        result = prime * result + (pmKdumpDetection ? 1 : 0);
         result = prime * result + port;
         result = prime * result + sshPort;
         result = prime * result + ((sshUsername == null) ? 0 : 
sshUsername.hashCode());
@@ -608,6 +620,7 @@
                 && ObjectUtils.objectsEqual(pmSecondaryPort, 
other.pmSecondaryPort)
                 && ObjectUtils.objectsEqual(pmSecondaryType, 
other.pmSecondaryType)
                 && ObjectUtils.objectsEqual(pmSecondaryUser, 
other.pmSecondaryUser)
+                && pmKdumpDetection == other.isPmKdumpDetection()
                 && port == other.port
                 && sshPort == other.sshPort
                 && ObjectUtils.objectsEqual(sshUsername, other.sshUsername)
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 64ef2ca..962cc86 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
@@ -296,6 +296,7 @@
             entity.setPmSecondaryPort((Integer) 
rs.getObject("pm_secondary_port"));
             entity.setPmSecondaryOptions(rs.getString("pm_secondary_options"));
             
entity.setPmSecondaryConcurrent(rs.getBoolean("pm_secondary_concurrent"));
+            entity.setPmKdumpDetection(rs.getBoolean("pm_detect_kdump"));
             entity.setSpmStatus(VdsSpmStatus.forValue(rs
                     .getInt("spm_status")));
             entity.setSwapFree(rs.getLong("swap_free"));
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java
index 80d74cf..7f3a875 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java
@@ -93,6 +93,7 @@
                 .addValue("pm_secondary_port", vds.getPmSecondaryPort())
                 .addValue("pm_secondary_options", vds.getPmSecondaryOptions())
                 .addValue("pm_secondary_concurrent", 
vds.isPmSecondaryConcurrent())
+                .addValue("pm_detect_kdump", vds.isPmKdumpDetection())
                 .addValue("otp_validity", vds.getOtpValidity())
                 .addValue("vds_spm_priority", vds.getVdsSpmPriority())
                 .addValue("console_address", vds.getConsoleAddress())
@@ -154,6 +155,7 @@
             entity.setPmSecondaryPort((Integer) 
rs.getObject("pm_secondary_port"));
             entity.setPmSecondaryOptions(rs.getString("pm_secondary_options"));
             
entity.setPmSecondaryConcurrent(rs.getBoolean("pm_secondary_concurrent"));
+            entity.setPmKdumpDetection(rs.getBoolean("pm_detect_kdump"));
             entity.setOtpValidity(rs.getLong("otp_validity"));
             entity.setSshKeyFingerprint(rs.getString("sshKeyFingerprint"));
             entity.setConsoleAddress(rs.getString("console_address"));
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 8e7e773..7b235a5 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -1215,6 +1215,7 @@
         <column>sshKeyFingerprint</column>
         <column>ssh_port</column>
         <column>ssh_username</column>
+        <column>pm_detect_kdump</column>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e6</value>
             <value>magenta-vdsc</value>
@@ -1246,6 +1247,7 @@
             <value>b5:ad:16:19:06:9f:b3:41:69:eb:1c:42:1d:12:b5:31</value>
             <value>22</value>
             <value>root</value>
+            <value>1</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e7</value>
@@ -1278,6 +1280,7 @@
             <value>b5:ad:16:19:06:9f:b3:41:69:eb:1c:42:1d:12:b5:31</value>
             <value>22</value>
             <value>root</value>
+            <value>1</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e8</value>
@@ -1310,6 +1313,7 @@
             <value>b5:ad:16:19:06:9f:b3:41:69:eb:1c:42:1d:12:b5:31</value>
             <value>22</value>
             <value>root</value>
+            <value>1</value>
         </row>
         <row>
             <value>23f6d691-5dfb-472b-86dc-9e1d2d3c18f3</value>
@@ -1342,6 +1346,7 @@
             <value>b5:ad:16:19:06:9f:b3:41:69:eb:1c:42:1d:12:b5:31</value>
             <value>22</value>
             <value>root</value>
+            <value>1</value>
         </row>
         <row>
             <value>2001751e-549b-4e7a-aff6-32d36856c125</value>
@@ -1374,6 +1379,7 @@
             <value>b5:ad:16:19:06:9f:b3:41:69:eb:1c:42:1d:12:b5:31</value>
             <value>22</value>
             <value>root</value>
+            <value>1</value>
         </row>
     </table>
 
diff --git a/packaging/dbscripts/create_views.sql 
b/packaging/dbscripts/create_views.sql
index 26a7aab..80c3246 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -715,7 +715,7 @@
                       vds_static.pm_proxy_preferences as 
pm_proxy_preferences,vds_static.pm_secondary_ip as pm_secondary_ip,
                       vds_static.pm_secondary_options as pm_secondary_options, 
vds_static.pm_secondary_port as pm_secondary_port,
                       vds_static.pm_secondary_password as 
pm_secondary_password, vds_static.pm_secondary_user as pm_secondary_user,
-                      vds_static.pm_secondary_type as pm_secondary_type, 
vds_static.pm_secondary_concurrent as pm_secondary_concurrent,
+                      vds_static.pm_secondary_type as pm_secondary_type, 
vds_static.pm_secondary_concurrent as pm_secondary_concurrent, 
vds_static.pm_detect_kdump as pm_detect_kdump,
                       vds_static.vds_spm_priority as vds_spm_priority, 
vds_dynamic.hooks as hooks,vds_dynamic.status as status,
                       vds_dynamic.cpu_cores as cpu_cores, 
vds_dynamic.cpu_threads as cpu_threads, vds_dynamic.cpu_model as cpu_model, 
vds_dynamic.cpu_speed_mh as cpu_speed_mh,
                       vds_dynamic.if_total_speed as if_total_speed, 
vds_dynamic.kvm_enabled as kvm_enabled, vds_dynamic.physical_mem_mb as 
physical_mem_mb,
@@ -758,7 +758,7 @@
                       vds_static.pm_secondary_ip as pm_secondary_ip,
                       vds_static.pm_secondary_options as pm_secondary_options, 
vds_static.pm_secondary_port as pm_secondary_port,
                       vds_static.pm_secondary_password as 
pm_secondary_password, vds_static.pm_secondary_user as pm_secondary_user,
-                      vds_static.pm_secondary_type as pm_secondary_type, 
vds_static.pm_secondary_concurrent as pm_secondary_concurrent,
+                      vds_static.pm_secondary_type as pm_secondary_type, 
vds_static.pm_secondary_concurrent as pm_secondary_concurrent, 
vds_static.pm_detect_kdump as pm_detect_kdump,
                       vds_dynamic.hooks, vds_dynamic.status, 
vds_dynamic.cpu_cores,
                       vds_dynamic.cpu_threads, vds_dynamic.cpu_model, 
vds_dynamic.cpu_speed_mh, vds_dynamic.if_total_speed, vds_dynamic.kvm_enabled,
                       vds_dynamic.physical_mem_mb, 
vds_dynamic.pending_vcpus_count, vds_dynamic.pending_vmem_size,
diff --git 
a/packaging/dbscripts/upgrade/03_05_0300_add_host_kdump_detection.sql 
b/packaging/dbscripts/upgrade/03_05_0300_add_host_kdump_detection.sql
new file mode 100644
index 0000000..1a6cb6e
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_05_0300_add_host_kdump_detection.sql
@@ -0,0 +1 @@
+SELECT fn_db_add_column('vds_static', 'pm_detect_kdump', 'BOOLEAN NOT NULL 
DEFAULT FALSE');
diff --git 
a/packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
 
b/packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
index 9074e24..613c112 100644
--- 
a/packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
+++ 
b/packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
@@ -55,7 +55,8 @@
           'vds_group_compatibility_version', 'vds_group_virt_service', 
'vds_group_gluster_service', 'host_os', 'kvm_version', 'libvirt_version', 
'spice_version', 'kernel_version',
           'iscsi_initiator_name', 'transparent_hugepages_state', 
'anonymous_hugepages',
           'non_operational_reason', 'recoverable', 'sshkeyfingerprint', 
'count_threads_as_cores', 'cpu_threads',
-          'hw_manufacturer', 'hw_product_name', 'hw_version', 
'hw_serial_number', 'hw_uuid', 'hw_family', 'ssh_port', 'ssh_username', 
'boot_time'));
+          'hw_manufacturer', 'hw_product_name', 'hw_version', 
'hw_serial_number', 'hw_uuid', 'hw_family', 'ssh_port', 'ssh_username', 
'boot_time',
+          'pm_detect_kdump'));
 -- pm_options are missing
 END; $function$
 LANGUAGE plpgsql;
diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql
index 4781b71..fad37d2 100644
--- a/packaging/dbscripts/vds_sp.sql
+++ b/packaging/dbscripts/vds_sp.sql
@@ -399,6 +399,7 @@
     v_pm_secondary_port INTEGER,
     v_pm_secondary_options VARCHAR(4000),
     v_pm_secondary_concurrent BOOLEAN,
+    v_pm_detect_kdump BOOLEAN,
     v_vds_spm_priority INTEGER,
     v_sshKeyFingerprint VARCHAR(128),
     v_console_address VARCHAR(255),
@@ -414,12 +415,12 @@
          INSERT INTO vds_static(vds_id,host_name, free_text_comment, ip, 
vds_unique_id, port, vds_group_id, vds_name, server_SSL_enabled,
                                
vds_type,vds_strength,pm_type,pm_user,pm_password,pm_port,pm_options,pm_enabled,
                                pm_proxy_preferences, pm_secondary_ip, 
pm_secondary_type, pm_secondary_user,
-                               pm_secondary_password, pm_secondary_port, 
pm_secondary_options, pm_secondary_concurrent,
+                               pm_secondary_password, pm_secondary_port, 
pm_secondary_options, pm_secondary_concurrent, pm_detect_kdump,
                                vds_spm_priority, sshKeyFingerprint, 
console_address, ssh_port, ssh_username, disable_auto_pm)
                        VALUES(v_vds_id,v_host_name, v_free_text_comment, v_ip, 
v_vds_unique_id, v_port, v_vds_group_id, v_vds_name, v_server_SSL_enabled,
                                
v_vds_type,v_vds_strength,v_pm_type,v_pm_user,v_pm_password,v_pm_port,v_pm_options,v_pm_enabled,
                                v_pm_proxy_preferences, v_pm_secondary_ip, 
v_pm_secondary_type, v_pm_secondary_user,
-                               v_pm_secondary_password, v_pm_secondary_port, 
v_pm_secondary_options, v_pm_secondary_concurrent,
+                               v_pm_secondary_password, v_pm_secondary_port, 
v_pm_secondary_options, v_pm_secondary_concurrent, v_pm_detect_kdump,
                                v_vds_spm_priority, v_sshKeyFingerprint, 
v_console_address, v_ssh_port, v_ssh_username, v_disable_auto_pm);
       END;
    end if;
@@ -456,6 +457,7 @@
     v_pm_secondary_port INTEGER,
     v_pm_secondary_options VARCHAR(4000),
     v_pm_secondary_concurrent BOOLEAN,
+    v_pm_detect_kdump BOOLEAN,
     v_otp_validity BIGINT,
     v_vds_spm_priority INTEGER,
     v_sshKeyFingerprint VARCHAR(128),
@@ -480,7 +482,7 @@
       pm_secondary_ip = v_pm_secondary_ip, pm_secondary_type = 
v_pm_secondary_type,
       pm_secondary_user = v_pm_secondary_user, pm_secondary_password = 
v_pm_secondary_password,
       pm_secondary_port = v_pm_secondary_port, pm_secondary_options = 
v_pm_secondary_options,
-      pm_secondary_concurrent = v_pm_secondary_concurrent,
+      pm_secondary_concurrent = v_pm_secondary_concurrent, pm_detect_kdump = 
v_pm_detect_kdump,
       otp_validity = v_otp_validity, vds_spm_priority = v_vds_spm_priority, 
sshKeyFingerprint = v_sshKeyFingerprint,
       console_address = v_console_address, ssh_port = v_ssh_port, ssh_username 
= v_ssh_username, disable_auto_pm = v_disable_auto_pm
       WHERE vds_id = v_vds_id;


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id72ea0e461d79df26873e93ef91ce9470a897a54
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <mper...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to