示例#1
0
文件: defaults.py 项目: oVirt/Node
            def __write_bridged_config(self):
                m = Network().retrieve()

                # Bridge
                bridge_ifname = "br%s" % m["iface"]
                bridge_cfg = NicConfig(bridge_ifname)
                self.__assign_common(bridge_cfg)
                bridge_cfg.device = bridge_ifname
                bridge_cfg.delay = "0"
                bridge_cfg.type = "Bridge"

                # Now the slave
                slave_ifname_vlan = "%s.%s" % (m["iface"],
                                               m["vlanid"])
                slave_ifname = slave_ifname_vlan if m["vlanid"] else m["iface"]
                slave_cfg = NicConfig(slave_ifname)
                slave_cfg.device = m["iface"]
                slave_cfg.device = slave_ifname
                slave_cfg.bridge = bridge_ifname
                slave_cfg.hwaddr = NIC(m["iface"]).hwaddr
                slave_cfg.vlan = "yes" if m["vlanid"] else None
                slave_cfg.onboot = "yes"

                # save()includes persisting
                bridge_cfg.save()
                slave_cfg.save()
示例#2
0
文件: defaults.py 项目: oVirt/Node
            def commit(self):
                if bond["options"]:
                    cfg = NicConfig(bond["name"])
                    cfg.device = bond["name"]
                    cfg.onboot = "yes"
                    cfg.bonding_opts = bond["options"]

                    cfg.save()
示例#3
0
文件: defaults.py 项目: oVirt/Node
            def commit(self):
                m = Network().retrieve()
                if m["iface"] in bond["slaves"]:
                    raise RuntimeError("Bond slave can not be used as " +
                                       "primary device")

                for slave in bond["slaves"]:
                    slave_cfg = NicConfig(slave)
                    slave_cfg.device = slave
                    slave_cfg.slave = "yes"
                    slave_cfg.master = bond["name"]
                    slave_cfg.onboot = "yes"
                    slave_cfg.save()
示例#4
0
文件: defaults.py 项目: oVirt/Node
            def __write_direct_config(self):
                m = Network().retrieve()

                nic_ifname_vlan = "%s.%s" % (m["iface"],
                                             m["vlanid"])
                nic_ifname = nic_ifname_vlan if m["vlanid"] \
                    else m["iface"]
                nic_cfg = NicConfig(nic_ifname)
                nic_cfg.device = nic_ifname
                self.__assign_common(nic_cfg)
                nic_cfg.hwaddr = NIC(m["iface"]).hwaddr

                nic_cfg.save()