Hey Guys,
had a new issue due to delete an Archived VM in your
tools/purge_archived_vms.rb
First of all, your script has a bug:
[root@otto01 vmdb]# bin/rails r tools/purge_archived_vms.rb
DEPRECATION WARNING: `config.serve_static_files` is deprecated and will be removed in Rails 5.1.
Please use `config.public_file_server.enabled = false` instead.
(called from serve_static_files= at /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/railties-5.0.0.rc2/lib/rails/application/configuration.rb:81)
[----] I, [2017-02-24T16:44:14.069354 #8893:699984] INFO -- : Searching for archived VMs older than 2017-01-24 15:44:14 UTC UTC.
[----] W, [2017-02-24T16:44:14.069454 #8893:699984] WARN -- : Will delete any matching records.
/opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/bundler/gems/rails-6c2301d7fd22/activerecord/lib/active_record/relation/batches.rb:111:in `find_in_batches': unknown keywords: conditions, include (ArgumentError)
from /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/bundler/gems/rails-6c2301d7fd22/activerecord/lib/active_record/querying.rb:9:in `find_in_batches'
from tools/purge_archived_vms.BAK:19:in `<top (required)>'
from /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/railties-5.0.0.rc2/lib/rails/commands/runner.rb:60:in `load'
from /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/railties-5.0.0.rc2/lib/rails/commands/runner.rb:60:in `<top (required)>'
from /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/railties-5.0.0.rc2/lib/rails/commands/commands_tasks.rb:138:in `require'
from /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/railties-5.0.0.rc2/lib/rails/commands/commands_tasks.rb:138:in `require_command!'
from /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/railties-5.0.0.rc2/lib/rails/commands/commands_tasks.rb:104:in `runner'
from /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/railties-5.0.0.rc2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /opt/rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/gems/railties-5.0.0.rc2/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Fixed that with:
Vm.where("vms.updated_on IS NULL OR vms.updated_on < '#{ARCHIVE_CUTOFF}'").each do |vm|
But this is not the issue.
My problem: during this script is that a deletion of 1 VM takes more than 30 seconds. In some Environments we getting more VMs during this period than we’re able to delete…
Is there another possibility to delete VMs ? Or do you have a hint which component we have to debug to tune up the deletion a bit?
Thanks for your help !