Fabian Deutsch has uploaded a new change for review. Change subject: net: Use NM_CONTROLLED everywhere ......................................................................
net: Use NM_CONTROLLED everywhere Change-Id: Ic0e06c1945df132305d8bcc4fce5807d79d5e0d0 Signed-off-by: Fabian Deutsch <[email protected]> --- M src/ovirt/node/config/defaults.py M tests/nose/network_config.py 2 files changed, 66 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/66/28566/1 diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py index 17f8bc1..ad61cfa 100644 --- a/src/ovirt/node/config/defaults.py +++ b/src/ovirt/node/config/defaults.py @@ -365,6 +365,7 @@ vlan_cfg.device = vlan_ifname vlan_cfg.vlan = "yes" vlan_cfg.onboot = "yes" + vlan_cfg.nm_controlled = "no" if with_bridge: vlan_cfg.bridge = bridge_ifname else: @@ -384,6 +385,7 @@ bridge_cfg.device = bridge_ifname bridge_cfg.delay = "0" bridge_cfg.type = "Bridge" + bridge_cfg.nm_controlled = "no" bridge_cfg.save() nic_cfg.save() @@ -544,6 +546,7 @@ slave_cfg.slave = "yes" slave_cfg.master = bond["name"] slave_cfg.onboot = "yes" + slave_cfg.nm_controlled = "no" slave_cfg.save() class WriteMasterConfig(utils.Transaction.Element): @@ -554,6 +557,7 @@ cfg = NicConfig(bond["name"]) cfg.device = bond["name"] cfg.onboot = "yes" + cfg.nm_controlled = "no" cfg.type = "Bond" cfg.bonding_opts = bond["options"] diff --git a/tests/nose/network_config.py b/tests/nose/network_config.py index 58db17b..4d69e48 100644 --- a/tests/nose/network_config.py +++ b/tests/nose/network_config.py @@ -38,6 +38,7 @@ @patch.object(UdevNICInfo, "devtype") @patch.object(SysfsNICInfo, "hwaddr", "th:em:ac:ad:dr") @patch.object(AugeasWrapper, "_aug") + @patch.object(NIC, "ip_addresses", lambda s, x: {"inet": [s.ifname], "inet6": []}) class TestWrapperClass(cls): pass TestWrapperClass.__name__ = cls.__name__ @@ -116,6 +117,7 @@ [('BOOTPROTO', 'dhcp'), ('DELAY', '0'), ('DEVICE', 'breth0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('PEERNTP', 'yes'), ('TYPE', 'Bridge')]) @@ -153,6 +155,7 @@ ('GATEWAY', '192.168.122.1'), ('IPADDR', '192.168.122.42'), ('NETMASK', '255.255.255.0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('PEERNTP', 'yes'), ('TYPE', 'Bridge')]) @@ -167,6 +170,49 @@ assert nics.keys() == ["ens1"] assert type(nics["ens1"]) is BridgedNIC + + def test_tagged_dhcp(self, *args, **kwargs): + mt = defaults.NetworkLayout() + m = defaults.Network() + + m.configure_dhcp("p1p2", "42") + mt.configure_bridged() + + run_tx_by_name(m.transaction(), "WriteConfiguration") + + assert ifcfg_has_items("p1p2", + [('DEVICE', 'p1p2'), + ('HWADDR', 'th:em:ac:ad:dr'), + ('NM_CONTROLLED', 'no'), + ('ONBOOT', 'yes')]) + + assert ifcfg_has_items("p1p2.42", + [('BRIDGE', 'brp1p2'), + ('DEVICE', 'p1p2.42'), + ('NM_CONTROLLED', 'no'), + ('ONBOOT', 'yes'), + ('VLAN', 'yes')]) + + assert ifcfg_has_items("brp1p2", + [('BOOTPROTO', 'dhcp'), + ('DELAY', '0'), + ('DEVICE', 'brp1p2'), + ('NM_CONTROLLED', 'no'), + ('ONBOOT', 'yes'), + ('PEERNTP', 'yes'), + ('TYPE', 'Bridge')]) + + def test_tagged_dhcp_discovery(self, *args, **kwargs): + self.test_tagged_dhcp() + + nn = NodeNetwork() + nn.all_ifnames = lambda: ["p1p2"] + nics = nn.nics() + + print nics + bridge_nic = nics["p1p2"] + assert nics.keys() == ["p1p2"] + assert type(bridge_nic) is BridgedNIC @patch_common @@ -227,6 +273,7 @@ assert ifcfg_has_items("eth0.42", [('BOOTPROTO', 'dhcp'), ('DEVICE', 'eth0.42'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('PEERNTP', 'yes'), ('VLAN', 'yes')]) @@ -302,6 +349,7 @@ [('DEVICE', 'ens1'), ('HWADDR', 'th:em:ac:ad:dr'), ('MASTER', 'bond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('SLAVE', 'yes')]) @@ -309,6 +357,7 @@ [('DEVICE', 'ens2'), ('HWADDR', 'th:em:ac:ad:dr'), ('MASTER', 'bond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('SLAVE', 'yes')]) @@ -316,6 +365,7 @@ [('DEVICE', 'ens3'), ('HWADDR', 'th:em:ac:ad:dr'), ('MASTER', 'bond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('SLAVE', 'yes')]) @@ -353,6 +403,7 @@ [('DEVICE', 'ens1'), ('HWADDR', 'th:em:ac:ad:dr'), ('MASTER', 'bond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('SLAVE', 'yes')]) @@ -360,6 +411,7 @@ [('DEVICE', 'ens2'), ('HWADDR', 'th:em:ac:ad:dr'), ('MASTER', 'bond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('SLAVE', 'yes')]) @@ -367,6 +419,7 @@ [('DEVICE', 'ens3'), ('HWADDR', 'th:em:ac:ad:dr'), ('MASTER', 'bond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('SLAVE', 'yes')]) @@ -382,6 +435,7 @@ [('BOOTPROTO', 'dhcp'), ('DELAY', '0'), ('DEVICE', 'brbond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('PEERNTP', 'yes'), ('TYPE', 'Bridge')]) @@ -412,6 +466,7 @@ [('DEVICE', 'ens1'), ('HWADDR', 'th:em:ac:ad:dr'), ('MASTER', 'bond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('SLAVE', 'yes')]) @@ -419,6 +474,7 @@ [('DEVICE', 'ens2'), ('HWADDR', 'th:em:ac:ad:dr'), ('MASTER', 'bond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('SLAVE', 'yes')]) @@ -426,6 +482,7 @@ [('DEVICE', 'ens3'), ('HWADDR', 'th:em:ac:ad:dr'), ('MASTER', 'bond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('SLAVE', 'yes')]) @@ -439,6 +496,7 @@ assert ifcfg_has_items("bond0.42", [('BRIDGE', 'brbond0'), ('DEVICE', 'bond0.42'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('VLAN', 'yes')]) @@ -446,6 +504,7 @@ [('BOOTPROTO', 'dhcp'), ('DELAY', '0'), ('DEVICE', 'brbond0'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'), ('PEERNTP', 'yes'), ('TYPE', 'Bridge')]) @@ -508,12 +567,15 @@ assert ifcfgfilename("bond0") not in FakeFs.filemap assert ifcfg_has_items("ens1", [('DEVICE', 'ens1'), ('HWADDR', 'th:em:ac:ad:dr'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes')]) assert ifcfg_has_items("ens2", [('DEVICE', 'ens2'), ('HWADDR', 'th:em:ac:ad:dr'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes')]) assert ifcfg_has_items("ens3", [('DEVICE', 'ens3'), ('HWADDR', 'th:em:ac:ad:dr'), + ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes')]) def test_no_bond_and_clean_discovery(self, *args, **kwargs): -- To view, visit http://gerrit.ovirt.org/28566 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic0e06c1945df132305d8bcc4fce5807d79d5e0d0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Fabian Deutsch <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
