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

Refactor Resource volume attach and documentation #89

Closed
wants to merge 4 commits into from

Conversation

Diptipowervs
Copy link

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@@ -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"
Copy link
Collaborator

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: {
Copy link
Collaborator

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: {
Copy link
Collaborator

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

Copy link
Author

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 {
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

See above comment

Comment on lines +176 to +177
Pending: []string{"retry", Attr_VolumeProvisioning},
Target: []string{Attr_VolumeAllowableAttachStatus},
Copy link
Collaborator

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"

Copy link
Author

Choose a reason for hiding this comment

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

changes made

@Diptipowervs Diptipowervs requested a review from michaelkad March 28, 2024 15:37
@michaelkad
Copy link
Collaborator

Opened #133

@michaelkad michaelkad closed this May 31, 2024
@michaelkad michaelkad deleted the resource-volume-attach branch September 6, 2024 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants