Mike Kolesnik has uploaded a new change for review. Change subject: engine: Update network referencing only attached clusters ......................................................................
engine: Update network referencing only attached clusters Changed the query to be of the cluster attachments of the network, since what we're interested in is only the clusters that are attached to the network, both for checking VMs and for changing the network status. Change-Id: I54a7ea672c1686f1a11f20ad06e076c84a7b1190 Signed-off-by: Mike Kolesnik <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java 1 file changed, 11 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/47/10647/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java index 288098c..c603205 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java @@ -6,9 +6,9 @@ import org.ovirt.engine.core.bll.network.cluster.NetworkClusterHelper; import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters; -import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VmStatic; import org.ovirt.engine.core.common.businessentities.network.Network; +import org.ovirt.engine.core.common.businessentities.network.NetworkCluster; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.common.validation.group.UpdateEntity; @@ -18,7 +18,7 @@ @SuppressWarnings("serial") public class UpdateNetworkCommand<T extends AddNetworkStoragePoolParameters> extends NetworkCommon<T> { - private List<VDSGroup> clusters; + private List<NetworkCluster> clusterAttachments; public UpdateNetworkCommand(T parameters) { super(parameters); @@ -28,8 +28,8 @@ protected void executeCommand() { getNetworkDAO().update(getNetwork()); - for (VDSGroup cluster : getClusters()) { - NetworkClusterHelper.setStatus(cluster.getId(), getNetwork()); + for (NetworkCluster clusterAttachment : getClusterAttachments()) { + NetworkClusterHelper.setStatus(clusterAttachment.getClusterId(), getNetwork()); } setSucceeded(true); } @@ -99,12 +99,12 @@ return super.getValidationGroups(); } - private List<VDSGroup> getClusters() { - if (clusters == null) { - clusters = getVdsGroupDAO().getAllForStoragePool(getStoragePool().getId()); + private List<NetworkCluster> getClusterAttachments() { + if (clusterAttachments == null) { + clusterAttachments = getNetworkClusterDAO().getAllForNetwork(getNetwork().getId()); } - return clusters; + return clusterAttachments; } private Network getNetworkById(List<Network> networks) { @@ -146,8 +146,9 @@ private ValidationResult networkNotUsedByRunningVm() { String networkName = getNetworkName(); - for (VDSGroup cluster : getClusters()) { - List<VmStatic> vms = getVmStaticDAO().getAllByGroupAndNetworkName(cluster.getId(), networkName); + for (NetworkCluster clusterAttachment : getClusterAttachments()) { + List<VmStatic> vms = + getVmStaticDAO().getAllByGroupAndNetworkName(clusterAttachment.getClusterId(), networkName); if (vms.size() > 0) { return new ValidationResult(VdcBllMessages.NETWORK_INTERFACE_IN_USE_BY_VM); } -- To view, visit http://gerrit.ovirt.org/10647 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I54a7ea672c1686f1a11f20ad06e076c84a7b1190 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Mike Kolesnik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
