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

[HAMMER] Add a tool to purge archived storages #18911

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Jun 25, 2019

Backport of #18902 to replace optimist with trollop

Storages that aren't connected to any hosts aren't automatically deleted
and thus a tool is needed to clean them up.

This looks for storages which aren't represented in the host_storages
table which means they aren't a part of any EMS and can be removed.


>> Storage.create!(:name => "my storage")
>> Storage.create!(:name => "my other storage")

$ tools/purge_archived_storages.rb
* This is a dry run and will not modify the database
* To actually delete archived datastores pass --no-dry-run

Deleting the following storages:
ID [11] Name [my storage]
ID [12] Name [my other storage]

$ tools/purge_archived_storages.rb --no-dry-run
Deleting the following storages:
ID [11] Name [my storage]
ID [12] Name [my other storage]

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1723832

…ed_datastores

Add a tool to purge archived storages

(cherry picked from commit fb347be)
Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just the comment about Trollop

require File.expand_path('../config/environment', __dir__)
require "trollop"

opts = Trollop.options do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how important this is but we should probably be using Optimist here instead of Trollop

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually using trollop was the purpose here since hammer branch doesn't have optimist. #18902 (comment)

@agrare agrare changed the title Add a tool to purge archived storages [HAMMER] Add a tool to purge archived storages Jul 1, 2019
@simaishi simaishi merged commit d89bc16 into ManageIQ:hammer Jul 1, 2019
@simaishi simaishi added this to the Sprint 115 Ending Jul 8, 2019 milestone Jul 1, 2019
@agrare agrare deleted the hammer_bz_1723832_purge_archived_datastores branch July 2, 2019 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants