Skip to content

Commit

Permalink
Perfomance fix for Object Storage Manager deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
aiperon committed Feb 21, 2017
1 parent 6cf9c9d commit 9215caa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/models/manageiq/providers/storage_manager/object_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ module ManageIQ::Providers::StorageManager::ObjectMixin

included do
has_many :cloud_object_store_containers, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_object_store_objects, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_object_store_objects, :foreign_key => :ems_id

supports :object_storage

after_destroy :cleanup_objects

private

def cleanup_objects
cloud_object_store_objects.includes(:taggings).find_each(&:destroy)
end
end
end

0 comments on commit 9215caa

Please sign in to comment.