Ejemplo n.º 1
0
            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()
Ejemplo n.º 2
0
            def commit(self):
                net = Network()
                mnet = net.retrieve()
                if mnet["iface"] and mnet["iface"].startswith("bond"):
                    net.configure_no_networking()

                for ifname in NicConfig.list():
                    cfg = NicConfig(ifname)
                    if cfg.master:
                        self.logger.debug("Removing master from %s" % ifname)
                        cfg.master = None
                        cfg.slave = None
                        cfg.save()
                    elif ifname.startswith("bond"):
                        self.logger.debug("Removing master %s" % ifname)
                        cfg.delete()

                Bonds().delete_all()