Shubhendu Tripathi has uploaded a new change for review.

Change subject: gluster: DAO for volume snapshot config maintenance
......................................................................

gluster: DAO for volume snapshot config maintenance

Added DAO for gluster volume snapshot configuration maintenance

Change-Id: Ic0854984eed0f72226aa732a651be50bf8dda9fb
Signed-off-by: Shubhendu Tripathi <[email protected]>
---
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java
A 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDao.java
A 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDaoDbFacadeImpl.java
M backend/manager/modules/dal/src/main/jdbc-resources/engine-daos.properties
A 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDaoTest.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
M packaging/dbscripts/gluster_volume_snapshot_sp.sql
M packaging/dbscripts/upgrade/03_05_1250_add_gluster_volume_snapshot_tables.sql
8 files changed, 404 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/72/39272/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java
index b2f1049..fb3d15f 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java
@@ -128,6 +128,8 @@
 import org.ovirt.engine.core.dao.gluster.GlusterServerServiceDao;
 import org.ovirt.engine.core.dao.gluster.GlusterServiceDao;
 import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao;
+import org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDao;
+import org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotDao;
 import org.ovirt.engine.core.dao.network.InterfaceDao;
 import org.ovirt.engine.core.dao.network.NetworkClusterDao;
 import org.ovirt.engine.core.dao.network.NetworkDao;
@@ -880,6 +882,15 @@
     }
 
     /**
+     * Returns the singleton instance of {@link GlusterVolumeSnapshotConfigDao}
+     *
+     * @return the dao
+     */
+    public GlusterVolumeSnapshotConfigDao getGlusterVolumeSnapshotConfigDao() {
+        return getDao(GlusterVolumeSnapshotConfigDao.class);
+    }
+
+    /**
      * Returns the singleton instance of {@link GlusterVolumeDao}.
      *
      * @return the dao
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDao.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDao.java
new file mode 100644
index 0000000..c271bb5
--- /dev/null
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDao.java
@@ -0,0 +1,30 @@
+package org.ovirt.engine.core.dao.gluster;
+
+import java.util.List;
+
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig;
+import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dao.DAO;
+import org.ovirt.engine.core.dao.SearchDAO;
+
+public interface GlusterVolumeSnapshotConfigDao extends DAO, 
SearchDAO<GlusterVolumeSnapshotConfig> {
+    public void save(GlusterVolumeSnapshotConfig entity);
+
+    public List<GlusterVolumeSnapshotConfig> getConfigByClusterId(Guid 
clusterId);
+
+    public List<GlusterVolumeSnapshotConfig> getConfigByVolumeId(Guid 
clusterId, Guid volumeId);
+
+    public GlusterVolumeSnapshotConfig getConfigByClusterIdAndName(Guid 
clusterId,
+            String paramName);
+
+    public GlusterVolumeSnapshotConfig getConfigByVolumeIdAndName(Guid 
clusterId,
+            Guid volumeId,
+            String paramName);
+
+    @Override
+    public List<GlusterVolumeSnapshotConfig> getAllWithQuery(String query);
+
+    public void updateConfigByClusterIdAndName(Guid clusterId, String 
paramName, String paramValue);
+
+    public void updateConfigByVolumeIdAndName(Guid clusterId, Guid volumeId, 
String paramName, String paramValue);
+}
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDaoDbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDaoDbFacadeImpl.java
new file mode 100644
index 0000000..7bb0e0c
--- /dev/null
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDaoDbFacadeImpl.java
@@ -0,0 +1,109 @@
+package org.ovirt.engine.core.dao.gluster;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig;
+import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dao.BaseDAODbFacade;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+
+public class GlusterVolumeSnapshotConfigDaoDbFacadeImpl extends 
BaseDAODbFacade implements GlusterVolumeSnapshotConfigDao {
+
+    private static final RowMapper<GlusterVolumeSnapshotConfig> 
snapshotConfigRowMapper =
+            new GlusterVolumeSnapshotConfigRowMapper();
+
+    public void save(GlusterVolumeSnapshotConfig config) {
+        
getCallsHandler().executeModification("InsertGlusterVolumeSnapshotConfig", 
createFullParametersMapper(config));
+    }
+
+    public List<GlusterVolumeSnapshotConfig> getConfigByClusterId(Guid 
clusterId) {
+        List<GlusterVolumeSnapshotConfig> configs =
+                
getCallsHandler().executeReadList("GetGlusterVolumeSnapshotConfigByClusterId", 
snapshotConfigRowMapper,
+                        getCustomMapSqlParameterSource()
+                                .addValue("cluster_id", clusterId));
+        return configs;
+    }
+
+    public List<GlusterVolumeSnapshotConfig> getConfigByVolumeId(Guid 
clusterId, Guid volumeId) {
+        List<GlusterVolumeSnapshotConfig> configs =
+                
getCallsHandler().executeReadList("GetGlusterVolumeSnapshotConfigByVolumeId", 
snapshotConfigRowMapper,
+                        getCustomMapSqlParameterSource()
+                                .addValue("cluster_id", clusterId)
+                                .addValue("volume_id", volumeId));
+        return configs;
+    }
+
+    public GlusterVolumeSnapshotConfig getConfigByClusterIdAndName(Guid 
clusterId,
+            String paramName) {
+        GlusterVolumeSnapshotConfig config =
+                
getCallsHandler().executeRead("GetGlusterVolumeSnapshotConfigByClusterIdAndName",
+                        snapshotConfigRowMapper,
+                        getCustomMapSqlParameterSource()
+                                .addValue("cluster_id", clusterId)
+                                .addValue("param_name", paramName));
+        return config;
+    }
+
+    public GlusterVolumeSnapshotConfig getConfigByVolumeIdAndName(Guid 
clusterId,
+            Guid volumeId,
+            String paramName) {
+        GlusterVolumeSnapshotConfig config =
+                
getCallsHandler().executeRead("GetGlusterVolumeSnapshotConfigByVolumeIdAndName",
+                        snapshotConfigRowMapper,
+                        getCustomMapSqlParameterSource()
+                                .addValue("cluster_id", clusterId)
+                                .addValue("volume_id", volumeId)
+                                .addValue("param_name", paramName));
+
+        return config;
+    }
+
+    private static final class GlusterVolumeSnapshotConfigRowMapper implements 
RowMapper<GlusterVolumeSnapshotConfig> {
+        @Override
+        public GlusterVolumeSnapshotConfig mapRow(ResultSet rs, int rowNum)
+                throws SQLException {
+            GlusterVolumeSnapshotConfig config = new 
GlusterVolumeSnapshotConfig();
+            config.setClusterId(getGuidDefaultEmpty(rs, "cluster_id"));
+            config.setVolumeId(getGuidDefaultEmpty(rs, "volume_id"));
+            config.setParamName(rs.getString("param_name"));
+            config.setParamValue(rs.getString("param_value"));
+            return config;
+        }
+    }
+
+    protected MapSqlParameterSource 
createFullParametersMapper(GlusterVolumeSnapshotConfig config) {
+        return getCustomMapSqlParameterSource()
+                .addValue("cluster_id", config.getClusterId())
+                .addValue("volume_id", config.getVolumeId())
+                .addValue("param_name", config.getParamName())
+                .addValue("param_value", config.getParamValue());
+    }
+
+    @Override
+    public List<GlusterVolumeSnapshotConfig> getAllWithQuery(String query) {
+        List<GlusterVolumeSnapshotConfig> configs = jdbcTemplate.query(query, 
snapshotConfigRowMapper);
+        return configs;
+    }
+
+    @Override
+    public void updateConfigByClusterIdAndName(Guid clusterId, String 
paramName, String paramValue) {
+        getCallsHandler().executeModification("UpdateConfigByClusterIdAndName",
+                getCustomMapSqlParameterSource()
+                        .addValue("cluster_id", clusterId)
+                        .addValue("param_name", paramName)
+                        .addValue("param_value", paramValue));
+    }
+
+    @Override
+    public void updateConfigByVolumeIdAndName(Guid clusterId, Guid volumeId, 
String paramName, String paramValue) {
+        
getCallsHandler().executeModification("UpdateConfigByVolumeIdIdAndName",
+                getCustomMapSqlParameterSource()
+                        .addValue("cluster_id", clusterId)
+                        .addValue("volume_id", volumeId)
+                        .addValue("param_name", paramName)
+                        .addValue("param_value", paramValue));
+    }
+}
diff --git 
a/backend/manager/modules/dal/src/main/jdbc-resources/engine-daos.properties 
b/backend/manager/modules/dal/src/main/jdbc-resources/engine-daos.properties
index b8aa233..a518e9d 100644
--- a/backend/manager/modules/dal/src/main/jdbc-resources/engine-daos.properties
+++ b/backend/manager/modules/dal/src/main/jdbc-resources/engine-daos.properties
@@ -58,6 +58,7 @@
 GlusterVolumeDao=org.ovirt.engine.core.dao.gluster.GlusterVolumeDaoDbFacadeImpl
 GlusterBrickDao=org.ovirt.engine.core.dao.gluster.GlusterBrickDaoDbFacadeImpl
 
GlusterVolumeSnapshotDao=org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotDaoDbFacadeImpl
+GlusterVolumeSnapshotConfigDao=org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotConfigDaoDbFacadeImpl
 GlusterOptionDao=org.ovirt.engine.core.dao.gluster.GlusterOptionDaoDbFacadeImpl
 
ImageStorageDomainMapDao=org.ovirt.engine.core.dao.ImageStorageDomainMapDaoDbFacadeImpl
 
VmAndTemplatesGenerationsDAO=org.ovirt.engine.core.dao.VmAndTemplatesGenerationsDbFacadeImpl
diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDaoTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDaoTest.java
new file mode 100644
index 0000000..071b3c1
--- /dev/null
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterVolumeSnapshotConfigDaoTest.java
@@ -0,0 +1,137 @@
+package org.ovirt.engine.core.dao.gluster;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig;
+import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dao.BaseDAOTestCase;
+
+public class GlusterVolumeSnapshotConfigDaoTest extends BaseDAOTestCase {
+
+    private static final Guid CLUSTER_ID = new 
Guid("ae956031-6be2-43d6-bb8f-5191c9253314");
+    private static final Guid VOLUME_ID = new 
Guid("0c3f45f6-3fe9-4b35-a30c-be0d1a835ea8");
+    private static final String PARAM_NAME_1 = "param1";
+    private static final String PARAM_NAME_2 = "param2";
+    private static final String PARAM_NAME_3 = "param3";
+    private static final String NEW_PARAM_NAME = "new_param";
+
+    private GlusterVolumeSnapshotConfig existingConfig1;
+    private GlusterVolumeSnapshotConfig existingConfig2;
+    private GlusterVolumeSnapshotConfig existingConfig3;
+    private GlusterVolumeSnapshotConfig newConfig;
+    private GlusterVolumeSnapshotConfigDao dao;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        dao = dbFacade.getGlusterVolumeSnapshotConfigDao();
+        existingConfig1 = dao.getConfigByVolumeIdAndName(CLUSTER_ID, 
VOLUME_ID, PARAM_NAME_1);
+        existingConfig2 = dao.getConfigByVolumeIdAndName(CLUSTER_ID, 
VOLUME_ID, PARAM_NAME_2);
+        existingConfig3 = dao.getConfigByClusterIdAndName(CLUSTER_ID, 
PARAM_NAME_3);
+    }
+
+    @Test
+    public void testSaveAndGetByVolumeId() {
+        GlusterVolumeSnapshotConfig config =
+                dao.getConfigByVolumeIdAndName(CLUSTER_ID, VOLUME_ID, 
NEW_PARAM_NAME);
+        assertNull(config);
+
+        newConfig = insertTestConfig();
+        config = dao.getConfigByVolumeIdAndName(CLUSTER_ID, VOLUME_ID, 
NEW_PARAM_NAME);
+
+        assertNotNull(config);
+        assertEquals(newConfig, config);
+    }
+
+    private GlusterVolumeSnapshotConfig insertTestConfig() {
+        GlusterVolumeSnapshotConfig config = new GlusterVolumeSnapshotConfig();
+        config.setClusterId(CLUSTER_ID);
+        config.setVolumeId(VOLUME_ID);
+        config.setParamName(NEW_PARAM_NAME);
+        config.setParamValue("new_value");
+        dao.save(config);
+
+        return config;
+    }
+
+    @Test
+    public void testGetGlusterVolumeSnapshotConfigByClusterId() {
+        List<GlusterVolumeSnapshotConfig> configs = 
dao.getConfigByClusterId(CLUSTER_ID);
+
+        assertTrue(configs != null);
+        assertTrue(configs.size() == 3);
+        assertTrue(configs.contains(existingConfig1));
+    }
+
+    @Test
+    public void testGetGlusterVolumeSnapshotConfigByVolumeId() {
+        List<GlusterVolumeSnapshotConfig> configs =
+                dao.getConfigByVolumeId(CLUSTER_ID, VOLUME_ID);
+
+        assertTrue(configs != null);
+        assertTrue(configs.size() == 2);
+        assertTrue(configs.contains(existingConfig1));
+    }
+
+    @Test
+    public void testGetGlusterVolumeSnapshotConfigByClusterIdAndName() {
+        GlusterVolumeSnapshotConfig config =
+                dao.getConfigByClusterIdAndName(CLUSTER_ID, PARAM_NAME_3);
+
+        assertNotNull(config);
+        assertEquals(config, existingConfig3);
+    }
+
+    @Test
+    public void testGetGlusterVolumeSnapshotConfigByVolumeIdAndName() {
+        GlusterVolumeSnapshotConfig config =
+                dao.getConfigByVolumeIdAndName(CLUSTER_ID, VOLUME_ID, 
PARAM_NAME_2);
+
+        assertNotNull(config);
+        assertEquals(config, existingConfig2);
+    }
+
+    @Test
+    public void testGetAllWithQuery() {
+        List<GlusterVolumeSnapshotConfig> configs =
+                dao.getAllWithQuery("select * from 
gluster_volume_snapshot_config");
+
+        assertTrue(configs != null);
+        assertTrue(configs.size() == 3);
+    }
+
+    @Test
+    public void testUpdateByClusterIdAndName() {
+        GlusterVolumeSnapshotConfig config = 
dao.getConfigByClusterIdAndName(CLUSTER_ID, PARAM_NAME_3);
+
+        assertNotNull(config);
+        assertEquals(config.getParamValue(), "value3");
+
+        dao.updateConfigByClusterIdAndName(CLUSTER_ID, PARAM_NAME_3, 
"new_value");
+
+        GlusterVolumeSnapshotConfig modifiedConfig = 
dao.getConfigByClusterIdAndName(CLUSTER_ID, PARAM_NAME_3);
+        assertNotNull(modifiedConfig);
+        assertEquals(modifiedConfig.getParamValue(), "new_value");
+    }
+
+    @Test
+    public void testUpdateByVolumeIdAndName() {
+        GlusterVolumeSnapshotConfig config = 
dao.getConfigByVolumeIdAndName(CLUSTER_ID, VOLUME_ID, PARAM_NAME_1);
+
+        assertNotNull(config);
+        assertEquals(config.getParamValue(), "value1");
+
+        dao.updateConfigByVolumeIdAndName(CLUSTER_ID, VOLUME_ID, PARAM_NAME_1, 
"new_value");
+
+        GlusterVolumeSnapshotConfig modifiedConfig =
+                dao.getConfigByVolumeIdAndName(CLUSTER_ID, VOLUME_ID, 
PARAM_NAME_1);
+        assertNotNull(modifiedConfig);
+        assertEquals(modifiedConfig.getParamValue(), "new_value");
+    }
+}
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 5b2f767..275b836 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -6558,6 +6558,31 @@
         </row>
     </table>
 
+    <table name="gluster_volume_snapshot_config">
+        <column>cluster_id</column>
+        <column>volume_id</column>
+        <column>param_name</column>
+        <column>param_value</column>
+        <row>
+            <value>ae956031-6be2-43d6-bb8f-5191c9253314</value>
+            <value>0c3f45f6-3fe9-4b35-a30c-be0d1a835ea8</value>
+            <value>param1</value>
+            <value>value1</value>
+        </row>
+        <row>
+            <value>ae956031-6be2-43d6-bb8f-5191c9253314</value>
+            <value>0c3f45f6-3fe9-4b35-a30c-be0d1a835ea8</value>
+            <value>param2</value>
+            <value>value2</value>
+        </row>
+        <row>
+            <value>ae956031-6be2-43d6-bb8f-5191c9253314</value>
+            <null/>
+            <value>param3</value>
+            <value>value3</value>
+        </row>
+    </table>
+
     <table name="gluster_volume_bricks">
         <column>id</column>
         <column>volume_id</column>
diff --git a/packaging/dbscripts/gluster_volume_snapshot_sp.sql 
b/packaging/dbscripts/gluster_volume_snapshot_sp.sql
index e6f55a0..37b3884 100644
--- a/packaging/dbscripts/gluster_volume_snapshot_sp.sql
+++ b/packaging/dbscripts/gluster_volume_snapshot_sp.sql
@@ -135,3 +135,91 @@
 END; $procedure$
 LANGUAGE plpgsql;
 
+Create or replace FUNCTION InsertGlusterVolumeSnapshotConfig(v_cluster_id UUID,
+                                                v_volume_id UUID,
+                                                v_param_name VARCHAR(128),
+                                                v_param_value VARCHAR(128))
+    RETURNS VOID
+    AS $procedure$
+BEGIN
+    INSERT INTO gluster_volume_snapshot_config (cluster_id, volume_id, 
param_name, param_value)
+    VALUES (v_cluster_id, v_volume_id, v_param_name, v_param_value);
+END; $procedure$
+LANGUAGE plpgsql;
+
+
+Create or replace FUNCTION 
GetGlusterVolumeSnapshotConfigByClusterId(v_cluster_id UUID)
+    RETURNS SETOF gluster_volume_snapshot_config STABLE
+    AS $procedure$
+BEGIN
+    RETURN QUERY SELECT *
+    FROM  gluster_volume_snapshot_config
+    WHERE cluster_id = v_cluster_id;
+END; $procedure$
+LANGUAGE plpgsql;
+
+Create or replace FUNCTION 
GetGlusterVolumeSnapshotConfigByVolumeId(v_cluster_id UUID, v_volume_id UUID)
+RETURNS SETOF gluster_volume_snapshot_config STABLE
+AS $procedure$
+BEGIN
+    RETURN QUERY SELECT *
+    FROM  gluster_volume_snapshot_config
+    WHERE cluster_id = v_cluster_id and volume_id = v_volume_id;
+END; $procedure$
+LANGUAGE plpgsql;
+
+
+Create or replace FUNCTION 
GetGlusterVolumeSnapshotConfigByClusterIdAndName(v_cluster_id UUID,
+                                            v_param_name VARCHAR(128))
+RETURNS SETOF gluster_volume_snapshot_config STABLE
+    AS $procedure$
+BEGIN
+    RETURN QUERY SELECT *
+    FROM gluster_volume_snapshot_config
+    WHERE cluster_id = v_cluster_id and volume_id IS NULL and param_name = 
v_param_name;
+END; $procedure$
+LANGUAGE plpgsql;
+
+
+Create or replace FUNCTION 
GetGlusterVolumeSnapshotConfigByVolumeIdAndName(v_cluster_id UUID,
+                                            v_volume_id UUID,
+                                            v_param_name VARCHAR(128))
+RETURNS SETOF gluster_volume_snapshot_config STABLE
+    AS $procedure$
+BEGIN
+    RETURN QUERY SELECT *
+    FROM gluster_volume_snapshot_config
+    WHERE cluster_id = v_cluster_id and volume_id = v_volume_id and param_name 
= v_param_name;
+END; $procedure$
+LANGUAGE plpgsql;
+
+Create or replace FUNCTION UpdateConfigByClusterIdAndName(v_cluster_id UUID,
+                                            v_param_name VARCHAR(128),
+                                            v_param_value VARCHAR(128))
+    RETURNS VOID
+    AS $procedure$
+BEGIN
+    UPDATE  gluster_volume_snapshot_config
+    SET     param_value = v_param_value,
+            _update_date = LOCALTIMESTAMP
+    WHERE   cluster_id = v_cluster_id
+    AND     volume_id IS NULL
+    AND     param_name = v_param_name;
+END; $procedure$
+LANGUAGE plpgsql;
+
+Create or replace FUNCTION UpdateConfigByVolumeIdIdAndName(v_cluster_id UUID,
+                                            v_volume_id UUID,
+                                            v_param_name VARCHAR(128),
+                                            v_param_value VARCHAR(128))
+    RETURNS VOID
+    AS $procedure$
+BEGIN
+    UPDATE  gluster_volume_snapshot_config
+    SET     param_value = v_param_value,
+            _update_date = LOCALTIMESTAMP
+    WHERE   cluster_id = v_cluster_id
+    AND     volume_id = v_volume_id
+    AND     param_name = v_param_name;
+END; $procedure$
+LANGUAGE plpgsql;
diff --git 
a/packaging/dbscripts/upgrade/03_05_1250_add_gluster_volume_snapshot_tables.sql 
b/packaging/dbscripts/upgrade/03_05_1250_add_gluster_volume_snapshot_tables.sql
index d2b9e25..3a01940 100644
--- 
a/packaging/dbscripts/upgrade/03_05_1250_add_gluster_volume_snapshot_tables.sql
+++ 
b/packaging/dbscripts/upgrade/03_05_1250_add_gluster_volume_snapshot_tables.sql
@@ -18,7 +18,9 @@
     cluster_id UUID NOT NULL,
     volume_id UUID,
     param_name VARCHAR(128) NOT NULL,
-    param_value VARCHAR(128)
+    param_value VARCHAR(128),
+    _create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP,
+    _update_date TIMESTAMP WITH TIME ZONE
 ) WITH OIDS;
 CREATE UNIQUE INDEX IDX_gluster_volume_snapshot_config_unique ON 
gluster_volume_snapshot_config(cluster_id, volume_id, param_name);
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic0854984eed0f72226aa732a651be50bf8dda9fb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Shubhendu Tripathi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to