Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ea56e508
Commit
ea56e508
authored
Jan 02, 2016
by
Rudi Chiarito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: deal properly with tc qdisc show returning "noqueue"
parent
ac7f8504
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
linux.go
pkg/util/bandwidth/linux.go
+6
-0
linux_test.go
pkg/util/bandwidth/linux_test.go
+13
-3
No files found.
pkg/util/bandwidth/linux.go
View file @
ea56e508
...
@@ -224,6 +224,12 @@ func (t *tcShaper) interfaceExists() (bool, string, error) {
...
@@ -224,6 +224,12 @@ func (t *tcShaper) interfaceExists() (bool, string, error) {
if
len
(
value
)
==
0
{
if
len
(
value
)
==
0
{
return
false
,
""
,
nil
return
false
,
""
,
nil
}
}
// Newer versions of tc and/or the kernel return the following instead of nothing:
// qdisc noqueue 0: root refcnt 2
fields
:=
strings
.
Fields
(
value
)
if
len
(
fields
)
>
1
&&
fields
[
1
]
==
"noqueue"
{
return
false
,
""
,
nil
}
return
true
,
value
,
nil
return
true
,
value
,
nil
}
}
...
...
pkg/util/bandwidth/linux_test.go
View file @
ea56e508
...
@@ -492,11 +492,11 @@ func TestReconcileInterfaceExists(t *testing.T) {
...
@@ -492,11 +492,11 @@ func TestReconcileInterfaceExists(t *testing.T) {
}
}
}
}
func
TestReconcileInterfaceDoesntExist
(
t
*
testing
.
T
)
{
func
testReconcileInterfaceHasNoData
(
t
*
testing
.
T
,
output
string
)
{
fcmd
:=
exec
.
FakeCmd
{
fcmd
:=
exec
.
FakeCmd
{
CombinedOutputScript
:
[]
exec
.
FakeCombinedOutputAction
{
CombinedOutputScript
:
[]
exec
.
FakeCombinedOutputAction
{
func
()
([]
byte
,
error
)
{
return
[]
byte
(
"
\n
"
),
nil
},
func
()
([]
byte
,
error
)
{
return
[]
byte
(
output
),
nil
},
func
()
([]
byte
,
error
)
{
return
[]
byte
(
"
\n
"
),
nil
},
func
()
([]
byte
,
error
)
{
return
[]
byte
(
output
),
nil
},
},
},
}
}
...
@@ -549,6 +549,16 @@ func TestReconcileInterfaceDoesntExist(t *testing.T) {
...
@@ -549,6 +549,16 @@ func TestReconcileInterfaceDoesntExist(t *testing.T) {
}
}
}
}
func
TestReconcileInterfaceDoesntExist
(
t
*
testing
.
T
)
{
testReconcileInterfaceHasNoData
(
t
,
"
\n
"
)
}
var
tcQdiscNoqueue
=
"qdisc noqueue 0: root refcnt 2
\n
"
func
TestReconcileInterfaceExistsWithNoqueue
(
t
*
testing
.
T
)
{
testReconcileInterfaceHasNoData
(
t
,
tcQdiscNoqueue
)
}
var
tcQdiscWrong
=
[]
string
{
var
tcQdiscWrong
=
[]
string
{
"qdisc htb 2: root refcnt 2 r2q 10 default 30 direct_packets_stat 0
\n
"
,
"qdisc htb 2: root refcnt 2 r2q 10 default 30 direct_packets_stat 0
\n
"
,
"qdisc foo 1: root refcnt 2 r2q 10 default 30 direct_packets_stat 0
\n
"
,
"qdisc foo 1: root refcnt 2 r2q 10 default 30 direct_packets_stat 0
\n
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment