diff --git a/doc/config_options.txt b/doc/config_options.txt index 0952b0db4d57..6d6811326544 100644 --- a/doc/config_options.txt +++ b/doc/config_options.txt @@ -449,20 +449,6 @@ Specify an integer between 0 and 10. The higher the value, the less likely the instance is to be swapped to disk. ``` -````{config:option} limits.network.priority instance-resource-limits -:defaultdesc: "`0` (minimum)" -:liveupdate: "yes" -:shortdesc: "Priority of the instance's network requests" -:type: "integer" -```{important} -This option is deprecated. Use the per-NIC `limits.priority` option instead. -``` - -Controls how much priority to give to the instance's network requests when under load. - -Specify an integer between 0 and 10. -```` - ```{config:option} limits.processes instance-resource-limits :condition: "container" :defaultdesc: "empty" diff --git a/lxd/cgroup/abstraction.go b/lxd/cgroup/abstraction.go index ce582dd4be76..315f0b5fc206 100644 --- a/lxd/cgroup/abstraction.go +++ b/lxd/cgroup/abstraction.go @@ -746,21 +746,6 @@ func (cg *CGroup) SetCPUCfsLimit(limitPeriod int64, limitQuota int64) error { return ErrUnknownVersion } -// SetNetIfPrio sets the priority for the process. -func (cg *CGroup) SetNetIfPrio(limit string) error { - version := cgControllers["net_prio"] - switch version { - case Unavailable: - return ErrControllerMissing - case V1: - return cg.rw.Set(version, "net_prio", "net_prio.ifpriomap", limit) - case V2: - return ErrControllerMissing - } - - return ErrUnknownVersion -} - // SetHugepagesLimit applies a limit to the number of processes. func (cg *CGroup) SetHugepagesLimit(pageType string, limit int64) error { version := cgControllers["hugetlb"] diff --git a/lxd/devices.go b/lxd/devices.go index 1e9875f4a823..9f48f0df32c1 100644 --- a/lxd/devices.go +++ b/lxd/devices.go @@ -623,39 +623,6 @@ func deviceTaskBalance(s *state.State) { } } -func deviceNetworkPriority(s *state.State, netif string) { - // Don't bother running when CGroup support isn't there - if !s.OS.CGInfo.Supports(cgroup.NetPrio, nil) { - return - } - - instances, err := instance.LoadNodeAll(s, instancetype.Container) - if err != nil { - return - } - - for _, c := range instances { - // Extract the current priority - networkPriority := c.ExpandedConfig()["limits.network.priority"] - if networkPriority == "" { - continue - } - - networkInt, err := strconv.Atoi(networkPriority) - if err != nil { - continue - } - - // Set the value for the new interface - cg, err := c.CGroup() - if err != nil { - continue - } - - _ = cg.SetNetIfPrio(fmt.Sprintf("%s %d", netif, networkInt)) - } -} - // deviceEventListener starts the event listener for resource scheduling. // Accepts stateFunc which will be called each time it needs a fresh state.State. func deviceEventListener(stateFunc func() *state.State) { @@ -695,7 +662,6 @@ func deviceEventListener(stateFunc func() *state.State) { } logger.Debugf("Scheduler: network: %s has been added: updating network priorities", e[0]) - deviceNetworkPriority(s, e[0]) err = networkAutoAttach(s.DB.Cluster, e[0]) if err != nil { logger.Warn("Failed to auto-attach network", logger.Ctx{"err": err}) diff --git a/lxd/instance/drivers/driver_lxc.go b/lxd/instance/drivers/driver_lxc.go index 4e939d0e11df..dce014c6493c 100644 --- a/lxd/instance/drivers/driver_lxc.go +++ b/lxd/instance/drivers/driver_lxc.go @@ -2549,17 +2549,6 @@ func (d *lxc) onStart(_ map[string]string) error { // Trigger a rebalance cgroup.TaskSchedulerTrigger("container", d.name, "started") - // Apply network priority - if d.expandedConfig["limits.network.priority"] != "" { - go func(d *lxc) { - d.fromHook = false - err := d.setNetworkPriority() - if err != nil { - d.logger.Error("Failed to apply network priority", logger.Ctx{"err": err}) - } - }(d) - } - // Record last start state. err = d.recordLastState() if err != nil { @@ -4623,11 +4612,6 @@ func (d *lxc) Update(args db.InstanceArgs, userRequested bool) error { } } } - } else if key == "limits.network.priority" { - err := d.setNetworkPriority() - if err != nil { - return err - } } else if key == "limits.cpu" || key == "limits.cpu.nodes" { // Trigger a scheduler re-run cgroup.TaskSchedulerTrigger("container", d.name, "changed") @@ -7958,66 +7942,6 @@ func (d *lxc) removeDiskDevices() error { return nil } -// Network I/O limits. -func (d *lxc) setNetworkPriority() error { - // Load the go-lxc struct. - cc, err := d.initLXC(false) - if err != nil { - return err - } - - // Load the cgroup struct. - cg, err := d.cgroup(cc, true) - if err != nil { - return err - } - - // Check that the container is running - if d.InitPID() <= 0 { - return fmt.Errorf("Can't set network priority on stopped container") - } - - // Don't bother if the cgroup controller doesn't exist - if !d.state.OS.CGInfo.Supports(cgroup.NetPrio, cg) { - return nil - } - - // Extract the current priority - networkPriority := d.expandedConfig["limits.network.priority"] - if networkPriority == "" { - networkPriority = "0" - } - - networkInt, err := strconv.Atoi(networkPriority) - if err != nil { - return err - } - - // Get all the interfaces - netifs, err := net.Interfaces() - if err != nil { - return err - } - - // Check that we at least succeeded to set an entry - success := false - var lastError error - for _, netif := range netifs { - err = cg.SetNetIfPrio(fmt.Sprintf("%s %d", netif.Name, networkInt)) - if err == nil { - success = true - } else { - lastError = err - } - } - - if !success { - return fmt.Errorf("Failed to set network device priority: %s", lastError) - } - - return nil -} - // IsFrozen returns if instance is frozen. func (d *lxc) IsFrozen() bool { return d.statusCode() == api.Frozen diff --git a/lxd/metadata/configuration.json b/lxd/metadata/configuration.json index 22e4065a8a37..9a829c564f33 100644 --- a/lxd/metadata/configuration.json +++ b/lxd/metadata/configuration.json @@ -466,15 +466,6 @@ "type": "integer" } }, - { - "limits.network.priority": { - "defaultdesc": "`0` (minimum)", - "liveupdate": "yes", - "longdesc": "```{important}\nThis option is deprecated. Use the per-NIC `limits.priority` option instead.\n```\n\nControls how much priority to give to the instance's network requests when under load.\n\nSpecify an integer between 0 and 10.", - "shortdesc": "Priority of the instance's network requests", - "type": "integer" - } - }, { "limits.processes": { "condition": "container", diff --git a/scripts/bash/lxd-client b/scripts/bash/lxd-client index 8c45eb3138df..7c3821ddb555 100644 --- a/scripts/bash/lxd-client +++ b/scripts/bash/lxd-client @@ -101,7 +101,7 @@ _have lxc && { limits.cpu limits.cpu.allowance limits.cpu.priority \ limits.disk.priority limits.memory limits.memory.enforce \ limits.memory.hugepages limits.kernel \ - limits.memory.swap limits.memory.swap.priority limits.network.priority \ + limits.memory.swap limits.memory.swap.priority \ limits.processes linux.kernel_modules migration.incremental.memory \ migration.incremental.memory.goal nvidia.runtime \ nvidia.driver.capabilities nvidia.require.cuda nvidia.require.driver \ diff --git a/shared/instance.go b/shared/instance.go index 8372a4fdddda..f1111f809ba2 100644 --- a/shared/instance.go +++ b/shared/instance.go @@ -274,21 +274,6 @@ var InstanceConfigKeysAny = map[string]func(value string) error{ return nil }, - // lxdmeta:generate(entity=instance, group=resource-limits, key=limits.network.priority) - // ```{important} - // This option is deprecated. Use the per-NIC `limits.priority` option instead. - // ``` - // - // Controls how much priority to give to the instance's network requests when under load. - // - // Specify an integer between 0 and 10. - // --- - // type: integer - // defaultdesc: `0` (minimum) - // liveupdate: yes - // shortdesc: Priority of the instance's network requests - "limits.network.priority": validate.Optional(validate.IsPriority), - // Caller is responsible for full validation of any raw.* value. // lxdmeta:generate(entity=instance, group=raw, key=raw.apparmor)