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

Add a tool to purge archived storages #18902

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Jun 20, 2019

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=1721612

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.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1721612
@agrare agrare force-pushed the bz_1721612_purge_archived_datastores branch from 9ac034b to 8e440be Compare June 20, 2019 19:41
@miq-bot
Copy link
Member

miq-bot commented Jun 20, 2019

Checked commits agrare/manageiq@f373528~...8e440be with ruby 2.3.3, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 2 offenses detected

tools/purge_archived_storages.rb

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.

👍

@gtanzillo gtanzillo added this to the Sprint 114 Ending Jun 24, 2019 milestone Jun 20, 2019
@gtanzillo gtanzillo merged commit fb347be into ManageIQ:master Jun 20, 2019
@agrare agrare deleted the bz_1721612_purge_archived_datastores branch June 20, 2019 22:35
@simaishi
Copy link
Contributor

@agrare "trollop" in hammer branch, FYI.

@agrare
Copy link
Member Author

agrare commented Jun 25, 2019

@simaishi okay I'll make a PR for hammer

agrare pushed a commit to agrare/manageiq that referenced this pull request Jun 25, 2019
…ed_datastores

Add a tool to purge archived storages

(cherry picked from commit fb347be)
@agrare
Copy link
Member Author

agrare commented Jun 25, 2019

@simaishi #18911

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.

4 participants