Add retry logic to fix the server terminate failed issue#94
Add retry logic to fix the server terminate failed issue#94nywilken merged 4 commits intohashicorp:mainfrom zhenggu:main
Conversation
|
Anyone can help to have a review? One month has been passed. |
nywilken
left a comment
There was a problem hiding this comment.
@zhenggu apologies for the delayed review here. I had time to look over the changes and left a small suggestion to the code changes. Otherwise I think this looks good to go. Please let me know your thoughts and if there are any issues with the suggested code.
If all works as expected I will merge the changes once updated and cut an immediate release.
|
Hi @nywilken, I have refactored the code as your suggestion, and it works fine, the following is the packer log on this case, please help to approve it. |
|
I fixed the goimports lint check and merged directly. Thank you again. |
|
@nywilken https://github.com/hashicorp/packer it still uses the old version, should I open a PR for that? Or you will include this fix in the next release? |
In our openstack environment, we randomly get the error while terminating the server on the end of packer build.

It causes many useless VMs existing in our openstack.
The error is like this:
The following is the stack trace from OCP service side when the issue happened.
According to the logic of packer-plugin-openstack, when the status of the image has become
active, then packer will try to remove the temporary VM immediately, if the remove action fails, then the error will happen.From the stack trace, when the status of the image has been changed to
active, the image uploading task of the VM hasn't been finished.Then the VM delete action will be failed, and OCP service will report:
Internal Server Error, and the HTTP error code is 500.In this PR, a retry logic has been added to detect whether it meets
Internal Server Error, if so, it will have a retry up to 20 seconds.