-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor Resource volume attach and documentation #89
Conversation
@@ -8,6 +8,7 @@ const ( | |||
Arg_CloudInstanceID = "pi_cloud_instance_id" | |||
Arg_ImageName = "pi_image_name" | |||
Arg_InstanceName = "pi_instance_name" | |||
Arg_InstanceId = "pi_instace_id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already have Arg_PVMInstanceId
define
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
Arg_InstanceId: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Arg_PVMInstanceId
}, | ||
|
||
// Computed Attribute | ||
helpers.PIVolumeAttachStatus: { | ||
Attr_VolumeAttachStatus: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should Attr_Status = status
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
@@ -89,7 +88,7 @@ func resourceIBMPIVolumeAttachCreate(ctx context.Context, d *schema.ResourceData | |||
log.Printf("Volume State /Status is permitted and hence attaching the volume to the instance") | |||
} | |||
|
|||
if volinfo.State == helpers.PIVolumeAllowableAttachStatus && !*volinfo.Shareable { | |||
if volinfo.State == Attr_VolumeAllowableAttachStatus && !*volinfo.Shareable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value of PIVolumeAllowableAttachStatus = "in-use"
need to be updated
|
||
vol, err := client.CheckVolumeAttach(pvmInstanceID, volumeID) | ||
if err != nil { | ||
return diag.FromErr(err) | ||
} | ||
|
||
d.Set(helpers.PIVolumeAttachStatus, vol.State) | ||
d.Set(Attr_VolumeAttachStatus, vol.State) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above comment
Pending: []string{"retry", Attr_VolumeProvisioning}, | ||
Target: []string{Attr_VolumeAllowableAttachStatus}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update the const to be those
PIVolumeProvisioning = "creating"
PIVolumeAllowableAttachStatus = "in-use"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes made
Opened #133 |
Community Note
Relates OR Closes #0000
Output from acceptance testing: