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

[Enhancement]: Add SVM QoS Policy Activation #346

Open
wants to merge 5 commits into
base: integration/main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "netapp-ontap_svm_qos_policy_activation" "example" {
cx_profile_name = "cluster4"
svm = {
name = "svm02"
}
qos_policy = {
name = "performance-svm02"
}
}
37 changes: 34 additions & 3 deletions internal/interfaces/svm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ type SvmDataModelONTAP struct {
// SvmResourceModel describes the resource data model.
type SvmResourceModel struct {
Name string `mapstructure:"name,omitempty"`
UUID string `mapstructure:"uuid,omitempty"`
Ipspace Ipspace `mapstructure:"ipspace"`
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"`
SubType string `mapstructure:"subtype,omitempty"`
Comment string `mapstructure:"comment"`
Language string `mapstructure:"language,omitempty"`
MaxVolumes string `mapstructure:"max_volumes,omitempty"`
Aggregates []map[string]string `mapstructure:"aggregates"`
Aggregates []map[string]string `mapstructure:"aggregates,omitempty"`
QoSPolicy QoSPolicy `mapstructure:"qos_policy"`
}

// SvmGetDataSourceModel describes the data source model.
Expand All @@ -45,6 +47,7 @@ type SvmGetDataSourceModel struct {
Language string `mapstructure:"language,omitempty"`
Aggregates []Aggregate `mapstructure:"aggregates,omitempty"`
MaxVolumes string `mapstructure:"max_volumes,omitempty"`
QoSPolicy QoSPolicy `mapstructure:"qos_policy"`
}

// Ipspace describes the resource data model.
Expand All @@ -57,6 +60,12 @@ type SnapshotPolicy struct {
Name string `mapstructure:"name,omitempty"`
}

// QoSPolicy describes the resource data model.
type QoSPolicy struct {
Name string `mapstructure:"name,omitempty"`
UUID string `mapstructure:"uuid,omitempty"`
}

// SvmDataSourceFilterModel describes the data source data model for queries.
type SvmDataSourceFilterModel struct {
Name string `mapstructure:"name"`
Expand Down Expand Up @@ -125,7 +134,18 @@ func GetSvmByNameIgnoreNotFound(errorHandler *utils.ErrorHandler, r restclient.R
func GetSvmByNameDataSource(errorHandler *utils.ErrorHandler, r restclient.RestClient, name string) (*SvmGetDataSourceModel, error) {
api := "svm/svms"
query := r.NewQuery()
query.Fields([]string{"name", "ipspace", "snapshot_policy", "subtype", "comment", "language", "max_volumes", "aggregates"})
query.Fields([]string{
"name",
"uuid",
"ipspace",
"snapshot_policy",
"subtype",
"comment",
"language",
"max_volumes",
"aggregates",
"qos_policy",
})
query.Add("name", name)
statusCode, response, err := r.GetNilOrOneRecord(api, query, nil)
if err == nil && response == nil {
Expand All @@ -147,7 +167,18 @@ func GetSvmByNameDataSource(errorHandler *utils.ErrorHandler, r restclient.RestC
func GetSvmsByName(errorHandler *utils.ErrorHandler, r restclient.RestClient, filter *SvmDataSourceFilterModel) ([]SvmGetDataSourceModel, error) {
api := "svm/svms"
query := r.NewQuery()
query.Fields([]string{"name", "ipspace", "snapshot_policy", "subtype", "comment", "language", "max_volumes", "aggregates"})
query.Fields([]string{
"name",
"uuid",
"ipspace",
"snapshot_policy",
"subtype",
"comment",
"language",
"max_volumes",
"aggregates",
"qos_policy",
})

if filter != nil {
var filterMap map[string]interface{}
Expand Down
1 change: 1 addition & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ func (p *ONTAPProvider) Resources(ctx context.Context) []func() resource.Resourc
storage.NewVolumeFileResource,
svm.NewSVMPeerResource,
svm.NewSvmResource,
svm.NewSvmQosPolicyActivationResource,
// The following resources are Alias for the version 1 names
cluster.NewClusterLicensingLicenseResourceAlias,
cluster.NewClusterPeerResourceAlias,
Expand Down
Loading
Loading