Bug 1980223

Summary: When using an API call to create a bootdisk Satellite will leave a copy in /tmp/ and does not clean up
Product: Red Hat Satellite Reporter: jtougne
Component: Bootdisk PluginAssignee: Lukas Zapletal <lzap>
Status: CLOSED DUPLICATE QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: apatel, gpadholi, lzap, ofedoren
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-15 07:31:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jtougne 2021-07-08 06:44:27 UTC
Description of problem:

Hi,
It seems an issue somehow similar to this one:
Bug 1837717 - Ansible temporary files are not removed from the /tmp directory. 


Every time a boot disk is created via API call, Satellite will leave it in /tmp/bootdisk-iso-<date>-<host_id>-<random>:

 

drwx------.  3 foreman       foreman         37 Jul  5 13:00 bootdisk-iso-20210705-3671-1p9x4n7

drwx------.  3 foreman       foreman         37 Jul  5 13:07 bootdisk-iso-20210705-3671-h5njqy

drwx------.  3 foreman       foreman         37 Jul  5 18:05 bootdisk-iso-20210705-3671-sxetnh

drwx------.  3 foreman       foreman         37 Jul  6 10:25 bootdisk-iso-20210706-3671-oehtef

drwx------.  3 foreman       foreman         37 Jul  6 10:26 bootdisk-iso-20210706-3677-i84309

 

As a result, creating/downloading a few boot ISOs will fill up /tmp on the Satellite.  



Note: We have checked and there is the use of systemd-tmpfiles-clean.service on RHEL7, which has the default timer, and cleans on a daily basis. Still that's a bit irrelevant to the PR, because it looks like a bug to leave temporary boot disk image in /tmp after it's been created in response to an API call.


Version-Release number of selected component (if applicable):
Red Hat Satellite 6.9.1



How reproducible:

We use this API call:

- name: download bootdisk for VM
        uri:
          url: '{​​​​​​​{​​​​​​​ foreman_server_url }​​​​​​​}​​​​​​​/bootdisk/api/hosts/{​​​​​​​{​​​​​​​ this.json.id }​​​​​​​}​​​​​​​?full=true'
 
    this.json-id is the host_id in Satellite

      - name: get host id from Satellite
    uri:
      url: "{​​​​​​​{​​​​​​​ foreman_server_url }​​​​​​​}​​​​​​​/api/v2/hosts/{​​​​​​​{​​​​​​​ inventory_hostname }​​​​​​​}​​​​​​​/"
      return_content: yes
      url_username: "{​​​​​​​{​​​​​​​ foreman_username }​​​​​​​}​​​​​​​"
      url_password: "{​​​​​​​{​​​​​​​ foreman_password }​​​​​​​}​​​​​​​"
      force_basic_auth: yes
    register: this
 
From the offical API guide:
https://access.redhat.com/documentation/en-us/red_hat_satellite/6.9/html-single/api_guide/index

For example, at the end of "5.1 Working with Hosts":

Downloading a Full Boot Disk Image

This request downloads a full boot disk image for a host by its ID.

Example request:

$ curl --request GET --insecure --user sat_username:sat_password \
https://satellite.example.com/bootdisk/api/hosts/host_ID?full=true \
--output image.iso


Steps to Reproduce:
1. Make an API call to download the boot iso
2. Check /tmp

Actual results:
A copy of the boot iso is left, even after the call is completed, and the boot image downloaded.

Expected results:

We expect that the temporary copy is automatically deleted when no longer needed.

Additional info:

Comment 2 Lukas Zapletal 2021-12-15 07:31:14 UTC
Hello, I can confirm this bug was fixed both for UI and API in 6.10.

*** This bug has been marked as a duplicate of bug 1936946 ***