← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2076648] [NEW] HTTP store doesn't allow deletion of image location

 

Public bug reported:

In case of ``http`` store, if bad value is passed for ``os_hash_value`` in validation data to add-location api, task fails which is expected but it stores location of the image which is wrong, that needs to be popped out. The location doesn't get deleted because deletion of location is not
allowed for ``http`` store. Here image needs to be deleted as it is of no use.

Steps to reproduce:
1. Create Image
$ glance image-create --container-format bare --disk-format raw --name test-image-http-store

2. Check hash value of the image
$ sha256sum cirros-0.3.4-x86_64-disk.img
34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3394  cirros-0.3.4-x86_64-disk.img

3. Add location to the image along with invalid os_hash_value in validation data
$ glance add-location --url http://0.0.0.0:8000/cirros-0.3.4-x86_64-disk.img af411b43-0cdf-4f6b-bc55-b66504e3f205 --validation-data '{"os_hash_algo":"sha256", "os_hash_value": "34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3897"}'

4. Show Image
$ glance image-show af411b43-0cdf-4f6b-bc55-b66504e3f205
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | None                                 |
| container_format | bare                                 |
| created_at       | 2024-08-12T14:32:47Z                 |
| disk_format      | raw                                  |
| id               | af411b43-0cdf-4f6b-bc55-b66504e3f205 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | test-image-http-store                |
| os_hash_algo     | None                                 |
| os_hash_value    | None                                 |
| os_hidden        | False                                |
| owner            | a16d88ef1c8c4e5d8aec357ddf7d3df3     |
| protected        | False                                |
| size             | None                                 |
| status           | queued                               |
| stores           | web                                  |
| tags             | []                                   |
| updated_at       | 2024-08-12T14:34:48Z                 |
| virtual_size     | Not available                        |
| visibility       | shared                               |
+------------------+--------------------------------------+

Image is reverted back to 'queued' as expected but location didn't
popped out, see Stores : 'web'

g-api logs
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: WARNING glance.async_.taskflow_executor [-] Task 'location_import-VerifyValidationData-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' (70680d85-97b9-474f-ab19-a1b6f4fa5868) transitioned into state 'FAILURE' from state 'RUNNING'
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: 5 predecessors (most recent first):
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:   Atom 'location_import-CalculateHash-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': None}
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:   |__Atom 'location_import-UpdateLocationTask-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': None}
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:      |__Atom 'location_import-ImageLock-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': None}
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:         |__Atom 'location_import_retry' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': [(None, {})]}
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:            |__Flow 'location_import': glance.common.exception.InvalidParameterValue: os_hash_value: (34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3897) not matched with actual os_hash_value: (34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3394)
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor Traceback (most recent call last):
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor   File "/opt/stack/data/venv/lib/python3.10/site-packages/taskflow/engines/action_engine/executor.py", line 52, in _execute_task
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor     result = task.execute(**arguments)
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor   File "/opt/stack/glance/glance/async_/flows/location_import.py", line 164, in execute
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor     raise exception.InvalidParameterValue(msg)
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor glance.common.exception.InvalidParameterValue: os_hash_value: (34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3897) not matched with actual os_hash_value: (34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3394)
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor 
Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: DEBUG glance.async_.taskflow_executor [-] Task 'location_import-VerifyValidationData-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' (70680d85-97b9-474f-ab19-a1b6f4fa5868) transitioned into state 'REVERTING' from state 'FAILURE' {{(pid=3078524) _task_receiver /opt/stack/data/venv/lib/python3.10/site-packages/taskflow/listeners/logging.py:190}}

** Affects: glance
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/2076648

Title:
  HTTP store doesn't allow deletion of image location

Status in Glance:
  New

Bug description:
  In case of ``http`` store, if bad value is passed for ``os_hash_value`` in validation data to add-location api, task fails which is expected but it stores location of the image which is wrong, that needs to be popped out. The location doesn't get deleted because deletion of location is not
  allowed for ``http`` store. Here image needs to be deleted as it is of no use.

  Steps to reproduce:
  1. Create Image
  $ glance image-create --container-format bare --disk-format raw --name test-image-http-store

  2. Check hash value of the image
  $ sha256sum cirros-0.3.4-x86_64-disk.img
  34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3394  cirros-0.3.4-x86_64-disk.img

  3. Add location to the image along with invalid os_hash_value in validation data
  $ glance add-location --url http://0.0.0.0:8000/cirros-0.3.4-x86_64-disk.img af411b43-0cdf-4f6b-bc55-b66504e3f205 --validation-data '{"os_hash_algo":"sha256", "os_hash_value": "34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3897"}'

  4. Show Image
  $ glance image-show af411b43-0cdf-4f6b-bc55-b66504e3f205
  +------------------+--------------------------------------+
  | Property         | Value                                |
  +------------------+--------------------------------------+
  | checksum         | None                                 |
  | container_format | bare                                 |
  | created_at       | 2024-08-12T14:32:47Z                 |
  | disk_format      | raw                                  |
  | id               | af411b43-0cdf-4f6b-bc55-b66504e3f205 |
  | min_disk         | 0                                    |
  | min_ram          | 0                                    |
  | name             | test-image-http-store                |
  | os_hash_algo     | None                                 |
  | os_hash_value    | None                                 |
  | os_hidden        | False                                |
  | owner            | a16d88ef1c8c4e5d8aec357ddf7d3df3     |
  | protected        | False                                |
  | size             | None                                 |
  | status           | queued                               |
  | stores           | web                                  |
  | tags             | []                                   |
  | updated_at       | 2024-08-12T14:34:48Z                 |
  | virtual_size     | Not available                        |
  | visibility       | shared                               |
  +------------------+--------------------------------------+

  Image is reverted back to 'queued' as expected but location didn't
  popped out, see Stores : 'web'

  g-api logs
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: WARNING glance.async_.taskflow_executor [-] Task 'location_import-VerifyValidationData-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' (70680d85-97b9-474f-ab19-a1b6f4fa5868) transitioned into state 'FAILURE' from state 'RUNNING'
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: 5 predecessors (most recent first):
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:   Atom 'location_import-CalculateHash-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': None}
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:   |__Atom 'location_import-UpdateLocationTask-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': None}
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:      |__Atom 'location_import-ImageLock-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': None}
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:         |__Atom 'location_import_retry' {'intention': 'EXECUTE', 'state': 'SUCCESS', 'requires': {}, 'provides': [(None, {})]}
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]:            |__Flow 'location_import': glance.common.exception.InvalidParameterValue: os_hash_value: (34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3897) not matched with actual os_hash_value: (34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3394)
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor Traceback (most recent call last):
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor   File "/opt/stack/data/venv/lib/python3.10/site-packages/taskflow/engines/action_engine/executor.py", line 52, in _execute_task
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor     result = task.execute(**arguments)
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor   File "/opt/stack/glance/glance/async_/flows/location_import.py", line 164, in execute
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor     raise exception.InvalidParameterValue(msg)
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor glance.common.exception.InvalidParameterValue: os_hash_value: (34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3897) not matched with actual os_hash_value: (34987d0d5702f8813f3ff9efe90e9e39e6926ec78658763580a79face67f3394)
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: ERROR glance.async_.taskflow_executor 
  Aug 12 14:34:47 pranali-dev-caracal devstack@g-api.service[3078524]: DEBUG glance.async_.taskflow_executor [-] Task 'location_import-VerifyValidationData-b44c5ef1-a99f-41c6-b8c0-39a67e4061cd' (70680d85-97b9-474f-ab19-a1b6f4fa5868) transitioned into state 'REVERTING' from state 'FAILURE' {{(pid=3078524) _task_receiver /opt/stack/data/venv/lib/python3.10/site-packages/taskflow/listeners/logging.py:190}}

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/2076648/+subscriptions