MCPcopy Create free account
hub / github.com/Mirantis/cri-dockerd / ReconcileInterface

Method ReconcileInterface

network/bandwidth/linux.go:264–281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

262}
263
264func (t *tcShaper) ReconcileInterface() error {
265 exists, output, err := t.interfaceExists()
266 if err != nil {
267 return err
268 }
269 if !exists {
270 logrus.Info("Didn't find bandwidth interface, creating")
271 return t.initializeInterface()
272 }
273 fields := strings.Split(output, " ")
274 if len(fields) < 12 || fields[1] != "htb" || fields[2] != "1:" {
275 if err := t.deleteInterface(fields[2]); err != nil {
276 return err
277 }
278 return t.initializeInterface()
279 }
280 return nil
281}
282
283func (t *tcShaper) initializeInterface() error {
284 return t.execAndLog("tc", "qdisc", "add", "dev", t.iface, "root", "handle", "1:", "htb", "default", "30")

Calls 5

interfaceExistsMethod · 0.95
initializeInterfaceMethod · 0.95
deleteInterfaceMethod · 0.95
lenFunction · 0.85
InfoMethod · 0.65

Tested by 3