ofri masad has uploaded a new change for review. Change subject: core: Add Vnic Profile support to RemoveNetworkQoS ......................................................................
core: Add Vnic Profile support to RemoveNetworkQoS When removing a NetworkQoS we must set all the Vnic Profiles which used that NetworkQoS to use null NetworkQoS. Added support for getting a list of all Vnic Profiles using a specific NetworkQoS from UI (in order to alert the user and show him a list) Change-Id: I401cff6b67b5fe62303323849f11bd9d03892201 Signed-off-by: Ofri Masad <oma...@redhat.com> --- A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllProfilesByNetworkQoSIdQuery.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveNetworkQoSCommand.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDao.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDaoDbFacadeImpl.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDao.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDaoDbFacadeImpl.java M packaging/dbscripts/network_sp.sql M pom.xml 9 files changed, 66 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/32/17932/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllProfilesByNetworkQoSIdQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllProfilesByNetworkQoSIdQuery.java new file mode 100644 index 0000000..9358e2b --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllProfilesByNetworkQoSIdQuery.java @@ -0,0 +1,16 @@ +package org.ovirt.engine.core.bll; + + +import org.ovirt.engine.core.common.queries.IdQueryParameters; + + +public class GetAllProfilesByNetworkQoSIdQuery<P extends IdQueryParameters> extends QueriesCommandBase<P> { + public GetAllProfilesByNetworkQoSIdQuery(P parameters) { + super(parameters); + } + + @Override + protected void executeQueryCommand() { + getQueryReturnValue().setReturnValue(getDbFacade().getVnicProfileViewDao().getAllForNetworkQoS(getParameters().getId())); + } +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveNetworkQoSCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveNetworkQoSCommand.java index 6ae2e2e..4dfbe52 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveNetworkQoSCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveNetworkQoSCommand.java @@ -27,6 +27,7 @@ @Override protected void executeCommand() { + getVnicProfileDao().removeNetworkQoS(getNetworkQoS().getId()); getNetworkQoSDao().remove(getNetworkQoS().getId()); getReturnValue().setActionReturnValue(getNetworkQoS().getId()); setSucceeded(true); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java index 749fac4..7f70fd5 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java @@ -271,6 +271,7 @@ //Network QoS GetAllNetworkQosByStoragePoolId, + GetAllProfilesByNetworkQoSId, GetWatchdog(VdcQueryAuthType.User), GetConsoleDevices(VdcQueryAuthType.User), diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDao.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDao.java index b63e929..bd12466 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDao.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileDao.java @@ -16,4 +16,11 @@ * @return the list of vnic profiles */ List<VnicProfile> getAllForNetwork(Guid networkId); + + /** + * Remove the QoS Id from all vnic profiles associated with the given network QoS. + * @param qosId + * the network QoS ID + */ + void removeNetworkQoS(Guid qosId); } 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 0320f71..da7f1df 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 @@ -76,4 +76,10 @@ return new VnicProfile(); } } + + @Override + public void removeNetworkQoS(Guid qosId) { + getCallsHandler().executeModification("UpdateNullQoSIdByNetworkQoSId", + getCustomMapSqlParameterSource().addValue("network_qos_id", qosId)); + } } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDao.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDao.java index d9c4bfb..742b8b9 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDao.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDao.java @@ -78,4 +78,13 @@ * @return the list of vnic profiles */ List<VnicProfileView> getAllForNetwork(Guid networkId, Guid userId, boolean filtered); + + + /** + * Retrieves all vnic profiles associated with the given network QoS. + * @param qosId + * the network QoS ID + * @return the list of vnic profiles + */ + List<VnicProfileView> getAllForNetworkQoS(Guid qosId); } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDaoDbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDaoDbFacadeImpl.java index 15fba98..14b3c74 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDaoDbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDaoDbFacadeImpl.java @@ -99,4 +99,11 @@ return new VnicProfileView(); } } + + @Override + public List<VnicProfileView> getAllForNetworkQoS(Guid qosId) { + return getCallsHandler().executeReadList("GetAllVnicProfileByNetworkQoSId", + VnicProfileViewRowMapper.INSTANCE, + getCustomMapSqlParameterSource().addValue("network_qos_id", qosId)); + } } diff --git a/packaging/dbscripts/network_sp.sql b/packaging/dbscripts/network_sp.sql index 395fdec..605fdef 100644 --- a/packaging/dbscripts/network_sp.sql +++ b/packaging/dbscripts/network_sp.sql @@ -1181,3 +1181,21 @@ WHERE user_id = v_user_id AND entity_id = vnic_profiles_view.id)); END; $procedure$ LANGUAGE plpgsql; + +Create or replace FUNCTION GetAllVnicProfileByNetworkQoSId(v_network_qos_id UUID) RETURNS SETOF vnic_profiles_view + AS $procedure$ +BEGIN +RETURN QUERY SELECT * + FROM vnic_profiles_view + WHERE network_qos_id = v_network_qos_id; +END; $procedure$ +LANGUAGE plpgsql; + +Create or replace FUNCTION UpdateNullQoSIdByNetworkQoSId(v_network_qos_id UUID) RETURNS VOID + AS $procedure$ +BEGIN + UPDATE vnic_profiles + SET network_qos_id = NULL + WHERE network_qos_id = v_network_qos_id; +END; $procedure$ +LANGUAGE plpgsql; diff --git a/pom.xml b/pom.xml index 1cfb242..646b77e 100644 --- a/pom.xml +++ b/pom.xml @@ -522,7 +522,7 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> - <version>${gwt.version}</version> + <version>2.4.0</version> </plugin> <plugin> -- To view, visit http://gerrit.ovirt.org/17932 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I401cff6b67b5fe62303323849f11bd9d03892201 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: ofri masad <oma...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches