How orphaned pulp content is being deleted on Red Hat Satellite 6.10+ ?

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.10+

Issue

  • Is there a cronjob or script which can be used in Satellite 6.10+ to frequently check /var/lib/pulp for disk storage/CV usage etc... so older CV/CCV versions can be deleted to free up space?
  • crontab -l output doesn't list the /etc/cron.d/katello clean orphaned_content, so how do I enable this clean_orphaned_content script via cron? Or is there another way to validate and clean /var/lib/pulp?

Resolution

On Red Hat Satellite 6.10+, /etc/cron.d/katello deletes the orphaned pulp content:

# cat /etc/cron.d/katello 

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Script for initiating removal of orphaned content
00 22 * * 0	root	foreman-rake katello:delete_orphaned_content RAILS_ENV=production >/dev/null 2>&1

Being under the crontab drop-in directory at /etc/cron.d, /etc/cron.d/katello is already set up to run every Sunday at 22:00.

To validate that /etc/cron.d/katello runs as scheduled:

  1. Run the following command on the Satellite server:
 # grep "DELETE /pulp/api/v3/orphans/ HTTP/1.1" /var/log/messages

 Jul 26 10:58:52 example-sat pulpcore-api: pulp [3351f4be70734bfba38326e28cf2adca]: pulpcore.deprecation:WARNING: The `DELETE /pulp/api/v3/orphans/` call is deprecated. Use`POST /pulp/api/v3/orphans/cleanup/` instead.
 Jul 26 10:58:52 example-sat pulpcore-api: pulp [3351f4be70734bfba38326e28cf2adca]:  - - [26/Jul/2022:09:58:52 +0000] "DELETE /pulp/api/v3/orphans/ HTTP/1.1" 202 67 "-" "OpenAPI-Generator/3.14.1/ruby"
  1. Grep for the task logging ID in /var/log/messages:
 # grep 3351f4be70734bfba38326e28cf2adca /var/log/messages

 Jul 26 10:58:52 example-sat pulpcore-api: pulp [3351f4be70734bfba38326e28cf2adca]: pulpcore.deprecation:WARNING: The `DELETE /pulp/api/v3/orphans/` call is deprecated. Use`POST /pulp/api/v3/orphans/cleanup/` instead.
 Jul 26 10:58:52 example-sat pulpcore-api: pulp [3351f4be70734bfba38326e28cf2adca]:  - - [26/Jul/2022:09:58:52 +0000] "DELETE /pulp/api/v3/orphans/ HTTP/1.1" 202 67 "-" "OpenAPI-Generator/3.14.1/ruby"
 Jul 26 10:58:57 example-sat pulpcore-worker-1: pulp [3351f4be70734bfba38326e28cf2adca]: pulpcore.tasking.pulpcore_worker:INFO: Starting task 87607f17-f8a3-4741-9f1b-68020cf25be4
 Jul 26 10:58:58 example-sat pulpcore-worker-1: pulp [3351f4be70734bfba38326e28cf2adca]: pulpcore.tasking.pulpcore_worker:INFO: Task completed 87607f17-f8a3-4741-9f1b-68020cf25be4
  1. Use the task ID extracted from the previous step (for example, 87607f17-f8a3-4741-9f1b-68020cf25be4) to query the task status:
 # certs="--cacert /etc/pki/katello/certs/katello-server-ca.crt --cert /etc/pki/katello/certs/pulp-client.crt --key /etc/pki/katello/private/pulp-client.key"
 # hname=$(hostname -f)
 # curl $certs https://${hname}/pulp/api/v3/tasks/87607f17-f8a3-4741-9f1b-68020cf25be4/ | json_reformat

   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   775  100   775    0     0   2950      0 --:--:-- --:--:-- --:--:--  2969
{
    "pulp_href": "/pulp/api/v3/tasks/87607f17-f8a3-4741-9f1b-68020cf25be4/",
    "pulp_created": "2022-07-26T09:58:52.051708Z",
    "state": "completed",
    "name": "pulpcore.app.tasks.orphan.orphan_cleanup",
    "logging_cid": "3351f4be70734bfba38326e28cf2adca",
    "started_at": "2022-07-26T09:58:57.823749Z",
    "finished_at": "2022-07-26T09:58:58.845058Z",
    "error": null,
    "worker": "/pulp/api/v3/workers/ab8c1436-bd9d-4ac4-8de0-d2032033a61c/",
    "parent_task": null,
    "child_tasks": [

    ],
    "task_group": null,
    "progress_reports": [
        {
            "message": "Clean up orphan Artifacts",
            "code": "clean-up.content",
            "state": "completed",
            "total": 14,
            "done": 14,
            "suffix": null
        },
        {
            "message": "Clean up orphan Content",
            "code": "clean-up.content",
            "state": "completed",
            "total": 19,
            "done": 19,
            "suffix": null
        }
    ],
    "created_resources": [

    ],
    "reserved_resources_record": [

    ]
}

Note:


As an alternative to step (3), you can query all remove orphans tasks using these commands:
# certs="--cacert /etc/pki/katello/certs/katello-server-ca.crt --cert /etc/pki/katello/certs/pulp-client.crt --key /etc/pki/katello/private/pulp-client.key"
# hname=$(hostname -f)
# curl -s $certs https://${hname}/pulp/api/v3/tasks/?name=pulpcore.app.tasks.orphan.orphan_cleanup | json_reformat

For more KB articles/solutions related to Red Hat Satellite 6.x Pulp 3.0 Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Pulp 3.0-related Issues

SBR
Product(s)
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.