Bug 1537766 - [RFE] Spacewalk needs a way for the Spacewalk Adminstrator to manage Snapshots
Summary: [RFE] Spacewalk needs a way for the Spacewalk Adminstrator to manage Snapshots
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 2.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Grant Gainey
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
: 1559360 1559361 (view as bug list)
Depends On:
Blocks: sat58-nth 1554307 space28
TreeView+ depends on / blocked
 
Reported: 2018-01-23 20:01 UTC by Grant Gainey
Modified: 2021-09-09 13:05 UTC (History)
4 users (show)

Fixed In Version: spacewalk-utils-2.8.14-1
Clone Of:
: 1554307 (view as bug list)
Environment:
Last Closed: 2018-04-20 12:31:52 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1537766 0 None None None 2018-02-02 19:35:31 UTC

Description Grant Gainey 2018-01-23 20:01:42 UTC
Description of problem:

If enable_snapshots is set for a server, entries are made in the RHNSNAPSHOT* tables with every change to every server. Over time, these tables frow without bounds, having a growing impact on space and performance of the Spacewalk instance.

The current tool for managing snapshots, sw-system-snapshot, is designed for the system-administrator to manage the snapshots associated with their systems. It has no way to 'see' ALL the snapshots, its use of the public API means it must be invoked with a login/password, and its use of absolute-timestamps, all make it less than useful as a tool for the Spacewalk Administrator.

This RFE is to introduce a tool for the Spacewalk-Administrator, to help them stay on top of the RHNSNAPSHOT* situation on their Spacewalk instance.

Requirements:

* Run on the SW instance itself
* Relies on access to /etc/rhn/rhn.conf and direct DB access (i.e., can only be run as root)
* For delete, specify number-of-days-old, not absolute-timestamp
* Includes some basic reporting capability, to let admin know extent of potential issues.

Comment 1 Grant Gainey 2018-01-23 20:28:32 UTC
spacewalk.github: ab71482551c6bcf72495f11b395476e14ef3ea0e

New command and manpage, spacewalk-manage-snapshots 

# spacewalk-manage-snapshots --help
Usage: spacewalk-manage-snapshots [--reports [--interval <INTERVAL>] | --delete-older-than <DAYS>]

Options:
  -h, --help            show this help message and exit
  -b ROWS-PER-COMMIT, --batch-size=ROWS-PER-COMMIT
                        Number of rows to delete per commit (default is 1000)
  -d DAYS, --delete-older-than=DAYS
                        Snapshots DAYS old or older will be purged from the
                        database
  -i INTERVAL, --interval-older-than=INTERVAL
                        INTERVAL-in-days period to use for --reports (default
                        is 90 days)
  -r, --reports         Report current table-sizes (in rows) for all snapshot-
                        related tables and report on the last four --interval
                        periods for snapshots

#
# spacewalk-manage-snapshots -r -i 25
               rhnsnapshot :        12277
        rhnsnapshotchannel :        18400
  rhnsnapshotconfigchannel :            0
 rhnsnapshotconfigrevision :            0
  rhnsnapshotinvalidreason :            6
        rhnsnapshotpackage :      3513699
    rhnsnapshotservergroup :        31164
            rhnsnapshottag :            0


:    Snapshot info, 25-day interval    :
: age(days) :   systems :    snapshots :
:    1-25   :         2 :            6 :
:   26-50   :         2 :        12263 :
:   51-75   :         3 :            3 :
:   76-100  :         1 :            1 :
:   >100    :         3 :            4 :
# 
# spacewalk-manage-snapshots -d 101 -b 1
Deleting snapshots older than 124 days
       12277 snapshots currently
           4 snapshots to be deleted, 1 per commit
...           4 snapshots left to purge
...           3 snapshots left to purge
...           2 snapshots left to purge
...           1 snapshots left to purge
       12273 snapshots remain
# spacewalk-manage-snapshots -r -i 25

                Table name :         rows
               rhnsnapshot :        12273
        rhnsnapshotchannel :        18396
  rhnsnapshotconfigchannel :            0
 rhnsnapshotconfigrevision :            0
  rhnsnapshotinvalidreason :            6
        rhnsnapshotpackage :      3512145
    rhnsnapshotservergroup :        31159
            rhnsnapshottag :            0

:    Snapshot info, 25-day interval    :
: age(days) :   systems :    snapshots :
:    1-25   :         2 :            6 :
:   26-50   :         2 :        12263 :
:   51-75   :         3 :            3 :
:   76-100  :         1 :            1 :
#

Comment 3 Grant Gainey 2018-02-06 18:59:30 UTC
spacewalk.github:
c970f43b9a9d8881b628424609afad16b551c66e

Fixed broken postgresql delete

Comment 5 Grant Gainey 2018-03-22 14:42:37 UTC
*** Bug 1559360 has been marked as a duplicate of this bug. ***

Comment 6 Grant Gainey 2018-03-22 14:42:39 UTC
*** Bug 1559361 has been marked as a duplicate of this bug. ***

Comment 7 Grant Gainey 2018-03-22 15:45:55 UTC
Fixes for the associated closed-as-dup BZs:

spacewalk.github:
45e672dd135fe6c3efcaee98acf377aab9b6ad0a
1b3efbd11e5543e6ababccbc033f456bad5384d6
1992cdfe33b5cb0cf2be749efacc01c53178f27b

Comment 8 Jiří Dostál 2018-03-26 12:16:45 UTC
Moving ON_QA

Comment 9 Jiří Dostál 2018-04-20 12:31:52 UTC
Spacewalk 2.8 has been released.
https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes28


Note You need to log in before you can comment on or make changes to this bug.