Mike Kolesnik has posted comments on this change.
Change subject: engine: Prevent networks with different MTU (#852052)
......................................................................
Patch Set 1: (7 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetupNetworksHelper.java
Line 141: String nameWithoutVlanId =
NetworkUtils.StripVlan(iface.getName());
Line 142: List<Network> networks = new ArrayList<Network>();
Line 143: for (VdsNetworkInterface tmp : params.getInterfaces()) {
Line 144: if
(NetworkUtils.StripVlan(tmp.getName()).equals(nameWithoutVlanId) &&
tmp.getNetworkName() != null) {
Line 145: if
(existingClusterNetworks.containsKey(tmp.getNetworkName())) {
Should call getExistingClusterNetworks()
Line 146:
networks.add(existingClusterNetworks.get(tmp.getNetworkName()));
Line 147: }
Line 148: }
Line 149: }
Line 142: List<Network> networks = new ArrayList<Network>();
Line 143: for (VdsNetworkInterface tmp : params.getInterfaces()) {
Line 144: if
(NetworkUtils.StripVlan(tmp.getName()).equals(nameWithoutVlanId) &&
tmp.getNetworkName() != null) {
Line 145: if
(existingClusterNetworks.containsKey(tmp.getNetworkName())) {
Line 146:
networks.add(existingClusterNetworks.get(tmp.getNetworkName()));
same
Line 147: }
Line 148: }
Line 149: }
Line 150: return networks;
....................................................
File
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/SetupNetworksHelperTest.java
Line 658: public void networkWithTheSameMTUAddedToNic() {
Line 659: Network net = createNetwork("nonVmMtu9000");
Line 660: net.setVmNetwork(false);
Line 661: net.setMtu(9000);
Line 662: Network newNet = createNetwork("vLanVmMtu9000");
Should also set vlanId?
Line 663: newNet.setMtu(9000);
Line 664: mockExistingNetworks(net, newNet);
Line 665:
Line 666: VdsNetworkInterface nic = createNic("nic0", net.getName());
Line 662: Network newNet = createNetwork("vLanVmMtu9000");
Line 663: newNet.setMtu(9000);
Line 664: mockExistingNetworks(net, newNet);
Line 665:
Line 666: VdsNetworkInterface nic = createNic("nic0", net.getName());
You can use createNicSyncedWithNetwork
Line 667: nic.setBridged(false);
Line 668: mockExistingIfaces(nic);
Line 669:
Line 670: SetupNetworksHelper helper = createHelper(
Line 673: validateAndExpectNoViolations(helper);
Line 674: }
Line 675:
Line 676: @Test
Line 677: public void networkWithDifferentMTUAddedToNic() {
Same remarks as previous test.
Line 678: Network net = createNetwork("nonVmMtu5000");
Line 679: net.setVmNetwork(false);
Line 680: net.setMtu(5000);
Line 681: Network newNet = createNetwork("vLanVmMtu9000");
Line 691:
Line 692: validateAndExpectViolation(helper,
VdcBllMessages.NETWORK_MTU_DIFFERENCES,
Line 693: String.format("[%s(%d), %s(%d)]", net.getName(),
net.getMtu(), newNet.getName(), newNet.getMtu()));
Line 694: }
Line 695:
Please add tests for MTU 0.
Also, these tests only check that interface existed with the network, what
about attaching 2 new interfaces and see if it succeeds/fails?
Also, you can check if the existing network is VLAN and you try attach a non-VM
network to the same NIC.
Line 696: /* --- Tests for General Violations --- */
Line 697:
Line 698: @Test
Line 699: public void violationAppearsTwice() {
....................................................
File backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
Line 431: NETWORKS_DONT_EXIST_IN_CLUSTER=Cannot ${action} ${type}. The
following Logical Networks don't exist in the Host's Cluster:
${NETWORKS_DONT_EXIST_IN_CLUSTER_LIST}.
Line 432: NETWORK_BONDS_INVALID_SLAVE_COUNT=Cannot ${action} ${type}. The
following Bonds consist of less than two Network Interfaces:
${NETWORK_BONDS_INVALID_SLAVE_COUNT_LIST}.
Line 433: NETWORK_CANNOT_DETACH_NETWORK_USED_BY_VMS=Cannot ${action} ${type}.
The following VMs are actively using the Logical Network:
${NETWORK_CANNOT_DETACH_NETWORK_USED_BY_VMS_LIST}. Please stop the VMs and try
again.
Line 434: NON_VM_NETWORK_CANNOT_SUPPORT_STP=Cannot ${action} ${type}. STP can
only be enabled on VM Networks.
Line 435: NETWORK_MTU_DIFFERENCES=Cannot ${action} ${type}. The following
Logical Networks don't have the same MTU value: ${NETWORK_MTU_DIFFERENCES_LIST}.
I think the message is too general, perhaps it should state that you can't have
different MTU from the non-VM network on the NIC.
Line 436: CANNOT_PREIEW_CURRENT_IMAGE=The currently used VM Snapshot Image
cannot be used in Preview command.
Line 437: CONFIG_UNKNOWN_KEY=Illegal configuration entry.\n\
Line 438: -Please check configuration entry name.
Line 439: TAGS_SPECIFIED_TAG_CANNOT_BE_THE_PARENT_OF_ITSELF=Operation canceled,
recursive Tag hierarchy cannot be defined.
--
To view, visit http://gerrit.ovirt.org/7661
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I69f5c5f515d782c0311fd7fe458408ed634c1c83
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <[email protected]>
Gerrit-Reviewer: Livnat Peer <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Muli Salem <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches