Exemplo n.º 1
0
            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()
Exemplo n.º 2
0
            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()