@@ -102,7 +102,7 @@ func (plugin *cniNetworkPlugin) podUnlock(podNetwork PodNetwork) {
102
102
fullPodName := buildFullPodName (podNetwork )
103
103
lock , ok := plugin .pods [fullPodName ]
104
104
if ! ok {
105
- logrus .Warningf ( "Unbalanced pod lock unref for %s" , fullPodName )
105
+ logrus .Errorf ( "Cannot find reference in refcount map for %s. Refcount cannot be determined. " , fullPodName )
106
106
return
107
107
} else if lock .refcount == 0 {
108
108
// This should never ever happen, but handle it anyway
@@ -121,12 +121,12 @@ func newWatcher(confDir string) (*fsnotify.Watcher, error) {
121
121
// Ensure plugin directory exists, because the following monitoring logic
122
122
// relies on that.
123
123
if err := os .MkdirAll (confDir , 0755 ); err != nil {
124
- return nil , fmt .Errorf ("failed to create %q: %v" , confDir , err )
124
+ return nil , fmt .Errorf ("failed to create directory %q: %v" , confDir , err )
125
125
}
126
126
127
127
watcher , err := fsnotify .NewWatcher ()
128
128
if err != nil {
129
- return nil , fmt .Errorf ("could not create new watcher %v" , err )
129
+ return nil , fmt .Errorf ("failed to create new watcher %v" , err )
130
130
}
131
131
defer func () {
132
132
// Close watcher on error
@@ -275,13 +275,13 @@ func loadNetworks(confDir string, cni *libcni.CNIConfig) (map[string]*cniNetwork
275
275
if strings .HasSuffix (confFile , ".conflist" ) {
276
276
confList , err = libcni .ConfListFromFile (confFile )
277
277
if err != nil {
278
- logrus .Warningf ("Error loading CNI config list file %s: %v" , confFile , err )
278
+ logrus .Errorf ("Error loading CNI config list file %s: %v" , confFile , err )
279
279
continue
280
280
}
281
281
} else {
282
282
conf , err := libcni .ConfFromFile (confFile )
283
283
if err != nil {
284
- logrus .Warningf ("Error loading CNI config file %s: %v" , confFile , err )
284
+ logrus .Errorf ("Error loading CNI config file %s: %v" , confFile , err )
285
285
continue
286
286
}
287
287
if conf .Network .Type == "" {
@@ -290,7 +290,7 @@ func loadNetworks(confDir string, cni *libcni.CNIConfig) (map[string]*cniNetwork
290
290
}
291
291
confList , err = libcni .ConfListFromConf (conf )
292
292
if err != nil {
293
- logrus .Warningf ("Error converting CNI config file %s to list: %v" , confFile , err )
293
+ logrus .Errorf ("Error converting CNI config file %s to list: %v" , confFile , err )
294
294
continue
295
295
}
296
296
}
@@ -321,7 +321,7 @@ func loadNetworks(confDir string, cni *libcni.CNIConfig) (map[string]*cniNetwork
321
321
if _ , ok := networks [confList .Name ]; ! ok {
322
322
networks [confList .Name ] = cniNet
323
323
} else {
324
- logrus .Infof ("Ignore CNI network %s (type=%v) at %s because already exists" , confList .Name , confList .Plugins [0 ].Network .Type , confFile )
324
+ logrus .Infof ("Ignored CNI network %s (type=%v) at %s because already exists" , confList .Name , confList .Plugins [0 ].Network .Type , confFile )
325
325
}
326
326
327
327
if defaultNetName == "" {
@@ -348,7 +348,7 @@ func (plugin *cniNetworkPlugin) syncNetworkConfig() error {
348
348
// Update defaultNetName if it is changeable
349
349
if plugin .defaultNetName .changeable {
350
350
plugin .defaultNetName .name = defaultNetName
351
- logrus .Infof ("Update default CNI network name to %s" , defaultNetName )
351
+ logrus .Infof ("Updated default CNI network name to %s" , defaultNetName )
352
352
} else {
353
353
logrus .Debugf ("Default CNI network name %s is unchangeable" , plugin .defaultNetName .name )
354
354
}
@@ -479,8 +479,8 @@ func (plugin *cniNetworkPlugin) forEachNetwork(podNetwork *PodNetwork, fromCache
479
479
var newRt * libcni.RuntimeConf
480
480
cniNet , newRt , err = plugin .loadNetworkFromCache (network .Name , rt )
481
481
if err != nil {
482
- logrus .Debugf ("error loading cached network config: %v" , err )
483
- logrus .Debugf ("falling back to loading from existing plugins on disk" )
482
+ logrus .Errorf ("error loading cached network config: %v" , err )
483
+ logrus .Warningf ("falling back to loading from existing plugins on disk" )
484
484
} else {
485
485
// Use the updated RuntimeConf
486
486
rt = newRt
@@ -570,7 +570,7 @@ func (plugin *cniNetworkPlugin) getCachedNetworkInfo(containerID string) ([]NetA
570
570
cacheFile := filepath .Join (dirPath , fname )
571
571
bytes , err := ioutil .ReadFile (cacheFile )
572
572
if err != nil {
573
- logrus .Warningf ("failed to read CNI cache file %s: %v" , cacheFile , err )
573
+ logrus .Errorf ("failed to read CNI cache file %s: %v" , cacheFile , err )
574
574
continue
575
575
}
576
576
@@ -582,7 +582,7 @@ func (plugin *cniNetworkPlugin) getCachedNetworkInfo(containerID string) ([]NetA
582
582
}{}
583
583
584
584
if err := json .Unmarshal (bytes , & cachedInfo ); err != nil {
585
- logrus .Warningf ("failed to unmarshal CNI cache file %s: %v" , cacheFile , err )
585
+ logrus .Errorf ("failed to unmarshal CNI cache file %s: %v" , cacheFile , err )
586
586
continue
587
587
}
588
588
if cachedInfo .Kind != libcni .CNICacheV1 {
@@ -632,7 +632,7 @@ func (plugin *cniNetworkPlugin) TearDownPodWithContext(ctx context.Context, podN
632
632
633
633
if err := tearDownLoopback (podNetwork .NetNS ); err != nil {
634
634
// ignore error
635
- logrus .Errorf ("Ignoring error tearing down loopback interface: %v" , err )
635
+ logrus .Warningf ("Ignoring error tearing down loopback interface: %v" , err )
636
636
}
637
637
638
638
return plugin .forEachNetwork (& podNetwork , true , func (network * cniNetwork , podNetwork * PodNetwork , rt * libcni.RuntimeConf ) error {
@@ -718,7 +718,7 @@ func (network *cniNetwork) checkNetwork(ctx context.Context, rt *libcni.RuntimeC
718
718
719
719
result , err = cni .GetNetworkListCachedResult (network .config , rt )
720
720
if err != nil {
721
- logrus .Errorf ("Error GetNetworkListCachedResult : %v" , err )
721
+ logrus .Errorf ("Error getting network list cached result : %v" , err )
722
722
return nil , err
723
723
} else if result != nil {
724
724
return result , nil
@@ -771,7 +771,7 @@ func (network *cniNetwork) checkNetwork(ctx context.Context, rt *libcni.RuntimeC
771
771
func (network * cniNetwork ) deleteFromNetwork (ctx context.Context , rt * libcni.RuntimeConf , cni * libcni.CNIConfig ) error {
772
772
logrus .Infof ("About to del CNI network %s (type=%v)" , network .name , network .config .Plugins [0 ].Network .Type )
773
773
if err := cni .DelNetworkList (ctx , network .config , rt ); err != nil {
774
- logrus .Errorf ("Error deleting network: %v" , err )
774
+ logrus .Errorf ("Error deleting network %s : %v" , network . name , err )
775
775
return err
776
776
}
777
777
return nil
0 commit comments