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 to support WWPNs in host. #176

Merged
merged 8 commits into from
Mar 13, 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
6 changes: 3 additions & 3 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.55.2
github.com/hashicorp/terraform-plugin-docs v0.18.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hewlettpackard/hpegl-metal-client v1.5.9
github.com/hewlettpackard/hpegl-metal-client v1.5.10
github.com/hewlettpackard/hpegl-provider-lib v0.0.14
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v2 v2.4.0
Expand Down Expand Up @@ -225,8 +225,8 @@ require (
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.14.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ 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.9 h1:vAu6XfT0zfAdYU8487j3WPOWkP1Az0yGG7Mc4yDNvqk=
github.com/hewlettpackard/hpegl-metal-client v1.5.9/go.mod h1:5E6K3bq3aoBNuolGpbmeD/JuAarnXS96W/MqiHUTmFQ=
github.com/hewlettpackard/hpegl-metal-client v1.5.10 h1:8E7JWzFrQoVH4x1EKTIG5vrKmWdXhennQquRuBne8hI=
github.com/hewlettpackard/hpegl-metal-client v1.5.10/go.mod h1:E72/o32a5WwVAUhXvXEUKZOGiSA84hsTS+xezFqtbgU=
github.com/hewlettpackard/hpegl-provider-lib v0.0.14 h1:fwIXQsdEdeYYvaJQr1vwfPgCGYKgZaP7kL0p8xbBQJ4=
github.com/hewlettpackard/hpegl-provider-lib v0.0.14/go.mod h1:7StTTobQIl8pZCLcJnZm0/+N4lNE2MO6H/U0LhTfXog=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
Expand Down Expand Up @@ -854,6 +856,8 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand All @@ -866,6 +870,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.14.0 h1:P0Vrf/2538nmC0H+pEQ3MNFRRnVR7RlqyVw+bvm26z0=
golang.org/x/oauth2 v0.14.0/go.mod h1:lAtNWgaWfL4cm7j2OV8TxGi9Qb7ECORx8DktCY74OwM=
golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ=
golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA=
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
16 changes: 16 additions & 0 deletions internal/resources/resource_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const (
hLabels = "labels"
hSummaryStatus = "summary_status"
hHostActionAsync = "host_action_async"
hWWPNS = "wwpns"

// allowedImageLength is number of Image related attributes that can be provided in the from of 'image@version'.
allowedImageLength = 2
Expand Down Expand Up @@ -263,6 +264,14 @@ func hostSchema() map[string]*schema.Schema {
Default: true,
Description: "set true to do host create, update, and delete asynchronously. The default is true.",
},
hWWPNS: {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Description: "FC HBA world wide port names.",
},
}
}

Expand Down Expand Up @@ -566,6 +575,7 @@ func resourceMetalHostRead(d *schema.ResourceData, meta interface{}) (err error)
}

hostvas := getVAsForHost(host.ID, varesources)

volumeInfos := make([]map[string]interface{}, 0, len(hostvas))
for _, i := range hostvas {
vi := map[string]interface{}{
Expand All @@ -590,6 +600,11 @@ func resourceMetalHostRead(d *schema.ResourceData, meta interface{}) (err error)
d.Set(hCHAPUser, host.ISCSIConfig.CHAPUser)
d.Set(hCHAPSecret, host.ISCSIConfig.CHAPSecret)
d.Set(hInitiatorName, host.ISCSIConfig.InitiatorName)

if err := d.Set(hWWPNS, host.WWPNs); err != nil {
return fmt.Errorf("set WWPNs: %v", err)
}

if err = d.Set(hNetForDefaultRouteID, host.NetworkForDefaultRoute); err != nil {
return err
}
Expand Down Expand Up @@ -688,6 +703,7 @@ func resourceMetalHostUpdate(d *schema.ResourceData, meta interface{}) (err erro
if err != nil {
return fmt.Errorf("error reading volume attachment information %v", err)
}

hostvas := getVAsForHost(host.ID, varesources)

// desired volume IDs
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.50
1.3.51
Loading