From a4b24e2d9de9d59217a65d30a492a66d3d87618d Mon Sep 17 00:00:00 2001 From: Ron Saito Date: Thu, 13 Jun 2024 16:30:06 -0600 Subject: [PATCH 1/4] DE22222: iSCSI volumes are failing to attach to host --- internal/resources/resource_host.go | 10 ++++++---- version | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/resources/resource_host.go b/internal/resources/resource_host.go index 6655449..aef18df 100644 --- a/internal/resources/resource_host.go +++ b/internal/resources/resource_host.go @@ -508,6 +508,7 @@ func resourceMetalHostCreate(d *schema.ResourceData, meta interface{}) (err erro Pending: []string{ string(rest.HOSTSTATE_NEW), string(rest.HOSTSTATE_IMAGING_PREP), + string(rest.HOSTSTATE_ISCSI_ATTACHING), string(rest.HOSTSTATE_IMAGING), string(rest.HOSTSTATE_CONNECTING), string(rest.HOSTSTATE_ATTACHING), @@ -749,9 +750,10 @@ func resourceMetalHostUpdate(d *schema.ResourceData, meta interface{}) (err erro } updateHost := rest.UpdateHost{ - ID: host.ID, - ETag: host.ETag, - Name: host.Name, + ID: host.ID, + ETag: host.ETag, + Name: host.Name, + ISCSIConfig: &rest.UpdateHostIscsiConfig{}, } // description @@ -886,7 +888,7 @@ func resourceMetalHostDelete(d *schema.ResourceData, meta interface{}) (err erro // the delete operation from Terraform (since it has no reference to the resource). deleteStateConf := &retry.StateChangeConf{ Pending: []string{ - string(rest.HOSTSTATE_DETACHING), + string(rest.HOSTSTATE_ALL_DETACHING), string(rest.HOSTSTATE_DELETING), }, Target: []string{ diff --git a/version b/version index b576a43..140e9ea 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.3.54 +1.3.55 From 68bb3de9461344a6c6c293826de90818ec3a21df Mon Sep 17 00:00:00 2001 From: Ron Saito Date: Thu, 13 Jun 2024 16:32:11 -0600 Subject: [PATCH 2/4] bump the version to be consistent to with the release tag (to be bumped) --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 140e9ea..9fb4137 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.3.55 +1.3.56 From f33f42b8c26c04b0f24dcdb58d0a7c75791df023 Mon Sep 17 00:00:00 2001 From: Denis Bozzato Date: Thu, 13 Jun 2024 22:39:56 -0500 Subject: [PATCH 3/4] IQN fix --- internal/resources/resource_host.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/resources/resource_host.go b/internal/resources/resource_host.go index aef18df..b9ed778 100644 --- a/internal/resources/resource_host.go +++ b/internal/resources/resource_host.go @@ -750,10 +750,9 @@ func resourceMetalHostUpdate(d *schema.ResourceData, meta interface{}) (err erro } updateHost := rest.UpdateHost{ - ID: host.ID, - ETag: host.ETag, - Name: host.Name, - ISCSIConfig: &rest.UpdateHostIscsiConfig{}, + ID: host.ID, + ETag: host.ETag, + Name: host.Name, } // description @@ -763,8 +762,10 @@ func resourceMetalHostUpdate(d *schema.ResourceData, meta interface{}) (err erro // initiator name updInitiatorName, ok := d.Get(hInitiatorName).(string) - if ok && updInitiatorName != "" && updInitiatorName != host.ISCSIConfig.InitiatorName { - updateHost.ISCSIConfig.InitiatorName = updInitiatorName + if (ok && updInitiatorName != "") && (updInitiatorName != host.ISCSIConfig.InitiatorName) { + updateHost.ISCSIConfig = &rest.UpdateHostIscsiConfig{ + InitiatorName: updInitiatorName, + } } // set the network ids From f41d47eb569c6b5d04a3cc4e7194916aca5aea0a Mon Sep 17 00:00:00 2001 From: Ron Saito Date: Fri, 14 Jun 2024 07:12:53 -0600 Subject: [PATCH 4/4] address review comment --- internal/resources/resource_host.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/resources/resource_host.go b/internal/resources/resource_host.go index b9ed778..b0699ba 100644 --- a/internal/resources/resource_host.go +++ b/internal/resources/resource_host.go @@ -889,6 +889,7 @@ func resourceMetalHostDelete(d *schema.ResourceData, meta interface{}) (err erro // the delete operation from Terraform (since it has no reference to the resource). deleteStateConf := &retry.StateChangeConf{ Pending: []string{ + string(rest.HOSTSTATE_DETACHING), string(rest.HOSTSTATE_ALL_DETACHING), string(rest.HOSTSTATE_DELETING), },