Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1897286

Summary: Permit configuration of the Glance allowed disk formats via THT
Product: Red Hat OpenStack Reporter: Giulio Fidente <gfidente>
Component: openstack-tripleo-heat-templatesAssignee: Giulio Fidente <gfidente>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Abrams <mabrams>
Severity: medium Docs Contact:
Priority: medium    
Version: 16.0 (Train)CC: dcadzow, gcharot, mburns, spower
Target Milestone: z4Keywords: FeatureBackport, TestOnly, Triaged
Target Release: 16.1 (Train on RHEL 8.2)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: puppet-glance-15.4.1-0.20200611153438.8ac5b13.el8ost openstack-tripleo-heat-templates-11.3.2-1.20200914170170.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-16 11:53:13 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: 1833277    
Bug Blocks: 1910107    

Description Giulio Fidente 2020-11-12 17:25:32 UTC
This bug was initially created as a copy of Bug #1833277

Description of problem:
Disable upload of non-RAW images when CEPH is used as a glance backend ; or get a feature for automatic image conversion to RAW for the PUT API call (then this BZ needs to be cloned for glance)

For further details, see:
https://access.redhat.com/solutions/2434691

Cloud administrators should prohibit the upload of non-raw images into glance:
https://access.redhat.com/solutions/2158611

Note that in later versions of Red Hat OpenStack Platform, Glance image conversion is automatically turned on to convert QCOW2 images into RAW images but only when using the import feature. Topenstack image create uses the PUT call to http(s)://<URL>:9292/v2/images/<UUID>/file and thus will not convert images automatically:
https://bugzilla.redhat.com/show_bug.cgi?id=1666529
https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.0/html-single/instances_and_images_guide/index#section-image-conversion
https://docs.openstack.org/glance/rocky/admin/interoperable-image-import.html#the-image-conversion

So we still don't have an automatic image conversion feature for the PUT call. However, the PUT call is what administrators use the most. The long-standing issue that we don't support anything other than RAW + CEPH, but that admins most of the time upload qcow2 images (because that's the format that they download their images in), has IMO still not been addressed properly.

Comment 4 Mike Abrams 2020-11-25 07:00:58 UTC
VERIFIED

the below illustrates that a qcow2 disk format cannot be created when not specified in /etc/glance/glance-api.conf:disk-formats -->

---

[root@titan31 ~]# ssh stack@undercloud-0
Activate the web console with: systemctl enable --now cockpit.socket

This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register

Last login: Wed Nov 25 06:08:47 2020
[stack@undercloud-0 ~]$ rhos-release -L
Installed repositories (rhel-8.2):
  16.1
  ceph-4
  ceph-osd-4
  rhel-8.2
[stack@undercloud-0 ~]$ cat /var/lib/rhos-release/latest-installed 
16.1  -p RHOS-16.1-RHEL-8-20201110.n.1
[stack@undercloud-0 ~]$ rpm -qa | grep -i openstack-tripleo-heat-templates
openstack-tripleo-heat-templates-11.3.2-1.20200914170172.el8ost.noarch
[stack@undercloud-0 ~]$ ssh -t heat-admin.24.50 "sudo podman exec -it -u root glance_api sh -c 'rpm -qa openstack-triple0-heat-templates'"
Warning: Permanently added '192.168.24.50' (ECDSA) to the list of known hosts.
Connection to 192.168.24.50 closed.
[stack@undercloud-0 ~]$ ssh -t heat-admin.24.50 "sudo podman exec -it -u root glance_api sh -c 'rpm -qa puppet-glance'"
Warning: Permanently added '192.168.24.50' (ECDSA) to the list of known hosts.
puppet-glance-15.4.1-0.20200611153438.8ac5b13.el8ost.noarch
Connection to 192.168.24.50 closed.
[stack@undercloud-0 ~]$ . ./stackrc 
(undercloud) [stack@undercloud-0 ~]$ openstack server list
+--------------------------------------+--------------+--------+------------------------+----------------+------------+
| ID                                   | Name         | Status | Networks               | Image          | Flavor     |
+--------------------------------------+--------------+--------+------------------------+----------------+------------+
| 2738d272-aa10-4af5-a99c-23d6c1186196 | controller-0 | ACTIVE | ctlplane=192.168.24.50 | overcloud-full | controller |
| a371dd23-7e69-4764-8a62-63813d50fb1f | controller-2 | ACTIVE | ctlplane=192.168.24.48 | overcloud-full | controller |
| 2298d0be-1aa0-4737-b36b-eaad7f9ddf5b | controller-1 | ACTIVE | ctlplane=192.168.24.22 | overcloud-full | controller |
| 124993d7-1fdf-4699-99d1-70ac72a25978 | compute-0    | ACTIVE | ctlplane=192.168.24.35 | overcloud-full | compute    |
| e758e32e-5a4f-4e03-acf3-438ff5fa2c15 | compute-1    | ACTIVE | ctlplane=192.168.24.49 | overcloud-full | compute    |
| a1e9c61d-db11-431d-a14a-9eba2be8203e | ceph-0       | ACTIVE | ctlplane=192.168.24.40 | overcloud-full | ceph       |
| 45f897b1-d5bf-44ec-9eae-975d58e8ef3a | ceph-1       | ACTIVE | ctlplane=192.168.24.27 | overcloud-full | ceph       |
| daa62850-72ba-4af4-952f-806bbee63314 | ceph-2       | ACTIVE | ctlplane=192.168.24.39 | overcloud-full | ceph       |
+--------------------------------------+--------------+--------+------------------------+----------------+------------+
(undercloud) [stack@undercloud-0 ~]$ . ./overcloudrc 
(overcloud) [stack@undercloud-0 ~]$ ssh -t heat-admin.24.50 "sudo podman exec -it -u root glance_api sh -c 'grep ^disk_formats /etc/glance/glance-api.conf'"
Warning: Permanently added '192.168.24.50' (ECDSA) to the list of known hosts.
disk_formats=raw,iso,aki,ari,ami
Connection to 192.168.24.50 closed.
(overcloud) [stack@undercloud-0 ~]$
(overcloud) [stack@undercloud-0 ~]$ glance image-list
+--------------------------------------+----------------------------------+
| ID                                   | Name                             |
+--------------------------------------+----------------------------------+
| 9f636e34-b7f6-426a-8d81-55e3f8a91724 | cirros-0.4.0-x86_64-disk.img     |
| 3bb86ebf-4493-44f7-b5ff-7330ef8d4e1d | cirros-0.4.0-x86_64-disk.img_alt |
| 13b63020-73fc-4234-9742-1552f39e422a | manila-service-image-master      |
| efc5b709-62b0-46d8-94dc-7e7036018f30 | test-001                         |
+--------------------------------------+----------------------------------+
(overcloud) [stack@undercloud-0 ~]$ glance image-create-via-import --container-format ami --disk-format qcow2 --name test-002 --import-method web-download --uri http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img
Unable to set 'disk_format' to 'qcow2'. Reason: 'qcow2' is not one of [None, 'raw', 'iso', 'aki', 'ari', 'ami']

Failed validating 'enum' in schema['properties']['disk_format']:
    {'description': 'Format of the disk',
     'enum': [None, 'raw', 'iso', 'aki', 'ari', 'ami'],
     'type': ['null', 'string']}

On instance['disk_format']:
    'qcow2'
(overcloud) [stack@undercloud-0 ~]$ glance image-create-via-import --container-format ami --disk-format ami --name test-003 --import-method web-download --uri http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | None                                 |
| container_format | ami                                  |
| created_at       | 2020-11-25T06:54:25Z                 |
| disk_format      | ami                                  |
| id               | 7b0343c1-8b4a-48c0-b770-053057f1ea47 |
| locations        | []                                   |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | test-003                             |
| os_hash_algo     | None                                 |
| os_hash_value    | None                                 |
| os_hidden        | False                                |
| owner            | 2be9452c2e504cb0b8fe29d40eb17a82     |
| protected        | False                                |
| size             | None                                 |
| status           | queued                               |
| tags             | []                                   |
| updated_at       | 2020-11-25T06:54:25Z                 |
| virtual_size     | Not available                        |
| visibility       | shared                               |
+------------------+--------------------------------------+
(overcloud) [stack@undercloud-0 ~]$ glance image-show 7b0343c1-8b4a-48c0-b770-053057f1ea47 | grep status
| status                        | active                                                                           |
(overcloud) [stack@undercloud-0 ~]$ 

---

Comment 5 Mike Abrams 2020-11-25 09:45:08 UTC
THT used:

(undercloud) [stack@undercloud-0 ~]$ cat glance_disk_formats.yaml 
parameter_defaults:
  GlanceDiskFormats:
  - raw
  - iso
  - aki
  - ari
  - ami
(undercloud) [stack@undercloud-0 ~]$ grep glance_disk_formats ./overcloud_deploy.sh 
-e /home/stack/glance_disk_formats.yaml \
(undercloud) [stack@undercloud-0 ~]$

Comment 6 Lon Hohberger 2020-12-16 11:53:13 UTC
According to our records, this should be resolved by puppet-glance-15.4.1-0.20200611153438.8ac5b13.el8ost.  This build is available now.

Comment 7 Lon Hohberger 2020-12-16 11:53:17 UTC
According to our records, this should be resolved by openstack-tripleo-heat-templates-11.3.2-1.20200914170177.el8ost.  This build is available now.

Comment 9 spower 2021-01-06 15:01:07 UTC
Exception + flag given