Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge main to release 24.11 #3263

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions cmd/collectors/rest/plugins/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ type volumeInfo struct {
cloneSnapshotName string
cloneSplitEstimateMetric float64
isObjectStoreVolume bool
isProtected string
isDestinationOntap string
isDestinationCloud string
}

func New(p *plugin.AbstractPlugin) plugin.Plugin {
Expand Down Expand Up @@ -171,6 +174,10 @@ func (v *Volume) updateVolumeLabels(data *matrix.Matrix, volumeMap map[string]vo
}
volume.SetLabel("anti_ransomware_start_time", vInfo.arwStartTime)
volume.SetLabel("antiRansomwareState", vInfo.arwState)
volume.SetLabel("isProtected", vInfo.isProtected)
volume.SetLabel("isDestinationOntap", vInfo.isDestinationOntap)
volume.SetLabel("isDestinationCloud", vInfo.isDestinationCloud)

if volume.GetLabel("is_flexclone") == "true" {
volume.SetLabel("clone_parent_snapshot", vInfo.cloneSnapshotName)
if err = cloneSplitEstimateMetric.SetValueFloat64(volume, vInfo.cloneSplitEstimateMetric); err != nil {
Expand Down Expand Up @@ -290,7 +297,7 @@ func (v *Volume) getEncryptedDisks() ([]gjson.Result, error) {

func (v *Volume) getVolumeInfo() (map[string]volumeInfo, error) {
volumeMap := make(map[string]volumeInfo)
fields := []string{"name", "svm.name", "clone.parent_snapshot.name", "clone.split_estimate", "is_object_store"}
fields := []string{"name", "svm.name", "clone.parent_snapshot.name", "clone.split_estimate", "is_object_store", "snapmirror.is_protected", "snapmirror.destinations.is_ontap", "snapmirror.destinations.is_cloud"}
if !v.isArwSupportedVersion {
return v.getVolume("", fields, volumeMap)
}
Expand Down Expand Up @@ -331,7 +338,10 @@ func (v *Volume) getVolume(field string, fields []string, volumeMap map[string]v
cloneSnapshotName := volume.Get("clone.parent_snapshot.name").String()
cloneSplitEstimate := volume.Get("clone.split_estimate").Float()
isObjectStoreVolume := volume.Get("is_object_store").Bool()
volumeMap[volName+svmName] = volumeInfo{arwStartTime: arwStartTime, arwState: arwState, cloneSnapshotName: cloneSnapshotName, cloneSplitEstimateMetric: cloneSplitEstimate, isObjectStoreVolume: isObjectStoreVolume}
isProtected := volume.Get("snapmirror.is_protected").String()
isDestinationOntap := volume.Get("snapmirror.destinations.is_ontap").String()
isDestinationCloud := volume.Get("snapmirror.destinations.is_cloud").String()
volumeMap[volName+svmName] = volumeInfo{arwStartTime: arwStartTime, arwState: arwState, cloneSnapshotName: cloneSnapshotName, cloneSplitEstimateMetric: cloneSplitEstimate, isObjectStoreVolume: isObjectStoreVolume, isProtected: isProtected, isDestinationOntap: isDestinationOntap, isDestinationCloud: isDestinationCloud}
}
return volumeMap, nil
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/poller/collector/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ type MemMetrics struct {
}

func MemoryMetrics() MemMetrics {
slog.Info("foo")

var memStats MemMetrics

// Get runtime metrics
Expand Down
1 change: 1 addition & 0 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,7 @@ func checkVariablesAreFSxFriendly(t *testing.T, path string, data []byte) {
exceptionValues := map[string]bool{
"cmode/metadata.json": true,
"cmode/snapmirror_destinations.json": true,
"cmode/snapmirror.json": true,
}

gjson.GetBytes(data, "templating.list").ForEach(func(key, value gjson.Result) bool {
Expand Down
7 changes: 2 additions & 5 deletions cmd/tools/grafana/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,8 @@ func exportFiles(dir string, folder *Folder) error {
return nil
}

func addSvmRegex(content []byte, fileName string, val string) []byte {
func addSvmRegex(content []byte, val string) []byte {
svmExpression := []string{"templating.list.#(name=\"SVM\")"}
if fileName == "snapmirror.json" {
svmExpression = []string{"templating.list.#(name=\"DestinationSVM\")", "templating.list.#(name=\"SourceSVM\")"}
}
for _, s := range svmExpression {
var err error
svm := gjson.GetBytes(content, s)
Expand Down Expand Up @@ -514,7 +511,7 @@ func importFiles(dir string, folder *Folder) {

// add svm regex
if opts.svmRegex != "" {
data = addSvmRegex(data, file.Name(), opts.svmRegex)
data = addSvmRegex(data, opts.svmRegex)
}

// change cluster label if needed
Expand Down
21 changes: 4 additions & 17 deletions cmd/tools/grafana/grafana_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"path/filepath"
"regexp"
"strings"
"testing"
Expand Down Expand Up @@ -113,22 +112,10 @@ func TestAddSvmRegex(t *testing.T) {
VisitDashboards(
[]string{"../../../grafana/dashboards/cmode/svm.json", "../../../grafana/dashboards/cmode/snapmirror.json"},
func(path string, data []byte) {
file := filepath.Base(path)
out := addSvmRegex(data, file, regex)
if file == "svm.json" {
r := gjson.GetBytes(out, "templating.list.#(name=\"SVM\").regex")
if r.String() != regex {
t.Errorf("path: %s \nExpected: [%s]\n Got: [%s]", path, regex, r.String())
}
} else if file == "snapmirror.json" {
r := gjson.GetBytes(out, "templating.list.#(name=\"DestinationSVM\").regex")
if r.String() != regex {
t.Errorf("path: %s \nExpected: [%s]\n Got: [%s]", path, regex, r.String())
}
r = gjson.GetBytes(out, "templating.list.#(name=\"SourceSVM\").regex")
if r.String() != regex {
t.Errorf("path: %s \nExpected: [%s]\n Got: [%s]", path, regex, r.String())
}
out := addSvmRegex(data, regex)
r := gjson.GetBytes(out, "templating.list.#(name=\"SVM\").regex")
if r.String() != regex {
t.Errorf("path: %s \nExpected: [%s]\n Got: [%s]", path, regex, r.String())
}
})
}
Expand Down
3 changes: 3 additions & 0 deletions conf/rest/9.14.0/volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ export_options:
- clone_parent_snapshot
- clone_parent_svm
- clone_parent_volume
- isDestinationCloud
- isDestinationOntap
- isEncrypted
- isHardwareEncrypted
- isProtected
- is_sis_volume
- junction_path
- root_volume
Expand Down
7 changes: 7 additions & 0 deletions conf/zapi/cdot/9.8.0/volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ counters:
- volume-inode-attributes:
- files-total
- files-used
- volume-mirror-attributes:
- ^is-snapmirror-source => isProtected
- ^is-snapmirror-source-to-object-store => isDestinationCloud
- ^is-snapmirror-source-to-ontap => isDestinationOntap
- volume-sis-attributes:
- ^is-sis-volume => is_sis_volume
- compression-space-saved => sis_compress_saved
Expand Down Expand Up @@ -117,8 +121,11 @@ export_options:
- clone_parent_snapshot
- clone_parent_svm
- clone_parent_volume
- isDestinationCloud
- isDestinationOntap
- isEncrypted
- isHardwareEncrypted
- isProtected
- is_sis_volume
- junction_path
- node_root
Expand Down
Loading