Skip to content

Commit dcc17ff

Browse files
committed
PPC: pkg: public consts to private
The consts are not used anywhere else so make them private. Signed-off-by: Shereen Haj <shajmakh@redhat.com>
1 parent ccb071f commit dcc17ff

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

pkg/performanceprofile/profilecreator/ghwhandler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ import (
3333
// NewGHWHandler is a handler to use ghw options corresponding to a node
3434
func NewGHWHandler(mustGatherDirPath string, node *v1.Node) (*GHWHandler, error) {
3535
nodeName := node.GetName()
36-
nodePathSuffix := path.Join(Nodes)
37-
nodepath, err := getMustGatherFullPathsWithFilter(mustGatherDirPath, nodePathSuffix, ClusterScopedResources)
36+
nodePathSuffix := path.Join(nodes)
37+
nodepath, err := getMustGatherFullPathsWithFilter(mustGatherDirPath, nodePathSuffix, clusterScopedResources)
3838
if err != nil {
3939
return nil, fmt.Errorf("can't obtain the node path %s: %v", nodeName, err)
4040
}
41-
_, err = os.Stat(path.Join(nodepath, nodeName, SysInfoFileName))
41+
_, err = os.Stat(path.Join(nodepath, nodeName, sysInfoFileName))
4242
if err != nil {
4343
return nil, fmt.Errorf("can't obtain the path: %s for node %s: %v", nodeName, nodepath, err)
4444
}
4545
options := ghw.WithSnapshot(ghw.SnapshotOptions{
46-
Path: path.Join(nodepath, nodeName, SysInfoFileName),
46+
Path: path.Join(nodepath, nodeName, sysInfoFileName),
4747
})
4848
ghwHandler := &GHWHandler{snapShotOptions: options, Node: node}
4949
return ghwHandler, nil

pkg/performanceprofile/profilecreator/mustgather.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ import (
2929
)
3030

3131
const (
32-
// ClusterScopedResources defines the subpath, relative to the top-level must-gather directory.
32+
// clusterScopedResources defines the subpath, relative to the top-level must-gather directory.
3333
// A top-level must-gather directory is of the following format:
3434
// must-gather-dir/quay-io-openshift-kni-performance-addon-operator-must-gather-sha256-<Image SHA>
3535
// Here we find the cluster-scoped definitions saved by must-gather
36-
ClusterScopedResources = "cluster-scoped-resources"
37-
// CoreNodes defines the subpath, relative to ClusterScopedResources, on which we find node-specific data
38-
CoreNodes = "core/nodes"
39-
// MCPools defines the subpath, relative to ClusterScopedResources, on which we find the machine config pool definitions
40-
MCPools = "machineconfiguration.openshift.io/machineconfigpools"
41-
// YAMLSuffix is the extension of the yaml files saved by must-gather
42-
YAMLSuffix = ".yaml"
43-
// Nodes defines the subpath, relative to top-level must-gather directory, on which we find node-specific data
44-
Nodes = "nodes"
45-
// SysInfoFileName defines the name of the file where ghw snapshot is stored
46-
SysInfoFileName = "sysinfo.tgz"
47-
// defines the sub path relative to ClusterScopedResources, on which OCP infrastructure object is
36+
clusterScopedResources = "cluster-scoped-resources"
37+
// coreNodes defines the subpath, relative to ClusterScopedResources, on which we find node-specific data
38+
coreNodes = "core/nodes"
39+
// mcpools defines the subpath, relative to ClusterScopedResources, on which we find the machine config pool definitions
40+
mcpools = "machineconfiguration.openshift.io/machineconfigpools"
41+
// yamlSuffix is the extension of the yaml files saved by must-gather
42+
yamlSuffix = ".yaml"
43+
// nodes defines the subpath, relative to top-level must-gather directory, on which we find node-specific data
44+
nodes = "nodes"
45+
// sysInfoFileName defines the name of the file where ghw snapshot is stored
46+
sysInfoFileName = "sysinfo.tgz"
47+
// configOCPInfra defines the sub path relative to ClusterScopedResources, on which OCP infrastructure object is
4848
configOCPInfra = "config.openshift.io/infrastructures"
4949
)
5050

@@ -80,7 +80,7 @@ func getMustGatherFullPaths(mustGatherPath string, suffix string) (string, error
8080

8181
func getNode(mustGatherDirPath, nodeName string) (*v1.Node, error) {
8282
var node v1.Node
83-
nodePathSuffix := path.Join(ClusterScopedResources, CoreNodes, nodeName)
83+
nodePathSuffix := path.Join(clusterScopedResources, coreNodes, nodeName)
8484
path, err := getMustGatherFullPaths(mustGatherDirPath, nodePathSuffix)
8585
if err != nil {
8686
return nil, fmt.Errorf("failed to get MachineConfigPool for %s: %v", nodeName, err)
@@ -103,7 +103,7 @@ func getNode(mustGatherDirPath, nodeName string) (*v1.Node, error) {
103103
func GetNodeList(mustGatherDirPath string) ([]*v1.Node, error) {
104104
machines := make([]*v1.Node, 0)
105105

106-
nodePathSuffix := path.Join(ClusterScopedResources, CoreNodes)
106+
nodePathSuffix := path.Join(clusterScopedResources, coreNodes)
107107
nodePath, err := getMustGatherFullPaths(mustGatherDirPath, nodePathSuffix)
108108
if err != nil {
109109
return nil, fmt.Errorf("failed to get Nodes from must gather directory: %v", err)
@@ -131,7 +131,7 @@ func GetNodeList(mustGatherDirPath string) ([]*v1.Node, error) {
131131
func GetMCPList(mustGatherDirPath string) ([]*machineconfigv1.MachineConfigPool, error) {
132132
pools := make([]*machineconfigv1.MachineConfigPool, 0)
133133

134-
mcpPathSuffix := path.Join(ClusterScopedResources, MCPools)
134+
mcpPathSuffix := path.Join(clusterScopedResources, mcpools)
135135
mcpPath, err := getMustGatherFullPaths(mustGatherDirPath, mcpPathSuffix)
136136
if err != nil {
137137
return nil, fmt.Errorf("failed to get MCPs: %v", err)
@@ -161,7 +161,7 @@ func GetMCPList(mustGatherDirPath string) ([]*machineconfigv1.MachineConfigPool,
161161
func GetMCP(mustGatherDirPath, mcpName string) (*machineconfigv1.MachineConfigPool, error) {
162162
var mcp machineconfigv1.MachineConfigPool
163163

164-
mcpPathSuffix := path.Join(ClusterScopedResources, MCPools, mcpName+YAMLSuffix)
164+
mcpPathSuffix := path.Join(clusterScopedResources, mcpools, mcpName+yamlSuffix)
165165
mcpPath, err := getMustGatherFullPaths(mustGatherDirPath, mcpPathSuffix)
166166
if err != nil {
167167
return nil, fmt.Errorf("failed to obtain MachineConfigPool %s: %v", mcpName, err)

pkg/performanceprofile/profilecreator/profilecreator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ func IsLogicalProcessorUsed(extCPUInfo *extendedCPUInfo, logicalProcessor int) b
570570

571571
// IsExternalControlPlaneCluster return whether the control plane is running on externally outside the cluster
572572
func IsExternalControlPlaneCluster(mustGatherDirPath string) (bool, error) {
573-
infraPath := path.Join(ClusterScopedResources, configOCPInfra, "cluster.yaml")
573+
infraPath := path.Join(clusterScopedResources, configOCPInfra, "cluster.yaml")
574574
fullInfraPath, err := getMustGatherFullPaths(mustGatherDirPath, infraPath)
575575
if fullInfraPath == "" || err != nil {
576576
return false, fmt.Errorf("failed to get Infrastructure object from must gather directory path: %s; %w", mustGatherDirPath, err)

0 commit comments

Comments
 (0)