-
Notifications
You must be signed in to change notification settings - Fork 669
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
Fix ibm pi instance update wait for status #4259
Fix ibm pi instance update wait for status #4259
Conversation
The target state is either 'ACTIVE' or 'SHUTOFF', but only 'SHUTOFF' was mentioned in the log message. This commit adds 'ACTIVE' to the log message.
PowerVS VSI update in-place with 'ibm_pi_instance' timed out when VSI status is 'SHUTDOWN' because it was using the 'isWaitForPIInstanceAvailable' poll (but the VSI will never reach 'ACTIVE' state without some external operation). When an 'ibm_pi_instance' resource can be updated in-place _without_ a reboot the final "isWaitFor" poll should be targeting both 'ACTIVE' and 'SHUTOFF' states (since the VSI will return to it's starting state after a successful 'RESIZE').
Can you please add test case results and scenario based test results |
The Setup:
|
@yussufsh The existing code has been like this for 3 years. I wonder if the back end services changed behavior to cause the VM to go to VERIFY_RESIZE and then SHUTDOWN when resizing down? The service broker code does not look changed recently so it may be further down the stack. I'll run some tests with another client to see if the root cause is on the server side & not in Terraform and post results here. |
OK I see in the logs posted in 4258 that the VM was SHUTDOWN prior to the update operation and so after the update the VM went back to SHUTDOWN state after the resizing states. I reproduced this behavior using the CLI. @yussufsh @dhirendersingh19 I think one option is to check the VM state prior to the update operation and look for that state after the update operation use that as a target state. Or Jay's change to use the isWaitforPIInstanceUpdate function I think would work as well except it doesn't cover error states like the original call to isWaitForPIInstanceAvailable function. |
Since the Pending state is limited to See https://github.com/hashicorp/terraform-plugin-sdk/blob/main/helper/resource/state.go#L44-L45:
I don't understand why error states are included as |
I think the original coder listed the ERROR state as a target since that is a state from which terraform does not have to wait for completion anymore and they did not want to stop the rest of the terraform config from processing. But if we are covered for the ERROR state by the state.go processing then I am OK with the current change. Yussuf and Dhirender do you have concerns? |
@jaywcarman I am going to revert this change since it is causing regressions in the scenarios where the PVM instance is active state. I should have asked you why you shutdown your PVM instance to do the mem/proc change outside terraform (in CLI or GUI)? The PVM instance only needs to be shutdown in when mem or proc is greater than maxMemLpar and maxCPULpar . . .
|
* Fix target state info in wait for update log The target state is either 'ACTIVE' or 'SHUTOFF', but only 'SHUTOFF' was mentioned in the log message. This commit adds 'ACTIVE' to the log message. * Fix ibm_pi_instance update in place without reboot PowerVS VSI update in-place with 'ibm_pi_instance' timed out when VSI status is 'SHUTDOWN' because it was using the 'isWaitForPIInstanceAvailable' poll (but the VSI will never reach 'ACTIVE' state without some external operation). When an 'ibm_pi_instance' resource can be updated in-place _without_ a reboot the final "isWaitFor" poll should be targeting both 'ACTIVE' and 'SHUTOFF' states (since the VSI will return to it's starting state after a successful 'RESIZE').
The problem is the isWaitforPIInstanceUpdate doesn't actually detect the target state of Active since the refresh function it uses never passes that state (only SHUTOFF, RESIZE and "") even though the "ACTIVE" string is listed as a Target state in list . . .
In the case where mem and proc is changed and no shutdown is needed, the update operation will timeout since shutdown state is never seen. I don't think the manual step (via cli or GUI )of shutting down the VM is needed since the terraform code in the comment above will perform the reboot if needed. |
Community Note
Fixes #4258