-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
vSphere Provider - Fix destroy when vm is powered off or has no networks #7206
Conversation
This does add an interesting caveat where if you try to run
This is sort of a grey area since handling a powered off vm is not really a handled case at the moment. This prompts a discussion about the ability to handle/recover from different power states, but that should be in a separate issue/PR :) . This PR resolves a known issue of not being able to destroy a vm that is powered off or has no network interfaces. |
@chrislovecnm @stack72 @phinze |
When should we be waiting for all ips, one ip, or customization to be done? This has been a constant thorn in our side, and this PR looks like a good point to address it ;) |
the |
@thetuxkeeper I did a test with that WaitForNetIP() removed and the Update() called the Read() before the vm was up, which resulted in the Read() not finding the networks and messing up the tfstate. I think it's important to have at the end of the Update() so that the Read() happens once the vm is in a stable state. |
b43e1a7
to
6881fc0
Compare
@dkalleg we are dev ops guys, not be paranoid gets us woken up at 2am 😄 |
@dkalleg : that's strange. that was the reason why I put the |
@thetuxkeeper you have a chance to test this? |
This patch adds a wait when powering on a vm so setupVirtualMachine does not return until the vm is actually powered on. This allows other functions to work off the assumption that the current state of the vm is not in flux. During resourceVSphereVirtualMachineRead(), the wait for IP would cause a hang for any VM with no network interfaces or for vms that had been powered off for any reason. This also means that the user could not delete a vm with no network interfaces or that is powered off. Checking power state before trying to check for network interfaces. Resolves hashicorp#7168
6881fc0
to
053b1eb
Compare
@thetuxkeeper @stack72 @phinze @jen20 @chrislovecnm |
@thetuxkeeper @stack72 @phinze @jen20 @chrislovecnm |
Nothing from me. I think we can merge it. If I find the time to run the tests, I'll do it. But would be safer if someone else did it (I'm still struggling with this new cloud stuff on detail level ... :D ) |
@stack72 Could you take a look at this? |
@dkalleg do we need a test for this? Otherwise, what is the status of you running the integration tests? Overall looks great, and I appreciate the effort. |
@chrislovecnm Sorry, missed this. Tests are passing on my end. This might be a little overly specific of a use case to make a test for. |
Thanks @stack72 ! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This patch adds a wait when powering on a vm so setupVirtualMachine does
not return until the vm is actually powered on. This allows other
functions to work off the assumption that the current state of the vm
is not in flux. During resourceVSphereVirtualMachineRead(), the wait for
IP would cause a hang for any VM with no network interfaces or for vms
that had been powered off for any reason. This also means that the user
could not delete a vm with no network interfaces or that is powered off.
Checking power state before trying to check for network interfaces.
Resolves #7168