mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-24 04:54:00 +00:00
Replace logger.Warn(f) with logger.Warning(f)
This aligns better with klog used in other projects. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
9464953924
commit
1d0a733487
@ -117,7 +117,7 @@ func (m command) run(c *cli.Context, cfg *config) error {
|
||||
}
|
||||
targets, err := chainLocator.Locate(ms.Path)
|
||||
if err != nil {
|
||||
m.logger.Warnf("Failed to locate symlink %v", ms.Path)
|
||||
m.logger.Warningf("Failed to locate symlink %v", ms.Path)
|
||||
}
|
||||
candidates = append(candidates, targets...)
|
||||
}
|
||||
@ -137,7 +137,7 @@ func (m command) run(c *cli.Context, cfg *config) error {
|
||||
|
||||
err = m.createLink(created, cfg.hostRoot, containerRoot, target, candidate)
|
||||
if err != nil {
|
||||
m.logger.Warnf("Failed to create link %v: %v", []string{target, candidate}, err)
|
||||
m.logger.Warningf("Failed to create link %v: %v", []string{target, candidate}, err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,13 +145,13 @@ func (m command) run(c *cli.Context, cfg *config) error {
|
||||
for _, l := range links {
|
||||
parts := strings.Split(l, "::")
|
||||
if len(parts) != 2 {
|
||||
m.logger.Warnf("Invalid link specification %v", l)
|
||||
m.logger.Warningf("Invalid link specification %v", l)
|
||||
continue
|
||||
}
|
||||
|
||||
err := m.createLink(created, cfg.hostRoot, containerRoot, parts[0], parts[1])
|
||||
if err != nil {
|
||||
m.logger.Warnf("Failed to create link %v: %v", parts, err)
|
||||
m.logger.Warningf("Failed to create link %v: %v", parts, err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ func (m command) run(c *cli.Context, cfg *config) error {
|
||||
func (m command) createLink(created map[string]bool, hostRoot string, containerRoot string, target string, link string) error {
|
||||
linkPath, err := changeRoot(hostRoot, containerRoot, link)
|
||||
if err != nil {
|
||||
m.logger.Warnf("Failed to resolve path for link %v relative to %v: %v", link, containerRoot, err)
|
||||
m.logger.Warningf("Failed to resolve path for link %v relative to %v: %v", link, containerRoot, err)
|
||||
}
|
||||
if created[linkPath] {
|
||||
m.logger.Debugf("Link %v already created", linkPath)
|
||||
@ -171,7 +171,7 @@ func (m command) createLink(created map[string]bool, hostRoot string, containerR
|
||||
|
||||
targetPath, err := changeRoot(hostRoot, "/", target)
|
||||
if err != nil {
|
||||
m.logger.Warnf("Failed to resolve path for target %v relative to %v: %v", target, "/", err)
|
||||
m.logger.Warningf("Failed to resolve path for target %v relative to %v: %v", target, "/", err)
|
||||
}
|
||||
|
||||
m.logger.Infof("Symlinking %v to %v", linkPath, targetPath)
|
||||
|
@ -130,12 +130,12 @@ func (m command) validateFlags(r *cli.Context, cfg *config) error {
|
||||
}
|
||||
|
||||
if cfg.loadKernelModules && !cfg.createAll {
|
||||
m.logger.Warn("load-kernel-modules is only applicable when create-all is set; ignoring")
|
||||
m.logger.Warning("load-kernel-modules is only applicable when create-all is set; ignoring")
|
||||
cfg.loadKernelModules = false
|
||||
}
|
||||
|
||||
if cfg.createDeviceNodes && !cfg.createAll {
|
||||
m.logger.Warn("create-device-nodes is only applicable when create-all is set; ignoring")
|
||||
m.logger.Warning("create-device-nodes is only applicable when create-all is set; ignoring")
|
||||
cfg.createDeviceNodes = false
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ func (m linkCreator) CreateLinks() error {
|
||||
|
||||
err = os.Symlink(target, linkPath)
|
||||
if err != nil {
|
||||
m.logger.Warnf("Could not create symlink: %v", err)
|
||||
m.logger.Warningf("Could not create symlink: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,12 +45,12 @@ func (m existing) DeviceNodes() ([]deviceNode, error) {
|
||||
|
||||
devices, err := locator.Locate("/dev/nvidia*")
|
||||
if err != nil {
|
||||
m.logger.Warnf("Error while locating device: %v", err)
|
||||
m.logger.Warningf("Error while locating device: %v", err)
|
||||
}
|
||||
|
||||
capDevices, err := locator.Locate("/dev/nvidia-caps/nvidia-*")
|
||||
if err != nil {
|
||||
m.logger.Warnf("Error while locating caps device: %v", err)
|
||||
m.logger.Warningf("Error while locating caps device: %v", err)
|
||||
}
|
||||
|
||||
if len(devices) == 0 && len(capDevices) == 0 {
|
||||
@ -67,7 +67,7 @@ func (m existing) DeviceNodes() ([]deviceNode, error) {
|
||||
var stat unix.Stat_t
|
||||
err := unix.Stat(d, &stat)
|
||||
if err != nil {
|
||||
m.logger.Warnf("Could not stat device: %v", err)
|
||||
m.logger.Warningf("Could not stat device: %v", err)
|
||||
continue
|
||||
}
|
||||
deviceNode := deviceNode{
|
||||
|
@ -286,7 +286,7 @@ func resolveWithDefault(logger logger.Interface, label string, path string, defa
|
||||
resolvedPath := defaultPath
|
||||
targets, err := lookup.Locate(path)
|
||||
if err != nil {
|
||||
logger.Warnf("Failed to locate %v: %v", path, err)
|
||||
logger.Warningf("Failed to locate %v: %v", path, err)
|
||||
} else {
|
||||
logger.Debugf("Found %v candidates: %v", path, targets)
|
||||
resolvedPath = targets[0]
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
// single CSV files.
|
||||
func NewFromCSVFiles(logger logger.Interface, files []string, driverRoot string) (Discover, error) {
|
||||
if len(files) == 0 {
|
||||
logger.Warnf("No CSV files specified")
|
||||
logger.Warningf("No CSV files specified")
|
||||
return None{}, nil
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ func NewFromCSVFiles(logger logger.Interface, files []string, driverRoot string)
|
||||
for _, filename := range files {
|
||||
targets, err := loadCSVFile(logger, filename)
|
||||
if err != nil {
|
||||
logger.Warnf("Skipping CSV file %v: %v", filename, err)
|
||||
logger.Warningf("Skipping CSV file %v: %v", filename, err)
|
||||
continue
|
||||
}
|
||||
mountSpecs = append(mountSpecs, targets...)
|
||||
|
@ -259,7 +259,7 @@ var _ Discover = (*xorgHooks)(nil)
|
||||
func optionalXorgDiscoverer(logger logger.Interface, driverRoot string, nvidiaCTKPath string) Discover {
|
||||
xorg, err := newXorgDiscoverer(logger, driverRoot, nvidiaCTKPath)
|
||||
if err != nil {
|
||||
logger.Warnf("Failed to create Xorg discoverer: %v; skipping xorg libraries", err)
|
||||
logger.Warningf("Failed to create Xorg discoverer: %v; skipping xorg libraries", err)
|
||||
return None{}
|
||||
}
|
||||
return xorg
|
||||
|
@ -75,11 +75,11 @@ func (d *mounts) Mounts() ([]Mount, error) {
|
||||
d.logger.Debugf("Locating %v", candidate)
|
||||
located, err := d.lookup.Locate(candidate)
|
||||
if err != nil {
|
||||
d.logger.Warnf("Could not locate %v: %v", candidate, err)
|
||||
d.logger.Warningf("Could not locate %v: %v", candidate, err)
|
||||
continue
|
||||
}
|
||||
if len(located) == 0 {
|
||||
d.logger.Warnf("Missing %v", candidate)
|
||||
d.logger.Warningf("Missing %v", candidate)
|
||||
continue
|
||||
}
|
||||
d.logger.Debugf("Located %v as %v", candidate, located)
|
||||
|
@ -129,7 +129,7 @@ func (d symlinkHook) getCSVFileSymlinks() []string {
|
||||
}
|
||||
targets, err := chainLocator.Locate(ms.Path)
|
||||
if err != nil {
|
||||
d.logger.Warnf("Failed to locate symlink %v", ms.Path)
|
||||
d.logger.Warningf("Failed to locate symlink %v", ms.Path)
|
||||
}
|
||||
candidates = append(candidates, targets...)
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ type Interface interface {
|
||||
Errorf(string, ...interface{})
|
||||
Info(...interface{})
|
||||
Infof(string, ...interface{})
|
||||
Warn(...interface{})
|
||||
Warnf(string, ...interface{})
|
||||
Warning(...interface{})
|
||||
Warningf(string, ...interface{})
|
||||
}
|
||||
|
@ -40,11 +40,8 @@ func (l *NullLogger) Info(...interface{}) {}
|
||||
// Infof is a no-op for the null logger
|
||||
func (l *NullLogger) Infof(string, ...interface{}) {}
|
||||
|
||||
// Warn is a no-op for the null logger
|
||||
func (l *NullLogger) Warn(...interface{}) {}
|
||||
|
||||
// Warnf is a no-op for the null logger
|
||||
func (l *NullLogger) Warnf(string, ...interface{}) {}
|
||||
// Warning is a no-op for the null logger
|
||||
func (l *NullLogger) Warning(...interface{}) {}
|
||||
|
||||
// Warningf is a no-op for the null logger
|
||||
func (l *NullLogger) Warningf(string, ...interface{}) {}
|
||||
|
@ -58,7 +58,7 @@ func (l library) Locate(libname string) ([]string, error) {
|
||||
|
||||
paths32, paths64 := l.cache.Lookup(libname)
|
||||
if len(paths32) > 0 {
|
||||
l.logger.Warnf("Ignoring 32-bit libraries for %v: %v", libname, paths32)
|
||||
l.logger.Warningf("Ignoring 32-bit libraries for %v: %v", libname, paths32)
|
||||
}
|
||||
|
||||
if len(paths64) == 0 {
|
||||
|
@ -115,14 +115,14 @@ func checkRequirements(logger logger.Interface, image image.CUDA) error {
|
||||
|
||||
cudaVersion, err := cuda.Version()
|
||||
if err != nil {
|
||||
logger.Warnf("Failed to get CUDA version: %v", err)
|
||||
logger.Warningf("Failed to get CUDA version: %v", err)
|
||||
} else {
|
||||
r.AddVersionProperty(requirements.CUDA, cudaVersion)
|
||||
}
|
||||
|
||||
compteCapability, err := cuda.ComputeCapability(0)
|
||||
if err != nil {
|
||||
logger.Warnf("Failed to get CUDA Compute Capability: %v", err)
|
||||
logger.Warningf("Failed to get CUDA Compute Capability: %v", err)
|
||||
} else {
|
||||
r.AddVersionProperty(requirements.ARCH, compteCapability)
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func (l *Logger) Update(filename string, logLevel string, argv []string) {
|
||||
level, logLevelError := configFromArgs.getLevel(logLevel)
|
||||
defer func() {
|
||||
if logLevelError != nil {
|
||||
l.Warn(logLevelError)
|
||||
l.Warning(logLevelError)
|
||||
}
|
||||
}()
|
||||
|
||||
@ -77,7 +77,7 @@ func (l *Logger) Update(filename string, logLevel string, argv []string) {
|
||||
}
|
||||
defer func() {
|
||||
if argLogFileError != nil {
|
||||
l.Warnf("Failed to open log file: %v", argLogFileError)
|
||||
l.Warningf("Failed to open log file: %v", argLogFileError)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -65,7 +65,7 @@ func newWSLDriverStoreDiscoverer(logger logger.Interface, driverRoot string, nvi
|
||||
searchPaths = append(searchPaths, path)
|
||||
}
|
||||
if len(searchPaths) > 1 {
|
||||
logger.Warnf("Found multiple driver store paths: %v", searchPaths)
|
||||
logger.Warningf("Found multiple driver store paths: %v", searchPaths)
|
||||
}
|
||||
driverStorePath := searchPaths[0]
|
||||
searchPaths = append(searchPaths, "/usr/lib/wsl/lib")
|
||||
|
@ -134,7 +134,7 @@ func (o Options) RevertConfig(cfg engine.Interface) error {
|
||||
func (o Options) Restart(service string, withSignal func(string) error) error {
|
||||
switch o.RestartMode {
|
||||
case restartModeNone:
|
||||
logrus.Warnf("Skipping restart of %v due to --restart-mode=%v", service, o.RestartMode)
|
||||
logrus.Warningf("Skipping restart of %v due to --restart-mode=%v", service, o.RestartMode)
|
||||
return nil
|
||||
case restartModeSignal:
|
||||
return withSignal(o.Socket)
|
||||
|
@ -311,11 +311,11 @@ func SignalContainerd(socket string) error {
|
||||
if i == maxReloadAttempts-1 {
|
||||
break
|
||||
}
|
||||
log.Warnf("Error signaling containerd, attempt %v/%v: %v", i+1, maxReloadAttempts, err)
|
||||
log.Warningf("Error signaling containerd, attempt %v/%v: %v", i+1, maxReloadAttempts, err)
|
||||
time.Sleep(reloadBackoff)
|
||||
}
|
||||
if err != nil {
|
||||
log.Warnf("Max retries reached %v/%v, aborting", maxReloadAttempts, maxReloadAttempts)
|
||||
log.Warningf("Max retries reached %v/%v, aborting", maxReloadAttempts, maxReloadAttempts)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -285,11 +285,11 @@ func SignalDocker(socket string) error {
|
||||
if i == maxReloadAttempts-1 {
|
||||
break
|
||||
}
|
||||
log.Warnf("Error signaling docker, attempt %v/%v: %v", i+1, maxReloadAttempts, err)
|
||||
log.Warningf("Error signaling docker, attempt %v/%v: %v", i+1, maxReloadAttempts, err)
|
||||
time.Sleep(reloadBackoff)
|
||||
}
|
||||
if err != nil {
|
||||
log.Warnf("Max retries reached %v/%v, aborting", maxReloadAttempts, maxReloadAttempts)
|
||||
log.Warningf("Max retries reached %v/%v, aborting", maxReloadAttempts, maxReloadAttempts)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -192,8 +192,8 @@ func initialize() error {
|
||||
|
||||
err = unix.Flock(int(f.Fd()), unix.LOCK_EX|unix.LOCK_NB)
|
||||
if err != nil {
|
||||
log.Warnf("Unable to get exclusive lock on '%v'", pidFile)
|
||||
log.Warnf("This normally means an instance of the NVIDIA toolkit Container is already running, aborting")
|
||||
log.Warningf("Unable to get exclusive lock on '%v'", pidFile)
|
||||
log.Warningf("This normally means an instance of the NVIDIA toolkit Container is already running, aborting")
|
||||
return fmt.Errorf("unable to get flock on pidfile: %v", err)
|
||||
}
|
||||
|
||||
@ -288,6 +288,6 @@ func shutdown() {
|
||||
|
||||
err := os.Remove(pidFile)
|
||||
if err != nil {
|
||||
log.Warnf("Unable to remove pidfile: %v", err)
|
||||
log.Warningf("Unable to remove pidfile: %v", err)
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ func installContainerRuntimes(toolkitDir string, driverRoot string) error {
|
||||
// Install the experimental runtime and treat failures as non-fatal.
|
||||
err := installExperimentalRuntime(toolkitDir, driverRoot)
|
||||
if err != nil {
|
||||
log.Warnf("Could not install experimental runtime: %v", err)
|
||||
log.Warningf("Could not install experimental runtime: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -60,7 +60,7 @@ func installContainerRuntimes(toolkitDir string, driverRoot string) error {
|
||||
func installExperimentalRuntime(toolkitDir string, driverRoot string) error {
|
||||
libraryRoot, err := findLibraryRoot(driverRoot)
|
||||
if err != nil {
|
||||
log.Warnf("Error finding library path for root %v: %v", driverRoot, err)
|
||||
log.Warningf("Error finding library path for root %v: %v", driverRoot, err)
|
||||
}
|
||||
log.Infof("Using library root %v", libraryRoot)
|
||||
|
||||
|
@ -448,7 +448,7 @@ func installToolkitConfig(c *cli.Context, toolkitConfigPath string, nvidiaContai
|
||||
}
|
||||
value = v.Value()
|
||||
default:
|
||||
log.Warnf("Unexpected type for option %v=%v: %T", key, value, v)
|
||||
log.Warningf("Unexpected type for option %v=%v: %T", key, value, v)
|
||||
}
|
||||
|
||||
config.Set(key, value)
|
||||
|
Loading…
Reference in New Issue
Block a user