Skip to content

Commit

Permalink
feat: data protection dashboard - part1 - with subtables
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardikl committed Nov 23, 2021
1 parent 6136e3f commit 9c9f608
Show file tree
Hide file tree
Showing 3 changed files with 666 additions and 146 deletions.
43 changes: 43 additions & 0 deletions cmd/collectors/zapi/plugins/snapmirror/snapmirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ func (my *SnapMirror) Run(data *matrix.Matrix) ([]*matrix.Matrix, error) {
srcUpdCount += 1
}
}

// update the protectedBy and protectionSourceType fields in snapmirror_labels
my.updateProtectedfields(instance)
} else {
// 7 Mode
// source / destination nodes can be something like:
Expand Down Expand Up @@ -246,3 +249,43 @@ func (my *SnapMirror) updateLimitCache() error {
my.Logger.Debug().Msgf("updated limit cache for %d nodes", count)
return nil
}

func (my *SnapMirror) updateProtectedfields(instance *matrix.Instance) {

// check for group_type
if instance.GetLabel("group_type") != "" {

groupType := instance.GetLabel("group_type")
destinationVolume := instance.GetLabel("destination_volume")
sourceVolume := instance.GetLabel("source_volume")
destinationLocation := instance.GetLabel("destination_location")

isSvmDr := groupType == "vserver" && destinationVolume == "" && sourceVolume == ""
isCg := groupType == "CONSISTENCYGROUP" && strings.Contains(destinationLocation, ":/cg/")
isConstituentVolumeRelationshipWithinSvmDr := groupType == "vserver" && !strings.HasSuffix(destinationLocation, ":")
isConstituentVolumeRelationshipWithinCG := groupType == "CONSISTENCYGROUP" && !strings.Contains(destinationLocation, ":/cg/")

if isSvmDr || isConstituentVolumeRelationshipWithinSvmDr {
instance.SetLabel("protectedBy", "storage_vm")
my.Logger.Info().Msgf("%s ", "storage_vm")
} else if isCg || isConstituentVolumeRelationshipWithinCG {
instance.SetLabel("protectedBy", "cg")
my.Logger.Info().Msgf("%s ", "cg")
} else {
instance.SetLabel("protectedBy", "volume")
my.Logger.Info().Msgf("%s ", "volume")
}

// SVM-DR related information is populated
if isSvmDr {
instance.SetLabel("protectionSourceType", "storage_vm")
my.Logger.Info().Msgf("%s ", "storage_vm")
} else if isCg {
instance.SetLabel("protectionSourceType", "cg")
my.Logger.Info().Msgf("%s ", "cg")
} else if isConstituentVolumeRelationshipWithinSvmDr || isConstituentVolumeRelationshipWithinCG || groupType == "none" || groupType == "flexgroup" {
instance.SetLabel("protectionSourceType", "volume")
my.Logger.Info().Msgf("%s ", "volume")
}
}
}
4 changes: 4 additions & 0 deletions conf/zapi/cdot/9.8.0/snapmirror.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ counters:
- ^unhealthy-reason
- update-failed-count
- update-successful-count
- ^destination-location

plugins:
- Snapmirror
Expand All @@ -55,3 +56,6 @@ export_options:
- destination_node_limit
- source_node_limit
- group_type
- destination_location
- protectedBy
- protectionSourceType
Loading

0 comments on commit 9c9f608

Please sign in to comment.