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
8de419b1
Commit
8de419b1
authored
Jul 05, 2017
by
Minhan Xia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose lock release error from iptables util
parent
96d8ab72
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
BUILD
pkg/util/iptables/BUILD
+1
-0
iptables.go
pkg/util/iptables/iptables.go
+6
-2
iptables_linux.go
pkg/util/iptables/iptables_linux.go
+10
-3
No files found.
pkg/util/iptables/BUILD
View file @
8de419b1
...
@@ -24,6 +24,7 @@ go_library(
...
@@ -24,6 +24,7 @@ go_library(
"//vendor/github.com/godbus/dbus:go_default_library",
"//vendor/github.com/godbus/dbus:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/golang.org/x/sys/unix:go_default_library",
"//vendor/golang.org/x/sys/unix:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
],
],
...
...
pkg/util/iptables/iptables.go
View file @
8de419b1
...
@@ -338,7 +338,7 @@ func (runner *runner) RestoreAll(data []byte, flush FlushFlag, counters RestoreC
...
@@ -338,7 +338,7 @@ func (runner *runner) RestoreAll(data []byte, flush FlushFlag, counters RestoreC
}
}
type
iptablesLocker
interface
{
type
iptablesLocker
interface
{
Close
()
Close
()
error
}
}
// restoreInternal is the shared part of Restore/RestoreAll
// restoreInternal is the shared part of Restore/RestoreAll
...
@@ -361,7 +361,11 @@ func (runner *runner) restoreInternal(args []string, data []byte, flush FlushFla
...
@@ -361,7 +361,11 @@ func (runner *runner) restoreInternal(args []string, data []byte, flush FlushFla
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
defer
locker
.
Close
()
defer
func
(
locker
iptablesLocker
)
{
if
err
:=
locker
.
Close
();
err
!=
nil
{
glog
.
Errorf
(
"Failed to close iptables locks: %v"
,
err
)
}
}(
locker
)
}
}
// run the command and return the output or an error including the output and error
// run the command and return the output or an error including the output and error
...
...
pkg/util/iptables/iptables_linux.go
View file @
8de419b1
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"time"
"time"
"golang.org/x/sys/unix"
"golang.org/x/sys/unix"
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/wait"
)
)
...
@@ -33,13 +34,19 @@ type locker struct {
...
@@ -33,13 +34,19 @@ type locker struct {
lock14
*
net
.
UnixListener
lock14
*
net
.
UnixListener
}
}
func
(
l
*
locker
)
Close
()
{
func
(
l
*
locker
)
Close
()
error
{
errList
:=
[]
error
{}
if
l
.
lock16
!=
nil
{
if
l
.
lock16
!=
nil
{
l
.
lock16
.
Close
()
if
err
:=
l
.
lock16
.
Close
();
err
!=
nil
{
errList
=
append
(
errList
,
err
)
}
}
}
if
l
.
lock14
!=
nil
{
if
l
.
lock14
!=
nil
{
l
.
lock14
.
Close
()
if
err
:=
l
.
lock14
.
Close
();
err
!=
nil
{
errList
=
append
(
errList
,
err
)
}
}
}
return
utilerrors
.
NewAggregate
(
errList
)
}
}
func
grabIptablesLocks
(
lockfilePath
string
)
(
iptablesLocker
,
error
)
{
func
grabIptablesLocks
(
lockfilePath
string
)
(
iptablesLocker
,
error
)
{
...
...
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