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

Added changes in volume object. #228

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/golangci/golangci-lint v1.58.2
github.com/hashicorp/terraform-plugin-docs v0.19.4
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/hewlettpackard/hpegl-metal-client v1.5.23
github.com/hewlettpackard/hpegl-metal-client v1.5.24
github.com/hewlettpackard/hpegl-provider-lib v0.0.21
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v2 v2.4.0
Expand Down Expand Up @@ -231,7 +231,7 @@ require (
golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this dependency has changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbozzato81, I didn't do anything except the change at line 9 and "go mod tidy".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was part of the new metal-client release:
image

golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S
github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc=
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/hewlettpackard/hpegl-metal-client v1.5.23 h1:EQuYg4qGpUUF11hNYqb3ekzUKgqIfQd2RNg1Y3SCGqc=
github.com/hewlettpackard/hpegl-metal-client v1.5.23/go.mod h1:+BO4BfQXf3IWnsxvk2IdE27Ijrm1jDVYIgpebYh1L9M=
github.com/hewlettpackard/hpegl-metal-client v1.5.24 h1:x9UgKqw3nZ2LG45iEFqtAkXM7Ghg5R1xwEHXPDgE2FQ=
github.com/hewlettpackard/hpegl-metal-client v1.5.24/go.mod h1:DJRxRgIRZf+Wb8soq3RTKh2f3l0KhJLlfUWrY5/twcw=
github.com/hewlettpackard/hpegl-provider-lib v0.0.21 h1:35cmYg/UceVtxZHDMCKcEeAGhdJ5rzWi7JRrY/hS0BY=
github.com/hewlettpackard/hpegl-provider-lib v0.0.21/go.mod h1:Bw2DhefBjqXQI6s5vBBGiWUkFz7fx4KkbGfwmo9wv3U=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
Expand Down Expand Up @@ -849,8 +849,8 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
18 changes: 18 additions & 0 deletions internal/resources/resource_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const (
vCreatedSite = "created_site"
vReplicationEnabled = "replication_enabled"
vExportCount = "export_count"
vDataCenterName = "data_center_name"
vStoragePoolName = "storage_pool_name"

// volume Info constants.
vID = "id"
Expand Down Expand Up @@ -211,6 +213,22 @@ func volumeSchema() map[string]*schema.Schema {
Computed: true,
Description: "The number of active exports for this volume",
},

vDataCenterName: {
Type: schema.TypeString,
Required: false,
Optional: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't one of these be true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this Optional parameter as it is a read only field.

Computed: true,
Description: "Name of the data center where the volume is created on the storage array.",
},

vStoragePoolName: {
Type: schema.TypeString,
Required: false,
Optional: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't one of these be true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a vStoragePool attribute present

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like vStoragePool is not being populated (in the translation layer). Wonder how it's being used by the client (BMaaS UI).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @karthik-radakrishnan and @dbozzato81, I realized that vStoragePool is getting populated using /available-resources API. And if I remove StoragePoolName then we are back to the same problem where vStoragePool can have a specific data to a particular pod location. And same is true with DataCanterName. I will keep both of them as these are read only parameters. Let me know if there are any concerns.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the vStoragePool definition and looking at the code, it seams it is only used for Volume create i.e. it is not getting populated by the provider by it is given by the user in case vStoragePoolID is not.

		vStoragePool: {
			Type:        schema.TypeString,
			Required:    false,
			Optional:    true,
			Description: "The storage pool of the volume to be created.",
		},

So why we can't use it like this?...

		vStoragePool: {
			Type:        schema.TypeString,
			Optional:    true,
                        Computed:  true,
			Description: "The storage pool of the volume to be created.",
		},

Another question, are we sure that vStoragePoolID is computed and returned correctly for external volumes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dbozzato81, vStoragePoolID is assigned to externally managed volumes when we create them in the DB from DCC. This poolID is assigned based on the array volume was created on.

I have explained above for the vStoragePool - This is fetched based on the vStoragePoolID and available-resources response. And then it is used to create Volume.

vStoragePoolName and vDataCenterName are read only fields and if we don't want them to have in terraform then we can discard this PR and make vStoragePool Computed as true

Computed: true,
Description: "Name of the storage pool from where the volume is allocated.",
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.62
1.3.63
Loading