anmolbabu has uploaded a new change for review.

Change subject: engine: Fix Bz.1219830 and Bz.1224697
......................................................................

engine: Fix Bz.1219830 and Bz.1224697

This patch fixes the issues of :
1. geo-rep config descriptions being not available
   in geo-rep session config list.
2. use_meta_volume not available in config list

Change-Id: I5d1defdf69cb256a2a872a82a5e54dc6abf6d77b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1219830
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1224697
Signed-off-by: Anmol Babu <anb...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepConfigListQuery.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDao.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.java
M packaging/dbscripts/gluster_georep_sp.sql
A 
packaging/dbscripts/upgrade/03_06_1490_insert_and_update_config_description.sql
5 files changed, 55 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/09/42009/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepConfigListQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepConfigListQuery.java
index 0cd831d..0c2e02e 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepConfigListQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepConfigListQuery.java
@@ -1,5 +1,8 @@
 package org.ovirt.engine.core.bll.gluster;
 
+import java.util.List;
+
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration;
 import org.ovirt.engine.core.common.queries.IdQueryParameters;
 
 public class GetGlusterVolumeGeoRepConfigListQuery<P extends 
IdQueryParameters> extends GlusterQueriesCommandBase<P> {
@@ -10,7 +13,9 @@
 
     @Override
     protected void executeQueryCommand() {
-        
getQueryReturnValue().setReturnValue(getGeoRepDao().getGeoRepSessionConfig(getParameters().getId()));
+        List<GlusterGeoRepSessionConfiguration> configs = 
getGeoRepDao().getGeoRepSessionConfig(getParameters().getId());
+        
configs.addAll(getGeoRepDao().getGlusterGeoRepSessionUnSetConfig(getParameters().getId()));
+        getQueryReturnValue().setReturnValue(configs);
     }
 
 }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDao.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDao.java
index 9a1a6f6..7a3998a 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDao.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDao.java
@@ -54,6 +54,8 @@
 
     public List<GlusterGeoRepSessionConfiguration> getGeoRepSessionConfig(Guid 
sessionId);
 
+    public List<GlusterGeoRepSessionConfiguration> 
getGlusterGeoRepSessionUnSetConfig(Guid sessionId);
+
     public GlusterGeoRepSessionConfiguration getGeoRepSessionConfigByKey(Guid 
sessionId, String configKey);
 
     public List<GlusterGeoRepSession> getAllSessions();
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.java
index b187e0d..711a582 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.java
@@ -33,6 +33,7 @@
     private static final RowMapper<GlusterGeoRepSession> 
georepSessionRowMapper = new GeoRepSessionRowMapper();
     private static final RowMapper<GlusterGeoRepSessionConfiguration> 
georepSessionConfigRowMapper = new GeoRepSessionConfigRowMapper();
     private static final RowMapper<GlusterGeoRepSessionDetails> 
georepSessionDetailsRowMapper = new GeoRepSessionDetailsRowMapper();
+    private static final RowMapper<GlusterGeoRepSessionConfiguration> 
geoRepSessionConfigMasterRowMapper = new GeoRepSessionConfigMasterRowMapper();
 
     public GlusterGeoRepDaoDbFacadeImpl() {
         super("GlusterGeoRepSession");
@@ -58,14 +59,30 @@
         }
     }
 
-    private static final class GeoRepSessionConfigRowMapper implements 
RowMapper<GlusterGeoRepSessionConfiguration> {
+    private static final class GeoRepSessionConfigRowMapper extends 
GeoRepSessionConfigMasterRowMapper implements 
RowMapper<GlusterGeoRepSessionConfiguration> {
+        @Override
+        public GlusterGeoRepSessionConfiguration mapRow(ResultSet rs, int 
rowNum)
+                throws SQLException {
+            GlusterGeoRepSessionConfiguration entity = super.mapRow(rs, 
rowNum);
+            entity.setId(getGuidDefaultEmpty(rs, "session_id"));
+            entity.setValue(rs.getString("config_value"));
+            return entity;
+        }
+    }
+
+    private static class GeoRepSessionConfigMasterRowMapper implements 
RowMapper<GlusterGeoRepSessionConfiguration> {
+        private Guid sessionId;
+
+        public void setSessionId(Guid sessionId) {
+            this.sessionId = sessionId;
+        }
+
         @Override
         public GlusterGeoRepSessionConfiguration mapRow(ResultSet rs, int 
rowNum)
                 throws SQLException {
             GlusterGeoRepSessionConfiguration entity = new 
GlusterGeoRepSessionConfiguration();
-            entity.setId(getGuidDefaultEmpty(rs, "session_id"));
+            entity.setId(sessionId);
             entity.setKey(rs.getString("config_key"));
-            entity.setValue(rs.getString("config_value"));
             entity.setDescription(rs.getString("config_description"));
             entity.setAllowedValues(rs.getString("config_possible_values") != 
null ? Arrays.asList(rs.getString("config_possible_values")
                     .split(";"))
@@ -168,6 +185,12 @@
     }
 
     @Override
+    public List<GlusterGeoRepSessionConfiguration> 
getGlusterGeoRepSessionUnSetConfig(Guid sessionId) {
+        
((GeoRepSessionConfigMasterRowMapper)geoRepSessionConfigMasterRowMapper).setSessionId(sessionId);
+        return 
getCallsHandler().executeReadList("GetGlusterGeoRepSessionUnSetConfig", 
geoRepSessionConfigMasterRowMapper, createIdParameterMapper(sessionId));
+    }
+
+    @Override
     public GlusterGeoRepSessionConfiguration getGeoRepSessionConfigByKey(Guid 
sessionId, String configKey) {
         return 
getCallsHandler().executeRead("GetGlusterGeoRepSessionConfigByKey", 
georepSessionConfigRowMapper,
                 createIdParameterMapper(sessionId).addValue("config_key", 
configKey));
diff --git a/packaging/dbscripts/gluster_georep_sp.sql 
b/packaging/dbscripts/gluster_georep_sp.sql
index b25c9cc..9e84a05 100644
--- a/packaging/dbscripts/gluster_georep_sp.sql
+++ b/packaging/dbscripts/gluster_georep_sp.sql
@@ -229,6 +229,17 @@
 END; $procedure$
 LANGUAGE plpgsql;
 
+Create or replace FUNCTION GetGlusterGeoRepSessionUnSetConfig(v_session_id 
UUID)
+RETURNS SETOF gluster_config_master STABLE
+AS $procedure$
+BEGIN
+    RETURN QUERY SELECT *
+    FROM  gluster_config_master
+    WHERE gluster_config_master.config_key NOT IN 
+    (SELECT config_key from gluster_georep_config WHERE 
gluster_georep_config.session_id = v_session_id);
+END; $procedure$
+LANGUAGE plpgsql;
+
 Create or replace FUNCTION GetGlusterGeoRepSessionConfigByKey(v_session_id 
UUID,
                                                               v_config_key 
VARCHAR(50))
 RETURNS SETOF gluster_geo_rep_config_view STABLE
diff --git 
a/packaging/dbscripts/upgrade/03_06_1490_insert_and_update_config_description.sql
 
b/packaging/dbscripts/upgrade/03_06_1490_insert_and_update_config_description.sql
new file mode 100644
index 0000000..0710ff8
--- /dev/null
+++ 
b/packaging/dbscripts/upgrade/03_06_1490_insert_and_update_config_description.sql
@@ -0,0 +1,10 @@
+INSERT INTO gluster_config_master(config_key, config_description, 
minimum_supported_cluster, config_possible_values, config_feature)
+ values('use_meta_volume', 'Meta volume for the geo-replication session', 
'3.5', 'true;false', 'geo_replication');
+ 
+UPDATE gluster_config_master SET config_key='log_file' WHERE 
config_key='log-file';
+
+UPDATE gluster_config_master SET config_key='gluster_log_file' WHERE 
config_key='gluster-log-file';
+
+UPDATE gluster_config_master SET config_key='ignore_deletes', 
config_possible_values='true;false' WHERE config_key='ignore-deletes';
+
+UPDATE gluster_config_master SET config_key='ssh_command' WHERE 
config_key='ssh-command';


-- 
To view, visit https://gerrit.ovirt.org/42009
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d1defdf69cb256a2a872a82a5e54dc6abf6d77b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: anmolbabu <anb...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to