Gilad Chaplik has uploaded a new change for review. Change subject: core, db: Introduce CPU profile DAL ......................................................................
core, db: Introduce CPU profile DAL Change-Id: I9d3b9d4737d523a722a688485e45d2a77775e2ea Signed-off-by: Gilad Chaplik <gchap...@redhat.com> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcObjectType.java 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/profiles/CpuProfileDao.java A backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/profiles/CpuProfileDaoDbFacadeImpl.java M backend/manager/modules/dal/src/main/jdbc-resources/engine-daos.properties M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbFacadeDAOTest.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java A backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/profiles/CpuProfileDaoTest.java M backend/manager/modules/dal/src/test/resources/fixtures.xml A packaging/dbscripts/cpu_profiles_sp.sql M packaging/dbscripts/create_functions.sql A packaging/dbscripts/upgrade/03_05_0980_add_cpu_profiles_table.sql R packaging/dbscripts/upgrade/03_05_0990_add_cpu_limit_to_qos_table.sql 13 files changed, 462 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/23/31823/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcObjectType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcObjectType.java index 81d2148..aa1bc4c 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcObjectType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcObjectType.java @@ -35,7 +35,8 @@ GlusterService(25, "GlusterService"), ExternalTask(26, "ExternalTask"), VnicProfile(27, "Vnic Profile"), - DiskProfile(29, "Disk Profile"); + DiskProfile(29, "Disk Profile"), + CpuProfile(30, "Cpu Profile"); private int value; 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 588c6c7..ac0da19 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 @@ -137,6 +137,7 @@ import org.ovirt.engine.core.dao.network.VmNicDao; import org.ovirt.engine.core.dao.network.VnicProfileDao; import org.ovirt.engine.core.dao.network.VnicProfileViewDao; +import org.ovirt.engine.core.dao.profiles.CpuProfileDao; import org.ovirt.engine.core.dao.profiles.DiskProfileDao; import org.ovirt.engine.core.dao.provider.ProviderDao; import org.ovirt.engine.core.dao.qos.CpuQosDao; @@ -1123,4 +1124,13 @@ public DiskProfileDao getDiskProfileDao() { return getDao(DiskProfileDao.class); } + + /** + * Returns the singleton instance of {@link CpuProfileDao}. + * + * @return the dao instance + */ + public CpuProfileDao getCpuProfileDao() { + return getDao(CpuProfileDao.class); + } } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/profiles/CpuProfileDao.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/profiles/CpuProfileDao.java new file mode 100644 index 0000000..84487ca --- /dev/null +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/profiles/CpuProfileDao.java @@ -0,0 +1,33 @@ +package org.ovirt.engine.core.dao.profiles; + +import java.util.List; + +import org.ovirt.engine.core.common.businessentities.profiles.CpuProfile; +import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.dao.GenericDao; + +public interface CpuProfileDao extends ProfilesDao<CpuProfile>, GenericDao<CpuProfile, Guid> { + + /** + * Retrieves all CPU profiles associated with the given cluster id. + * + * @param clusterId + * the cluster's ID + * @return the list of CPU profiles + */ + List<CpuProfile> getAllForCluster(Guid clusterId); + + /** + * Retrieves all CPU profiles associated with the given cluster id, according user's permissions. + * + * @param clusterId + * the cluster's ID + * @param userId + * the user's ID + * @param isFiltered + * indicating whether the results should be filtered according to the user's permissions + * @return the list of CPU profiles + */ + List<CpuProfile> getAllForCluster(Guid clusterId, Guid userId, boolean isFiltered); + +} diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/profiles/CpuProfileDaoDbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/profiles/CpuProfileDaoDbFacadeImpl.java new file mode 100644 index 0000000..6297955 --- /dev/null +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/profiles/CpuProfileDaoDbFacadeImpl.java @@ -0,0 +1,62 @@ +package org.ovirt.engine.core.dao.profiles; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +import org.ovirt.engine.core.common.businessentities.profiles.CpuProfile; +import org.ovirt.engine.core.compat.Guid; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; + +public class CpuProfileDaoDbFacadeImpl extends ProfileBaseDaoFacadeImpl<CpuProfile> implements CpuProfileDao { + private static final CpuProfileDaoDbFacadaeImplMapper MAPPER = new CpuProfileDaoDbFacadaeImplMapper(); + + public CpuProfileDaoDbFacadeImpl() { + super("CpuProfile"); + } + + @Override + public List<CpuProfile> getAllForCluster(Guid clusterId) { + return getAllForCluster(clusterId, null, false); + } + + @Override + public List<CpuProfile> getAllForCluster(Guid clusterId, Guid userId, boolean isFiltered) { + return getCallsHandler().executeReadList("GetCpuProfilesByClusterId", + createEntityRowMapper(), + getCustomMapSqlParameterSource().addValue("cluster_id", clusterId) + .addValue("user_id", userId) + .addValue("is_filtered", isFiltered)); + } + + @Override + public List<CpuProfile> getAllForQos(Guid qosId) { + return getCallsHandler().executeReadList("GetCpuProfilesByQosId", + createEntityRowMapper(), + getCustomMapSqlParameterSource().addValue("qos_id", qosId)); + } + + @Override + protected RowMapper<CpuProfile> createEntityRowMapper() { + return MAPPER; + } + + @Override + protected MapSqlParameterSource createFullParametersMapper(CpuProfile obj) { + MapSqlParameterSource map = super.createFullParametersMapper(obj); + map.addValue("cluster_id", obj.getClusterId()); + return map; + } + + protected static class CpuProfileDaoDbFacadaeImplMapper extends ProfileBaseDaoFacadaeImplMapper<CpuProfile> { + + @Override + protected CpuProfile createProfileEntity(ResultSet rs) throws SQLException { + CpuProfile cpuProfile = new CpuProfile(); + cpuProfile.setClusterId(getGuid(rs, "cluster_id")); + return cpuProfile; + } + + } +} 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 44cce07..63e7518 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 @@ -86,3 +86,4 @@ ExternalVariableDao=org.ovirt.engine.core.dao.ExternalVariableDaoDbFacadeImpl VdsKdumpStatusDao=org.ovirt.engine.core.dao.VdsKdumpStatusDaoDbFacadeImpl DiskProfileDao=org.ovirt.engine.core.dao.profiles.DiskProfileDaoDbFacadeImpl +CpuProfileDao=org.ovirt.engine.core.dao.profiles.CpuProfileDaoDbFacadeImpl diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbFacadeDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbFacadeDAOTest.java index 97f099e..3fc6d7c 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbFacadeDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/DbFacadeDAOTest.java @@ -1,5 +1,6 @@ package org.ovirt.engine.core.dao; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -34,6 +35,7 @@ import org.ovirt.engine.core.common.businessentities.aaa.DbUser; import org.ovirt.engine.core.common.businessentities.network.Network; import org.ovirt.engine.core.common.businessentities.network.VnicProfile; +import org.ovirt.engine.core.common.businessentities.profiles.CpuProfile; import org.ovirt.engine.core.common.businessentities.profiles.DiskProfile; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.compat.Guid; @@ -326,4 +328,12 @@ String name = diskProfile.getName(); assertTrue(name.equals(dbFacade.getEntityNameByIdAndType(FixturesTool.DISK_PROFILE_1, VdcObjectType.DiskProfile))); } + + @Test + public void testGetEntityNameByIdAndTypeForCpuProfile() { + CpuProfile cpuProfile = dbFacade.getCpuProfileDao().get(FixturesTool.CPU_PROFILE_1); + assertNotNull(cpuProfile); + String name = cpuProfile.getName(); + assertEquals(name, dbFacade.getEntityNameByIdAndType(FixturesTool.CPU_PROFILE_1, VdcObjectType.CpuProfile)); + } } diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java index e4f1a2b..580bf3c 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java @@ -86,7 +86,7 @@ /** * Predefined vds group. */ - protected static final Guid VDS_GROUP_RHEL6_ISCSI = new Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1"); + public static final Guid VDS_GROUP_RHEL6_ISCSI = new Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1"); /** * Predefined vds group. @@ -632,4 +632,7 @@ public static final Guid DISK_PROFILE_1 = new Guid("fd81f1e1-785b-4579-ab75-1419ebb87052"); public static final Guid DISK_PROFILE_2 = new Guid("fd81f1e1-785b-4579-ab75-1419ebb87053"); + + public static final Guid CPU_PROFILE_1 = new Guid("fd81f1e1-785b-4579-ab75-1419ebb87052"); + public static final Guid CPU_PROFILE_2 = new Guid("fd81f1e1-785b-4579-ab75-1419ebb87053"); } diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/profiles/CpuProfileDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/profiles/CpuProfileDaoTest.java new file mode 100644 index 0000000..8649730 --- /dev/null +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/profiles/CpuProfileDaoTest.java @@ -0,0 +1,150 @@ +package org.ovirt.engine.core.dao.profiles; + +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.profiles.CpuProfile; +import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.dao.BaseDAOTestCase; +import org.ovirt.engine.core.dao.FixturesTool; + +public class CpuProfileDaoTest extends BaseDAOTestCase { + + private CpuProfile cpuProfile; + private CpuProfileDao dao; + + @Override + public void setUp() throws Exception { + super.setUp(); + + dao = dbFacade.getCpuProfileDao(); + cpuProfile = new CpuProfile(); + cpuProfile.setId(Guid.newGuid()); + cpuProfile.setName("new_profile"); + cpuProfile.setClusterId(FixturesTool.VDS_GROUP_RHEL6_ISCSI); + cpuProfile.setQosId(FixturesTool.QOS_ID_4); + } + + /** + * Ensures null is returned. + */ + @Test + public void testGetWithNonExistingId() { + CpuProfile result = dao.get(Guid.newGuid()); + + assertNull(result); + } + + /** + * Ensures that the interface profile is returned. + */ + @Test + public void testGet() { + CpuProfile result = dao.get(FixturesTool.CPU_PROFILE_1); + + assertNotNull(result); + assertEquals(FixturesTool.CPU_PROFILE_1, result.getId()); + } + + /** + * Ensures that an empty collection is returned. + */ + @Test + public void testGetAllForStorageEmpty() { + List<CpuProfile> result = dao.getAllForCluster(Guid.newGuid()); + + assertNotNull(result); + assertTrue(result.isEmpty()); + } + + /** + * Ensures that profiles are returned. + */ + @Test + public void testGetAllForClusterFull() { + checkResults(dao.getAllForCluster(FixturesTool.VDS_GROUP_RHEL6_ISCSI)); + } + + private void checkResults(List<CpuProfile> result) { + assertNotNull(result); + assertEquals(2, result.size()); + for (CpuProfile cpuProfile : result) { + assertEquals(FixturesTool.VDS_GROUP_RHEL6_ISCSI, cpuProfile.getClusterId()); + } + } + + @Test + public void testGetAll() { + List<CpuProfile> result = dao.getAll(); + + assertNotNull(result); + assertEquals(5, result.size()); + } + + /** + * Ensures that the save is working correctly + */ + @Test + public void testSave() { + assertNull(dao.get(cpuProfile.getId())); + dao.save(cpuProfile); + CpuProfile result = dao.get(cpuProfile.getId()); + assertNotNull(result); + assertEquals(cpuProfile, result); + } + + /** + * Ensures that the update is working correctly + */ + @Test + public void testUpdate() { + CpuProfile profile = dao.get(FixturesTool.CPU_PROFILE_1); + assertNotNull(profile); + assertTrue(FixturesTool.QOS_ID_4.equals(profile.getQosId())); + profile.setQosId(FixturesTool.QOS_ID_5); + profile.setDescription("desc1"); + dao.update(profile); + CpuProfile result = dao.get(profile.getId()); + assertNotNull(result); + assertEquals(profile, result); + } + + /** + * Ensures that the remove is working correctly + */ + @Test + public void testRemove() { + dao.save(cpuProfile); + CpuProfile result = dao.get(cpuProfile.getId()); + assertNotNull(result); + dao.remove(cpuProfile.getId()); + assertNull(dao.get(cpuProfile.getId())); + } + + @Test + public void testGetByQos() { + List<CpuProfile> allForQos = dao.getAllForQos(FixturesTool.QOS_ID_4); + assertNotNull(allForQos); + assertEquals(2, allForQos.size()); + for (CpuProfile cpuProfile : allForQos) { + assertEquals(FixturesTool.QOS_ID_4, cpuProfile.getQosId()); + } + } + + @Test + public void testGetFilteredByPermissions() { + checkResults(dao.getAllForCluster(FixturesTool.VDS_GROUP_RHEL6_ISCSI, PRIVILEGED_USER_ID, true)); + } + + @Test + public void testGetFilteredByPermissionsForUnprivilegedUser() { + List<CpuProfile> result = + dao.getAllForCluster(FixturesTool.VDS_GROUP_RHEL6_ISCSI, UNPRIVILEGED_USER_ID, true); + assertTrue(result.isEmpty()); + } +} diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index d1b5ab3..a3c4d87 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -5108,6 +5108,46 @@ </row> </table> + <table name="cpu_profiles"> + <column>id</column> + <column>name</column> + <column>cluster_id</column> + <column>qos_id</column> + <column>description</column> + <row> + <value>fd81f1e1-785b-4579-ab75-1419ebb87052</value> + <value>engine_profile</value> + <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d1</value> + <value>ae956031-6be2-43d6-bb90-5191c9253317</value> + <value>cpu profile description</value> + </row> + <row> + <value>a667da39-27b0-47ec-a5fa-d4293a62b222</value> + <value>engine_profile_pm</value> + <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d1</value> + <value>ae956031-6be2-43d6-bb90-5191c9253318</value> + <null /> + </row> + <row> + <value>d0f2ca62-f564-447c-aa55-ce2aa12ea798</value> + <value>engine2_profile</value> + <value>0e57070e-2469-4b38-84a2-f111aaabd49d</value> + <null /> + </row> + <row> + <value>471b199e-9454-47a1-85dd-4461f665abc5</value> + <value>engine3_profile</value> + <value>0e57070e-2469-4b38-84a2-f111aaabd49d</value> + <null /> + </row> + <row> + <value>fd81f1e1-785b-4579-ab75-1419ebb87053</value> + <value>engine4_profile</value> + <value>0e57070e-2469-4b38-84a2-f111aaabd49d</value> + <value>ae956031-6be2-43d6-bb90-5191c9253317</value> + </row> + </table> + <table name="image_storage_domain_map"> <column>image_id</column> <column>storage_domain_id</column> diff --git a/packaging/dbscripts/cpu_profiles_sp.sql b/packaging/dbscripts/cpu_profiles_sp.sql new file mode 100644 index 0000000..e1c761f --- /dev/null +++ b/packaging/dbscripts/cpu_profiles_sp.sql @@ -0,0 +1,106 @@ +---------------------------------------------------------------------- +-- Cpu Profiles +---------------------------------------------------------------------- + +Create or replace FUNCTION GetCpuProfileByCpuProfileId(v_id UUID) +RETURNS SETOF cpu_profiles STABLE + AS $procedure$ +BEGIN + + RETURN QUERY SELECT * + FROM cpu_profiles + WHERE id = v_id; + +END; $procedure$ +LANGUAGE plpgsql; + + +Create or replace FUNCTION InsertCpuProfile(v_id UUID, + v_name VARCHAR(50), + v_cluster_id UUID, + v_qos_id UUID, + v_description TEXT) +RETURNS VOID + AS $procedure$ +BEGIN + + INSERT INTO cpu_profiles(id, name, cluster_id, qos_id, description) + VALUES(v_id, v_name, v_cluster_id, v_qos_id, v_description); + +END; $procedure$ +LANGUAGE plpgsql; + + +Create or replace FUNCTION UpdateCpuProfile(v_id UUID, + v_name VARCHAR(50), + v_cluster_id UUID, + v_qos_id UUID, + v_description TEXT) +RETURNS VOID + AS $procedure$ +BEGIN + + UPDATE cpu_profiles + SET id = v_id, name = v_name, cluster_id = v_cluster_id, qos_id = v_qos_id, + description = v_description, _update_date = LOCALTIMESTAMP + WHERE id = v_id; + +END; $procedure$ +LANGUAGE plpgsql; + + +Create or replace FUNCTION DeleteCpuProfile(v_id UUID) +RETURNS VOID + AS $procedure$ + DECLARE + v_val UUID; +BEGIN + + DELETE FROM cpu_profiles + WHERE id = v_id; + + -- Delete the cpu profiles permissions + DELETE FROM permissions WHERE object_id = v_id; + +END; $procedure$ +LANGUAGE plpgsql; + + +Create or replace FUNCTION GetAllFromCpuProfiles() +RETURNS SETOF cpu_profiles STABLE + AS $procedure$ +BEGIN + + RETURN QUERY SELECT * + FROM cpu_profiles; + +END; $procedure$ +LANGUAGE plpgsql; + + +Create or replace FUNCTION GetCpuProfilesByClusterId(v_cluster_id UUID, v_user_id UUID, v_is_filtered boolean) +RETURNS SETOF cpu_profiles STABLE + AS $procedure$ +BEGIN + + RETURN QUERY SELECT * + FROM cpu_profiles + WHERE cluster_id = v_cluster_id + AND (NOT v_is_filtered OR EXISTS (SELECT 1 + FROM user_vds_groups_permissions_view + WHERE user_id = v_user_id AND entity_id = v_cluster_id)); + +END; $procedure$ +LANGUAGE plpgsql; + + +Create or replace FUNCTION GetCpuProfilesByQosId(v_qos_id UUID) +RETURNS SETOF cpu_profiles STABLE + AS $procedure$ +BEGIN + + RETURN QUERY SELECT * + FROM cpu_profiles + WHERE qos_id = v_qos_id; +END; $procedure$ +LANGUAGE plpgsql; diff --git a/packaging/dbscripts/create_functions.sql b/packaging/dbscripts/create_functions.sql index 88ac01f..72d2593 100644 --- a/packaging/dbscripts/create_functions.sql +++ b/packaging/dbscripts/create_functions.sql @@ -150,6 +150,7 @@ Network = 20, VNICProfile = 27, DiskProfile = 29 + CpuProfile = 30 */ DECLARE v_entity_type int4 := v_object_type; @@ -162,6 +163,7 @@ v_storage_pool_id uuid; v_profile_network_id uuid; v_disk_profile_storage_id uuid; + v_cpu_profile_cluster_id uuid; BEGIN @@ -346,6 +348,26 @@ SELECT v_storage_pool_id AS id UNION SELECT v_disk_profile_storage_id AS id + UNION + SELECT v_entity_id AS id; + + WHEN v_entity_type = 30 THEN -- CpuProfile + + SELECT INTO v_cpu_profile_cluster_id + cpu_profiles.cluster_id + FROM cpu_profiles + WHERE cpu_profiles.id = v_entity_id; + SELECT INTO v_storage_pool_id + vds_groups.storage_pool_id + FROM vds_groups + WHERE vds_groups.vds_group_id = v_cpu_profile_cluster_id; + + RETURN QUERY + SELECT system_root_id AS id + UNION + SELECT v_storage_pool_id AS id + UNION + SELECT v_cpu_profile_cluster_id AS id UNION SELECT v_entity_id AS id; @@ -574,6 +596,7 @@ Network = 20, VNICProfile = 27, DiskProfile = 29 + CpuProfile = 30 */ DECLARE v_entity_type int4 := v_object_type; @@ -620,6 +643,8 @@ result := ( SELECT name FROM vnic_profiles where id = v_entity_id ); WHEN v_entity_type = 29 THEN result := ( SELECT name FROM disk_profiles where id = v_entity_id ); + WHEN v_entity_type = 30 THEN + result := ( SELECT name FROM cpu_profiles where id = v_entity_id ); ELSE result := 'Unknown type ' || v_entity_type; END CASE; diff --git a/packaging/dbscripts/upgrade/03_05_0980_add_cpu_profiles_table.sql b/packaging/dbscripts/upgrade/03_05_0980_add_cpu_profiles_table.sql new file mode 100644 index 0000000..d69fac1 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_05_0980_add_cpu_profiles_table.sql @@ -0,0 +1,19 @@ +--------------------------------------------------------------------- +-- table cpu_profiles +--------------------------------------------------------------------- +CREATE TABLE cpu_profiles +( + id UUID PRIMARY KEY, + name VARCHAR(50) NOT NULL, + cluster_id UUID NOT NULL, + qos_id UUID, + description TEXT, + _create_date TIMESTAMP WITH TIME ZONE default LOCALTIMESTAMP, + _update_date TIMESTAMP WITH TIME ZONE, + FOREIGN KEY (cluster_id) REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE, + FOREIGN KEY (qos_id) REFERENCES qos(id) ON DELETE SET NULL +) WITH OIDS; + +DROP INDEX IF EXISTS IDX_cpu_profiles_cluster_id; +CREATE INDEX IDX_cpu_profiles_cluster_id ON cpu_profiles(cluster_id); + diff --git a/packaging/dbscripts/upgrade/03_06_0980_add_cpu_limit_to_qos_table.sql b/packaging/dbscripts/upgrade/03_05_0990_add_cpu_limit_to_qos_table.sql similarity index 100% rename from packaging/dbscripts/upgrade/03_06_0980_add_cpu_limit_to_qos_table.sql rename to packaging/dbscripts/upgrade/03_05_0990_add_cpu_limit_to_qos_table.sql -- To view, visit http://gerrit.ovirt.org/31823 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9d3b9d4737d523a722a688485e45d2a77775e2ea Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches