Bug 487566
| Summary: | RFE: simple script to purge snapshot data | ||
|---|---|---|---|
| Product: | Red Hat Satellite 5 | Reporter: | Todd Warner <taw> |
| Component: | Server | Assignee: | Brad Buckingham <bbuckingham> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | wes hayutin <whayutin> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 520 | CC: | bbuckingham, cperry, jha, pkilambi |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | sat530 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2009-09-10 19:58:47 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 444505, 456995 | ||
|
Description
Todd Warner
2009-02-26 18:46:13 UTC
John, How about: "Added ability to purge system snapshots via the api." or something like that. Okay, I've added it to the release notes. Thanks! RHN Satellite 5.3.0 now has the ability to purge system snapshots via the API Looking over the current APIs available in Spacewalk, it looks like we have some new APIs introduced in SW 0.1 that may satisfy this request. The APIs are system.listSnapshots, system.deleteSnapshot and system.deleteSnapshots. See below for details.
We do not currently have a method to "delete snapshots by date". It is technically feasible; however, the user could use these existing APIs to create a script that uses listSnapshots, retrieves the date from the result and then invokes deleteSnapshot.
Based on this, do you still want us to add the "delete snapshots by date"?
----------------------------------
Method: listSnapshots
Description:
List the snapshots for a given system
Parameters:
* string sessionKey
* int serverId
Returns:
* array:
o struct - server snapshot
+ int "id"
+ string "reason" - the reason for the snapshot's existence
+ dateTime.iso8601 "created"
+ array "channels"
# string labels of channels associated with the snapshot
+ array "groups"
# string Names of server groups associated with the snapshot
+ array "entitlements"
# string Names of system entitlements associated with the snapshot
+ array "config_channels"
# string Labels of config channels the snapshot is associated with.
+ array "tags"
# string Tag names associated with this snapshot.
+ string "Invalid_reason" - If the snapshot is invalid, this is the reason (optional).
Method: deleteSnapshot
Description:
Deletes a snapshot with the given snapshot id
Parameters:
* string sessionKey
* int snapshotId - Id of snapshot to delete
Returns:
* int - 1 on success, exception thrown otherwise.
Method: deleteSnapshots
Description:
Deletes all snapshots of a given server
Parameters:
* string sessionKey
* int sid - system id of system to delete snapshots for
Returns:
* int - 1 on success, exception thrown otherwise.
'do you still want us to add the "delete snapshots by date"?' Yes. And shouldn't this bug be beyond the NEW state by now? master git commit: c55ad4bf0952843b458b33579544338069cb442e Note: more work to be done before moving to MODIFIED and cherry picking to vader branch. The initial modifications for the script have been completed and will be included in the spacewalk-utils package.
Once spacewalk-utils is installed, the script will be placed in /usr/bin/sw-system-snapshot. A man page is also included. Refer to it for more details along with example scenarios.
The following is the script usage information:
bash-3.2$ sw-system-snapshot --help
usage: sw-system-snapshot [options]
options:
-v, --verbose Increase verbosity
-u USERNAME, --username=USERNAME
Username
-p PASSWORD, --password=PASSWORD
Password
-d, --delete Delete snapshots.
-l, --list List snapshot summary.
-a, --all Include all snapshots based on criteria provided.
--start-date=START_DATE
Include only snapshots taken on or after this date.
Must be in the format 'YYYYMMDDHH24MISS'.
--end-date=END_DATE Include only snapshots taken on or before this date.
Must be in the format 'YYYYMMDDHH24MISS'.
--satellite=SATELLITE
Server.
--system-id=SYSTEM_ID
System Id.
--snapshot-id=SNAPSHOT_ID
Snapshot Id.
-h, --help show this help message and exit
----------------------------------------------------------------------------
Examples: note these do not cover all possible execution scenarios...
List examples, to see what would be deleted if using the same criteria:
-----------------------------------------------------------------------
sw-system-snapshot --list --all
sw-system-snapshot --list --all --start-date=20090403000000
sw-system-snapshot --list --system-id=1000010022
sw-system-snapshot --list --system-id=1000010022
--start-date=20090101000000 --end-date=20091231000000
Delete examples:
----------------
sw-system-snapshot --delete --all
sw-system-snapshot --delete --all --start-date=20090403000000
sw-system-snapshot --delete --system-id=1000010022
sw-system-snapshot --delete --system-id=1000010022
--start-date=20090101000000 --end-date=20091231000000
sw-system-snapshot --delete --system-id=1000010022
--system-id=1000010033
verified 5/7.1 An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2009-1434.html |