Skip to content

Commit

Permalink
Fix minor typos
Browse files Browse the repository at this point in the history
Several typos in comments, log and error messages were fixed.

Signed-off-by: Martin Klozik <[email protected]>
  • Loading branch information
p00rman committed May 14, 2020
1 parent 673eeb0 commit 35ae7f4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
15 changes: 8 additions & 7 deletions cniovs/cniovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down Expand Up @@ -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/<podID>/volumes/kubernetes.io~empty-dir/shared-dir
parts := strings.Split(sharedDir, "/")
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions cniovs/localdb.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/configdata/configdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions userspace/userspace.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 35ae7f4

Please sign in to comment.