mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
expose lock release error from iptables util
This commit is contained in:
parent
96d8ab725b
commit
8de419b19f
@ -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",
|
||||||
],
|
],
|
||||||
|
@ -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
|
|||||||
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
|
||||||
|
@ -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 {
|
|||||||
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user