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

Fixes #17641 - Use force when destroying VMs #4104

Merged
merged 1 commit into from Dec 21, 2016

Conversation

@agx
Copy link
Member

agx commented Dec 12, 2016

There's no point in waiting several seconds for any guest utils to shut
down the VM when we want to get rid of it as quickly as possible. This
also works around cases like

2016-12-12T10:33:22 [app] [W] Failed to destroy a compute foo (VMware) instance bar.example.com: ToolsUnavailable: Der Vorgang kann nicht abgeschlossen werden, weil VMware Tools auf dieser virtuellen Maschine nicht ausgeführt wird.
| RbVmomi::Fault: ToolsUnavailable: Der Vorgang kann nicht abgeschlossen werden, weil VMware Tools auf dieser virtuellen Maschine
nicht ausgeführt wird.
| /usr/share/foreman/vendor/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:61:in parse_response' | /usr/share/foreman/vendor/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:90:in call'
| /usr/share/foreman/vendor/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:205:in _call' | /usr/share/foreman/vendor/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:74:in block (2 levels) in init'
| /usr/share/foreman/vendor/ruby/2.1.0/gems/fog-1.34.0/lib/fog/vsphere/requests/compute/vm_power_off.rb:17:in vm_power_off' | /usr/share/foreman/vendor/ruby/2.1.0/gems/fog-1.34.0/lib/fog/vsphere/models/compute/server.rb:94:in stop'
| /usr/share/foreman/vendor/ruby/2.1.0/gems/fog-1.34.0/lib/fog/vsphere/models/compute/server.rb:107:in destroy' | /usr/share/foreman/app/models/compute_resource.rb:155:in destroy_vm'
| /usr/share/foreman/app/models/concerns/orchestration/compute.rb:164:in delCompute' | /usr/share/foreman/app/models/concerns/orchestration.rb:168:in execute'

where VMWare misdetecs the Openvm tools status.

@mention-bot
Copy link

mention-bot commented Dec 12, 2016

@agx, thanks for your PR! By analyzing the history of the files in this pull request, we identified @abenari, @ohadlevy and @domcleal to be potential reviewers.

@theforeman-bot
Copy link
Member

theforeman-bot commented Dec 12, 2016

There were the following issues with the commit message:

  • commit message for fd586d3 is not wrapped at 72nd column
  • commit message for fd586d3 is not wrapped at 72nd column
  • commit message for fd586d3 is not wrapped at 72nd column
  • commit message for fd586d3 is not wrapped at 72nd column
  • commit message for fd586d3 is not wrapped at 72nd column
  • commit message for fd586d3 is not wrapped at 72nd column
  • commit message for fd586d3 is not wrapped at 72nd column
  • commit message for fd586d3 is not wrapped at 72nd column
  • commit message for fd586d3 is not wrapped at 72nd column

If you don't have a ticket number, please create an issue in Redmine.

More guidelines are available in Coding Standards or on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

Copy link
Member

dLobatog left a comment

Please check out the comment inline, should be ready to merge after that. Thanks @agx !

@@ -184,7 +184,7 @@ def create_vm(args = {})
end

def destroy_vm(uuid)
find_vm_by_uuid(uuid).destroy
find_vm_by_uuid(uuid).destroy :force => true

This comment has been minimized.

Copy link
@dLobatog

dLobatog Dec 14, 2016

Member

@agx If this is just for VMWare - mind to move the call to vmware.rb? It'd be as simple as rewriting the method in that file, you can see other methods like new_vm etc... have been overridden there already.

The reason is just that we cannot ensure all fog compute resource providers accept this option (or other options at all). Azure for example does not accept any argument on .destroy calls

@agx
Copy link
Member Author

agx commented Dec 16, 2016

There's no point in waiting several seconds for any guest utils to shut
down the VM when we want to get rid of it as quickly as possible.  This
also works around cases like

  2016-12-12T10:33:22 [app] [W] Failed to destroy a compute foo (VMware) instance bar.example.com: ToolsUnavailable: Der Vorgang kann nicht abgeschlossen werden, weil VMware Tools auf dieser virtuellen Maschine nicht ausgeführt wird.
   | RbVmomi::Fault: ToolsUnavailable: Der Vorgang kann nicht abgeschlossen werden, weil VMware Tools auf dieser virtuellen Maschine
  nicht ausgeführt wird.
   | /usr/share/foreman/vendor/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:61:in `parse_response'
   | /usr/share/foreman/vendor/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:90:in `call'
   | /usr/share/foreman/vendor/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:205:in `_call'
   | /usr/share/foreman/vendor/ruby/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:74:in `block (2 levels) in init'
   | /usr/share/foreman/vendor/ruby/2.1.0/gems/fog-1.34.0/lib/fog/vsphere/requests/compute/vm_power_off.rb:17:in `vm_power_off'
   | /usr/share/foreman/vendor/ruby/2.1.0/gems/fog-1.34.0/lib/fog/vsphere/models/compute/server.rb:94:in `stop'
   | /usr/share/foreman/vendor/ruby/2.1.0/gems/fog-1.34.0/lib/fog/vsphere/models/compute/server.rb:107:in `destroy'
   | /usr/share/foreman/app/models/compute_resource.rb:155:in `destroy_vm'
   | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:164:in `delCompute'
   | /usr/share/foreman/app/models/concerns/orchestration.rb:168:in `execute'

where VMWare misdetecs the openvm-tools status.
@agx agx force-pushed the agx:speedup-vm-removal branch from fd586d3 to 8b0977b Dec 20, 2016
@theforeman-bot
Copy link
Member

theforeman-bot commented Dec 20, 2016

There were the following issues with the commit message:

  • commit message for 8b0977b is not wrapped at 72nd column
  • commit message for 8b0977b is not wrapped at 72nd column
  • commit message for 8b0977b is not wrapped at 72nd column
  • commit message for 8b0977b is not wrapped at 72nd column
  • commit message for 8b0977b is not wrapped at 72nd column
  • commit message for 8b0977b is not wrapped at 72nd column
  • commit message for 8b0977b is not wrapped at 72nd column
  • commit message for 8b0977b is not wrapped at 72nd column
  • commit message for 8b0977b is not wrapped at 72nd column

If you don't have a ticket number, please create an issue in Redmine.

More guidelines are available in Coding Standards or on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

@agx
Copy link
Member Author

agx commented Dec 20, 2016

@dLobatog patch updated as you requested

@dLobatog
Copy link
Member

dLobatog commented Dec 21, 2016

Thanks - @agx the problem with using it in general for all compute resources is that Foreman relies on fog (https://github.com/fog/) for these operations. We'd have to go over each of the ones that do not support :force, add it, then wait until a new release, then incorporate the release in Foreman.

I'll wrap your commit to the 72nd column & merge, thanks again

@dLobatog dLobatog merged commit 6816de9 into theforeman:develop Dec 21, 2016
5 of 6 checks passed
5 of 6 checks passed
foreman Build finished.
Details
codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound No violations found. Woof!
katello Build finished.
Details
upgrade Build finished.
Details
@timogoebel
Copy link
Member

timogoebel commented Dec 21, 2016

@agx : Could you please "fix" the commit message? I'll he happy to quickly test this after and we're ready to 🚢 .

@agx
Copy link
Member Author

agx commented Dec 21, 2016

@timogoebel
Copy link
Member

timogoebel commented Dec 21, 2016

@agx : Daniel has already merged this, so nevermind. I was a few seconds too slow. :-)
Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.