Alona Kaplan has uploaded a new change for review. Change subject: engine: adding 'passthrough' property to vnicProfile ......................................................................
engine: adding 'passthrough' property to vnicProfile The 'passthrough' property will indicate that a VF should be directly attached to the VM. Change-Id: I7ed7e63ad66aa2f5dc7584c96202a5f0c1ab1522 Signed-off-by: Alona Kaplan <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VnicProfile.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDaoDbFacadeImpl.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/network/VnicProfileDaoTest.java M backend/manager/modules/dal/src/test/resources/fixtures.xml M packaging/dbscripts/create_views.sql M packaging/dbscripts/network_sp.sql A packaging/dbscripts/upgrade/03_06_0840_add_passthrough_to_vnic_profiles.sql 8 files changed, 53 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/37719/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VnicProfile.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VnicProfile.java index 0ef2ed5..af5bd43 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VnicProfile.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VnicProfile.java @@ -30,6 +30,7 @@ private Guid networkQosId; private boolean portMirroring; + private boolean passthrough; private String description; private Map<String, String> customProperties; @@ -58,6 +59,14 @@ public void setPortMirroring(boolean portMirroring) { this.portMirroring = portMirroring; + } + + public boolean isPassthrough() { + return passthrough; + } + + public void setPassthrough(boolean passthrough) { + this.passthrough = passthrough; } public Map<String, String> getCustomProperties() { @@ -106,6 +115,7 @@ result = prime * result + ((getNetworkId() == null) ? 0 : getNetworkId().hashCode()); result = prime * result + ((getNetworkQosId() == null) ? 0 : getNetworkQosId().hashCode()); result = prime * result + (isPortMirroring() ? 1231 : 1237); + result = prime * result + (isPassthrough() ? 1231 : 1237); result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode()); return result; } @@ -140,6 +150,9 @@ if (isPortMirroring() != other.isPortMirroring()) { return false; } + if (isPassthrough() != other.isPassthrough()) { + return false; + } if (!ObjectUtils.objectsEqual(getDescription(), other.getDescription())) { return false; } @@ -158,6 +171,8 @@ .append(getNetworkQosId()) .append(", portMirroring=") .append(isPortMirroring()) + .append(", passthrough=") + .append(isPassthrough()) .append(", customProperties=") .append(getCustomProperties()) .append(", description=") diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDaoDbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDaoDbFacadeImpl.java index 33b191a..ff76022 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDaoDbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDaoDbFacadeImpl.java @@ -32,6 +32,7 @@ .addValue("network_id", profile.getNetworkId()) .addValue("network_qos_id", profile.getNetworkQosId()) .addValue("port_mirroring", profile.isPortMirroring()) + .addValue("passthrough", profile.isPassthrough()) .addValue("description", profile.getDescription()) .addValue("custom_properties", SerializationFactory.getSerializer().serialize(profile.getCustomProperties())); @@ -60,6 +61,7 @@ entity.setCustomProperties(SerializationFactory.getDeserializer() .deserializeOrCreateNew(rs.getString("custom_properties"), LinkedHashMap.class)); entity.setPortMirroring(rs.getBoolean("port_mirroring")); + entity.setPassthrough(rs.getBoolean("passthrough")); entity.setDescription(rs.getString("description")); return entity; } 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 59ed6b7..63ebde4 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 @@ -523,6 +523,7 @@ * <li>name: engine_profile</li> * <li>network_id: 58d5c1c6-cb15-4832-b2a4-023770607188</li> * <li>port_mirroring: false</li> + * <li>passthrough: false</li> * </ul> */ public static final Guid VM_NETWORK_INTERFACE_PROFILE = new Guid("fd81f1e1-785b-4579-ab75-1419ebb87052"); @@ -537,6 +538,9 @@ */ public static final Guid VM_NETWORK_INTERFACE_PM_PROFILE = new Guid("a667da39-27b0-47ec-a5fa-d4293a62b222"); + public static final Guid VM_NETWORK_INTERFACE_PASSTHROUGH_PROFILE = + new Guid("d0f2ca62-f564-447c-aa55-ce2aa12ea798"); + public static final Guid VM_NETWORK_INTERFACE_PROFILE_NOT_USED = new Guid("2b75e023-a1fb-4dcb-9738-0ec7fe2d51c6"); public static final Guid NETWORK_QOS = new Guid("de956031-6be2-43d6-bb90-5191c9253314"); diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/network/VnicProfileDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/network/VnicProfileDaoTest.java index 2189911..93fa33c 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/network/VnicProfileDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/network/VnicProfileDaoTest.java @@ -30,6 +30,7 @@ vnicProfile.setNetworkId(FixturesTool.NETWORK_ENGINE); vnicProfile.setNetworkQosId(FixturesTool.NETWORK_QOS); vnicProfile.setPortMirroring(false); + vnicProfile.setPassthrough(false); } /** @@ -52,6 +53,7 @@ assertNotNull(result); assertEquals(FixturesTool.VM_NETWORK_INTERFACE_PROFILE, result.getId()); assertEquals(false, result.isPortMirroring()); + assertEquals(false, result.isPassthrough()); } /** @@ -64,6 +66,20 @@ assertNotNull(result); assertEquals(FixturesTool.VM_NETWORK_INTERFACE_PM_PROFILE, result.getId()); assertEquals(true, result.isPortMirroring()); + } + + /** + * Ensures that the network interface profile is returned. + */ + @Test + public void testGetWithPassthrough() { + VnicProfile result = dao + .get(FixturesTool.VM_NETWORK_INTERFACE_PASSTHROUGH_PROFILE); + + assertNotNull(result); + assertEquals(FixturesTool.VM_NETWORK_INTERFACE_PASSTHROUGH_PROFILE, + result.getId()); + assertEquals(true, result.isPassthrough()); } /** @@ -120,6 +136,7 @@ assertNotNull(result); assertEquals(vnicProfile.getId(), result.getId()); assertEquals(false, result.isPortMirroring()); + assertEquals(false, result.isPassthrough()); } /** @@ -129,11 +146,13 @@ public void testUpdate() { dao.save(vnicProfile); vnicProfile.setPortMirroring(true); + vnicProfile.setPassthrough(true); dao.update(vnicProfile); VnicProfile result = dao.get(vnicProfile.getId()); assertNotNull(result); assertEquals(vnicProfile.getId(), result.getId()); assertEquals(true, result.isPortMirroring()); + assertEquals(true, result.isPassthrough()); } /** diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index 5f01f55..3c96196 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -1569,6 +1569,7 @@ <column>network_id</column> <column>network_qos_id</column> <column>port_mirroring</column> + <column>passthrough</column> <column>custom_properties</column> <column>description</column> <column>_create_date</column> @@ -1578,6 +1579,7 @@ <value>engine_profile</value> <value>58d5c1c6-cb15-4832-b2a4-023770607188</value> <value>de956031-6be2-43d6-bb90-5191c9253314</value> + <value>false</value> <value>false</value> <value>{ "prop1" : "true", "prop2" : "123456" }</value> <value>vnic profile description</value> @@ -1590,6 +1592,7 @@ <value>58d5c1c6-cb15-4832-b2a4-023770607188</value> <value>de956031-6be2-43d6-bb90-5191c9253315</value> <value>true</value> + <value>false</value> <null /> <null /> <value>2013-07-02 08:38:36</value> @@ -1601,6 +1604,7 @@ <value>58d5c1c6-cb15-4832-b2a4-023770607189</value> <null /> <value>false</value> + <value>true</value> <value>{ "prop1" : "true", "prop2" : "123456" }</value> <value>2013-07-02 08:38:36</value> <value>2013-07-02 08:38:36</value> @@ -1611,6 +1615,7 @@ <value>58d5c1c6-cb15-4832-b2a4-023770607190</value> <null /> <value>false</value> + <value>false</value> <value>{ "prop1" : "true" }</value> <value>2013-07-02 08:38:36</value> <value>2013-07-02 08:38:36</value> @@ -1621,6 +1626,7 @@ <value>58d5c1c6-cb15-4832-b2a4-023770607191</value> <value>de956031-6be2-43d6-bb90-5191c9253314</value> <value>false</value> + <value>false</value> <value>{}</value> <value>2013-07-02 08:38:36</value> <value>2013-07-02 08:38:36</value> diff --git a/packaging/dbscripts/create_views.sql b/packaging/dbscripts/create_views.sql index 3311f6d..80638e4 100644 --- a/packaging/dbscripts/create_views.sql +++ b/packaging/dbscripts/create_views.sql @@ -1328,6 +1328,7 @@ vnic_profiles.network_id as network_id, vnic_profiles.network_qos_id as network_qos_id, vnic_profiles.port_mirroring as port_mirroring, + vnic_profiles.passthrough as passthrough, vnic_profiles.custom_properties as custom_properties, vnic_profiles.description as description, network.name as network_name, diff --git a/packaging/dbscripts/network_sp.sql b/packaging/dbscripts/network_sp.sql index c6ad01e..e3fb1fe 100644 --- a/packaging/dbscripts/network_sp.sql +++ b/packaging/dbscripts/network_sp.sql @@ -1123,14 +1123,15 @@ v_network_id UUID, v_network_qos_id UUID, v_port_mirroring BOOLEAN, + v_passthrough BOOLEAN, v_custom_properties TEXT, v_description TEXT) RETURNS VOID AS $procedure$ BEGIN - INSERT INTO vnic_profiles(id, name, network_id, network_qos_id, port_mirroring, custom_properties, description) - VALUES(v_id, v_name, v_network_id, v_network_qos_id, v_port_mirroring, v_custom_properties, v_description); + INSERT INTO vnic_profiles(id, name, network_id, network_qos_id, port_mirroring, passthrough, custom_properties, description) + VALUES(v_id, v_name, v_network_id, v_network_qos_id, v_port_mirroring, v_passthrough, v_custom_properties, v_description); END; $procedure$ LANGUAGE plpgsql; @@ -1141,6 +1142,7 @@ v_network_id UUID, v_network_qos_id UUID, v_port_mirroring BOOLEAN, + v_passthrough BOOLEAN, v_custom_properties TEXT, v_description TEXT) RETURNS VOID @@ -1149,7 +1151,7 @@ UPDATE vnic_profiles SET id = v_id, name = v_name, network_id = v_network_id, network_qos_id = v_network_qos_id, - port_mirroring = v_port_mirroring, custom_properties = v_custom_properties, + port_mirroring = v_port_mirroring, passthrough = v_passthrough, custom_properties = v_custom_properties, description = v_description,_update_date = LOCALTIMESTAMP WHERE id = v_id; diff --git a/packaging/dbscripts/upgrade/03_06_0840_add_passthrough_to_vnic_profiles.sql b/packaging/dbscripts/upgrade/03_06_0840_add_passthrough_to_vnic_profiles.sql new file mode 100644 index 0000000..f4e9325 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_0840_add_passthrough_to_vnic_profiles.sql @@ -0,0 +1 @@ +select fn_db_add_column('vnic_profiles', 'passthrough', 'boolean default FALSE NOT NULL'); -- To view, visit http://gerrit.ovirt.org/37719 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7ed7e63ad66aa2f5dc7584c96202a5f0c1ab1522 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
