Alona Kaplan has uploaded a new change for review. Change subject: webadmin: [Labels] SetupNetwork emphasize unconfigured interface ......................................................................
webadmin: [Labels] SetupNetwork emphasize unconfigured interface Network which is in fact not attached to the interface (but has the same label as the interface) looks like attached in Setup Networks dialog. Change-Id: Ifa83ddfd2ceddc8f2227dcc8cc36c721baf8c7bc Bug-Url: https://bugzilla.redhat.com/1067928 Bug-Url: https://bugzilla.redhat.com/1065270 Signed-off-by: Alona Kaplan <alkap...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/ItemInfoPopup.java 5 files changed, 32 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/24975/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java index 193e4d4..bda9ef8 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationMessages.java @@ -150,4 +150,7 @@ @DefaultMessage("Hot set CPUs by changing the number of sockets." + " The support for hot plug/unplug CPUs to the guest varies.") String hotPlugUnplugCpuWarning(); + + @DefaultMessage("This network should be attached to nic ''{0}'' but it has conflict with another network on this nic.") + String networkLabelConflict(String nicName); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java index 83b9952..b234208 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java @@ -6,6 +6,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -717,9 +718,18 @@ NetworkLabelModel labelModel = networkLabelMap.get(label); if (labelModel != null) { // attach label networks to nic - for (LogicalNetworkModel networkModel : labelModel.getNetworks()) { - nicToNetwork.get(ifName).add(networkModel); - networkModel.attachViaLabel(); + for (Iterator<LogicalNetworkModel> iter = labelModel.getNetworks().iterator(); iter.hasNext();) { + LogicalNetworkModel networkModel = iter.next(); + + if (nicToNetwork.get(ifName).contains(networkModel)) { + networkModel.attachViaLabel(); + } else { + // The network has the same label as the nic but not attached to the nic. + // It means this network couldn't be attached to the nic + // because it has a conflict with the other networks on the nic. + iter.remove(); + networkModel.setErrorNicName(ifName); + } } // attach label itself to nic diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java index 01b8e75..8609b33 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java @@ -20,6 +20,8 @@ private boolean selected; private boolean management; private boolean attachedViaLabel; + private String errorNicName; // Contains the name of the nic with the same label of the network + // in case the network is not attached to the nic due to a conflict private NetworkInterfaceModel attachedToNic; private NetworkInterfaceModel vlanNic; @@ -213,6 +215,14 @@ attachedViaLabel = true; } + public String getErrorNicName() { + return errorNicName; + } + + public void setErrorNicName(String errorNicName) { + this.errorNicName = errorNicName; + } + public boolean isManagement() { return management; } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java index ce98957..0d1e54f 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java @@ -182,7 +182,7 @@ for (LogicalNetworkModel network : allNetworks) { if (network.getEntity().isExternal()) { dynamicNetworkPanels.add(new ExternalNetworkPanel(network, style)); - } else if (!network.isAttached() && !network.isAttachedViaLabel()) { + } else if (!network.isAttached()) { staticNetworkPanels.add(new InternalNetworkPanel(network, style)); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/ItemInfoPopup.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/ItemInfoPopup.java index 112383f..5444984 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/ItemInfoPopup.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/ItemInfoPopup.java @@ -9,6 +9,7 @@ import org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel; import org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkItemModel; import org.ovirt.engine.ui.webadmin.ApplicationConstants; +import org.ovirt.engine.ui.webadmin.ApplicationMessages; import org.ovirt.engine.ui.webadmin.ApplicationResources; import org.ovirt.engine.ui.webadmin.ApplicationTemplates; import org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider; @@ -26,6 +27,7 @@ private final ApplicationConstants constants = ClientGinjectorProvider.getApplicationConstants(); private final ApplicationTemplates templates = ClientGinjectorProvider.getApplicationTemplates(); final ApplicationResources resources = ClientGinjectorProvider.getApplicationResources(); + private final ApplicationMessages messages = ClientGinjectorProvider.getApplicationMessages(); SafeHtml mgmtNetworkImage = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.mgmtNetwork()) .getHTML()); SafeHtml vmImage = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.networkVm()).getHTML()); @@ -78,6 +80,9 @@ addRow(SafeHtmlUtils.fromString(constants.unmanagedNetworkDescriptionItemInfo())); } else { + if (networkModel.getErrorNicName() != null){ + addRow(SafeHtmlUtils.fromString(messages.networkLabelConflict(networkModel.getErrorNicName()))); + } // Description if (entity.getDescription() != null && !entity.getDescription().trim().equals("")) { //$NON-NLS-1$ addRow(SafeHtmlUtils.fromString(entity.getDescription())); -- To view, visit http://gerrit.ovirt.org/24975 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifa83ddfd2ceddc8f2227dcc8cc36c721baf8c7bc Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <alkap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches