From 35ae7f4a0cb3c9b449c718215d14f882488c33aa Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Thu, 14 May 2020 08:43:08 +0100 Subject: [PATCH] Fix minor typos Several typos in comments, log and error messages were fixed. Signed-off-by: Martin Klozik --- cniovs/cniovs.go | 15 ++++++++------- cniovs/localdb.go | 8 ++++---- pkg/configdata/configdata.go | 2 +- userspace/userspace.go | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cniovs/cniovs.go b/cniovs/cniovs.go index bac5d213..248d6a41 100644 --- a/cniovs/cniovs.go +++ b/cniovs/cniovs.go @@ -77,7 +77,7 @@ func (cniOvs CniOvs) AddOnHost(conf *types.NetConf, logging.Infof("OVS AddOnHost: ENTER - Container %s Iface %s", args.ContainerID[:12], args.IfName) // - // Manditory attribute of "ovs-vsctl add-port" is a BridgeName. So even if + // Mandatory attribute of "ovs-vsctl add-port" is a BridgeName. So even if // NetType is not set to "bridge", "conf.HostConf.BridgeConf.BridgeName" // should be set. If it is not, set it to default value. // @@ -225,9 +225,10 @@ func generateRandomMacAddress() string { } func getShortSharedDir(sharedDir string) string { - // sun_path for unix domain socket has a array size of 108 - // When the sharedDir path length greater than 89 (108 - 19) - // 19 is the possible vhostuser socke file name length "/abcdefghijkl-net99" (1 + 12 + 1 + 3 + 2) + // sun_path for unix domain socket has an array size of 108 + // When the sharedDir path length is greater than 89 (108 - 19) + // 19 is the possible vhostuser socket file name length "/abcdefghijkl-net99" (1 + 12 + 1 + 3 + 2) + // FIXME: why shareddir is shortened only in case that it contains "empty-dir"? if len(sharedDir) >= 89 && strings.Contains(sharedDir, "empty-dir") { // Format - /var/lib/kubelet/pods//volumes/kubernetes.io~empty-dir/shared-dir parts := strings.Split(sharedDir, "/") @@ -255,7 +256,7 @@ func createSharedDir(sharedDir, oldSharedDir string) error { logging.Debugf("createSharedDir: Mount from %s to %s", oldSharedDir, sharedDir) err = unix.Mount(oldSharedDir, sharedDir, "", unix.MS_BIND, "") if err != nil { - logging.Errorf("createSharedDir: Failed to bind mout: %s", err) + logging.Errorf("createSharedDir: Failed to bind mount: %s", err) return err } } @@ -300,7 +301,7 @@ func addLocalDeviceVhost(conf *types.NetConf, args *skel.CmdArgs, actualSharedDi sharedDir := getShortSharedDir(actualSharedDir) err = createSharedDir(sharedDir, actualSharedDir) if err != nil { - logging.Errorf("addLocalDeviceVhost: Failed to create shared dir group: %v", err) + logging.Errorf("addLocalDeviceVhost: Failed to create shared dir: %v", err) return err } @@ -354,7 +355,7 @@ func delLocalDeviceVhost(conf *types.NetConf, args *skel.CmdArgs, actualSharedDi logging.Debugf("delLocalDeviceVhost: Unmount shared directory: %v", sharedDir) _, err = os.Stat(sharedDir) if os.IsNotExist(err) { - logging.Errorf("delLocalDeviceVhost: shared directory %s does not existt to unmount", sharedDir) + logging.Errorf("delLocalDeviceVhost: shared directory %s does not exist to unmount", sharedDir) return nil } err = unix.Unmount(sharedDir, 0) diff --git a/cniovs/localdb.go b/cniovs/localdb.go index e61fc3d6..c69af6da 100644 --- a/cniovs/localdb.go +++ b/cniovs/localdb.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Red Hat. +// Copyright (c) 2018-2020 Red Hat, Intel Corp. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -78,7 +78,7 @@ func SaveConfig(conf *types.NetConf, args *skel.CmdArgs, data *OvsSavedData) err return ioutil.WriteFile(path, dataBytes, 0644) } else { - return fmt.Errorf("ERROR: serializing delegate VPP saved data: %v", err) + return fmt.Errorf("ERROR: serializing delegate OVS saved data: %v", err) } } @@ -91,10 +91,10 @@ func LoadConfig(conf *types.NetConf, args *skel.CmdArgs, data *OvsSavedData) err if _, err := os.Stat(path); err == nil { if dataBytes, err := ioutil.ReadFile(path); err == nil { if err = json.Unmarshal(dataBytes, data); err != nil { - return fmt.Errorf("ERROR: Failed to parse VPP saved data: %v", err) + return fmt.Errorf("ERROR: Failed to parse OVS saved data: %v", err) } } else { - return fmt.Errorf("ERROR: Failed to read VPP saved data: %v", err) + return fmt.Errorf("ERROR: Failed to read OVS saved data: %v", err) } } else { diff --git a/pkg/configdata/configdata.go b/pkg/configdata/configdata.go index eed76663..ac5e7798 100644 --- a/pkg/configdata/configdata.go +++ b/pkg/configdata/configdata.go @@ -153,7 +153,7 @@ func SaveRemoteConfig(conf *types.NetConf, err = ioutil.WriteFile(path, dataBytes, 0644) } else { return pod, fmt.Errorf("ERROR: serializing REMOTE NetConf data: %v", err) - } + } } return pod, err diff --git a/userspace/userspace.go b/userspace/userspace.go index edb771ee..235d7ea7 100644 --- a/userspace/userspace.go +++ b/userspace/userspace.go @@ -1,4 +1,4 @@ -// Copyright 2017 Intel Corp. +// Copyright 2017-2020 Intel Corp. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -331,7 +331,7 @@ func cmdDel(args *skel.CmdArgs, exec invoke.Exec, kubeClient kubernetes.Interfac // Save off kubeClient and pod for later use if needed. kubeClient, pod, sharedDir, err := getPodAndSharedDir(netConf, args, kubeClient) if err != nil { - logging.Errorf("cmdAdd: Unable to determine \"SharedDir\" - %v", err) + logging.Errorf("cmdDel: Unable to determine \"SharedDir\" - %v", err) return err }