Bug 1806811

Summary: Creating image for volume does not honour protected and private flag
Product: Red Hat OpenStack Reporter: David Sedgmen <dsedgmen>
Component: python-openstackclientAssignee: Rajat Dhasmana <rdhasman>
Status: CLOSED ERRATA QA Contact: msava
Severity: medium Docs Contact:
Priority: medium    
Version: 13.0 (Queens)CC: apevec, athomas, cyril, eglynn, gfidente, jpichon, jschluet, lhh, msava, rdhasman
Target Milestone: gaKeywords: Triaged, ZStream
Target Release: 17.1Flags: astillma: needinfo? (rdhasman)
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-openstackclient-5.5.2-1.20230204060905.42d9b6e.el9ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-16 01:09:23 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 David Sedgmen 2020-02-25 04:50:29 UTC
Description of problem:

When creating an image for a volume and specifying the protected flag (--protected) or the the private flag (--private)

The resulting image created does not have the protected flag or the  visibility set to private

#######################################
(overcloud) [stack@undercloud-0 ~]$ openstack image create --disk-format raw --protected  --private --volume test-vol test-vol-image
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| container_format    | bare                                 |
| disk_format         | raw                                  |
| display_description | None                                 |
| id                  | c6e2ed3b-cdaa-4438-ab06-4146fe28706d |
| image_id            | 19c369a7-649d-464a-bf07-3eebd0eca9eb |
| image_name          | test-vol-image                       |
| protected           | False                                |
| size                | 4                                    |
| status              | uploading                            |
| updated_at          | 2020-02-25T04:44:11.000000           |
| visibility          | shared                               |
| volume_type         | tripleo                              |
+---------------------+--------------------------------------+


(overcloud) [stack@undercloud-0 ~]$ openstack image show test-vol-image
+------------------+------------------------------------------------------------------------------+
| Field            | Value                                                                        |
+------------------+------------------------------------------------------------------------------+
| checksum         | 5f13a2485c669bdfc5a0e061b6cb29e7                                             |
| container_format | bare                                                                         |
| created_at       | 2020-02-25T04:44:25Z                                                         |
| disk_format      | raw                                                                          |
| file             | /v2/images/19c369a7-649d-464a-bf07-3eebd0eca9eb/file                         |
| id               | 19c369a7-649d-464a-bf07-3eebd0eca9eb                                         |
| min_disk         | 0                                                                            |
| min_ram          | 0                                                                            |
| name             | test-vol-image                                                               |
| owner            | eb7c6ce254f44553b950c375fbd9d81a                                             |
| properties       | direct_url='swift+config://ref1/glance/19c369a7-649d-464a-bf07-3eebd0eca9eb' |
| protected        | False                                                                        |
| schema           | /v2/schemas/image                                                            |
| size             | 4294967296                                                                   |
| status           | active                                                                       |
| tags             |                                                                              |
| updated_at       | 2020-02-25T04:44:54Z                                                         |
| virtual_size     | None                                                                         |
| visibility       | shared                                                                       |
+------------------+------------------------------------------------------------------------------+
#######################################

Version-Release number of selected component (if applicable):


How reproducible:

Everytime

Steps to Reproduce:

1. Create volume
2. Create image from volume with protected or private flag 


Actual results:

Image created from volume is neither protected or private

Expected results:

Image created from volume is protected and private

Additional info:

These can be set after the fact 

###################################
(overcloud) [stack@undercloud-0 ~]$ openstack image set --protected  --private test-vol-image
(overcloud) [stack@undercloud-0 ~]$ openstack image show test-vol-image
+------------------+------------------------------------------------------------------------------+
| Field            | Value                                                                        |
+------------------+------------------------------------------------------------------------------+
| checksum         | 5f13a2485c669bdfc5a0e061b6cb29e7                                             |
| container_format | bare                                                                         |
| created_at       | 2020-02-25T04:44:25Z                                                         |
| disk_format      | raw                                                                          |
| file             | /v2/images/19c369a7-649d-464a-bf07-3eebd0eca9eb/file                         |
| id               | 19c369a7-649d-464a-bf07-3eebd0eca9eb                                         |
| min_disk         | 0                                                                            |
| min_ram          | 0                                                                            |
| name             | test-vol-image                                                               |
| owner            | eb7c6ce254f44553b950c375fbd9d81a                                             |
| properties       | direct_url='swift+config://ref1/glance/19c369a7-649d-464a-bf07-3eebd0eca9eb' |
| protected        | True                                                                         |
| schema           | /v2/schemas/image                                                            |
| size             | 4294967296                                                                   |
| status           | active                                                                       |
| tags             |                                                                              |
| updated_at       | 2020-02-25T04:46:31Z                                                         |
| virtual_size     | None                                                                         |
| visibility       | private                                                                      |
+------------------+------------------------------------------------------------------------------+
###################################

Comment 4 Cyril Roelandt 2020-03-04 21:36:31 UTC
Hello David,

I think you might be on to something :)

Can you try to use the glanceclient and see whether it works as expected?

I think this might be a python-openstackclient issue that should be reported upstream, I'll take a closer look ASAP.

Comment 5 David Sedgmen 2020-03-05 00:29:30 UTC
Hi Cyril

I there does not seem to be an option to create image from volume for the "glance" cli command.

Comment 7 Cyril Roelandt 2021-06-25 01:24:10 UTC
There is an upstream patch with a +2 and a story. I'm moving this to python-openstackclient.

Comment 9 Cyril Roelandt 2022-06-30 15:09:27 UTC
Downstream, we also want https://review.opendev.org/c/openstack/python-openstackclient/+/844268 to prevent introducing a new bug.

Comment 10 Cyril Roelandt 2022-07-05 22:24:18 UTC
Both patches have been merged upstream in stable/wallaby, but too late for 17.0ga. Pushing this to 17.1.

Comment 23 errata-xmlrpc 2023-08-16 01:09:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Release of components for Red Hat OpenStack Platform 17.1 (Wallaby)), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2023:4577