This behavior breaks the promise that images are immutable, because user can easily modify them. The solution is to limit number of possible locations to 1, but it may break some deployments that use this feature with multiple locations.
Another issue he finds is:
Glance v2 is able to show image location to end user. Like in case 2 this feature has to be activated to allow user make snapshots on ceph deployments. If user knows private location url, then he can create own image and set this location there. Then, if user deletes his image, the original data will be deleted as well. Example:
User gets list of images:
mfedosin@winter ~ $ glance image-list
+--------------------------------------+----------------------------+
| ID | Name |
+--------------------------------------+----------------------------+
| 0741cbc7-6b9f-4eb4-a666-9743a186849e | debian-8-m-agent.qcow2 |
| 2e4b6dca-9700-4715-b81d-4463cd7038de | TestVM |
| 39599dd3-35cb-4893-b5d4-1a17e23e538a | ubuntu14.04-x64-docker |
| 153397f8-d5e5-43d1-9a08-5fc52bda11a4 | ubuntu14.04-x64-kubernetes |
+--------------------------------------+----------------------------+
User requests info about public image he wants to delete:
mfedosin@winter ~ $ glance image-show 2e4b6dca-9700-4715-b81d-4463cd7038de
+------------------+----------------------------------------------------------------------------------+
| Property | Value |
+------------------+----------------------------------------------------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2016-02-11T03:38:09Z |
| direct_url | rbd://647f7ae8-648a-44f5-83ad-f7bd2299274e/images/2e4b6dca-9700-4715-b81d- |
| | 4463cd7038de/snap |
| disk_format | qcow2 |
| id | 2e4b6dca-9700-4715-b81d-4463cd7038de |
| min_disk | 0 |
| min_ram | 64 |
| name | TestVM |
| owner | 1c6cea59a6054372b10acbab8e25e415 |
| protected | False |
| size | 13287936 |
| status | active |
| tags | [] |
| updated_at | 2016-02-11T03:38:30Z |
| virtual_size | None |
| visibility | public |
+------------------+----------------------------------------------------------------------------------+
Optional: User may try to download image file with "glance image-download 2e4b6dca-9700-4715-b81d-4463cd7038de --file gg"
User copies direct image url: from 'direct_url' or 'locations' field
rbd://647f7ae8-648a-44f5-83ad-f7bd2299274e/images/2e4b6dca-9700-4715-b81d-4463cd7038de/snap
User creates new image instance in db and sets custom location with "glance --os-image-api-version 1 image-create --location" (v1) or "glance location-add --url" (v2)
mfedosin@winter ~ $ glance --os-image-api-version 1 image-create --location "rbd://647f7ae8-648a-44f5-83ad-f7bd2299274e/images/2e4b6dca-9700-4715-b81d-4463cd7038de/snap" --disk-format qcow2 --container-format bare --name rerere
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2016-02-17T11:54:41.000000 |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | b12c6965-c6f8-4272-a8a0-453fc0fc03e2 |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | rerere |
| owner | fa343a042d2b47cbbeab08cca9913679 |
| protected | False |
| size | 13287936 |
| status | active |
| updated_at | 2016-02-17T11:54:44.000000 |
| virtual_size | None |
+------------------+--------------------------------------+
Optional: User may try to verify that image has desired location
mfedosin@winter ~ $ glance image-show b12c6965-c6f8-4272-a8a0-453fc0fc03e2
+------------------+----------------------------------------------------------------------------------+
| Property | Value |
+------------------+----------------------------------------------------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2016-02-17T11:54:41Z |
| direct_url | rbd://647f7ae8-648a-44f5-83ad-f7bd2299274e/images/2e4b6dca-9700-4715-b81d- |
| | 4463cd7038de/snap |
| disk_format | qcow2 |
| id | b12c6965-c6f8-4272-a8a0-453fc0fc03e2 |
| min_disk | 0 |
| min_ram | 0 |
| name | rerere |
| owner | fa343a042d2b47cbbeab08cca9913679 |
| protected | False |
| size | 13287936 |
| status | active |
| tags | [] |
| updated_at | 2016-02-17T11:54:44Z |
| virtual_size | None |
| visibility | private |
+------------------+----------------------------------------------------------------------------------+
User deletes his image. Image data will be deleted too.
glance image-delete b12c6965-c6f8-4272-a8a0-453fc0fc03e2
mfedosin@winter ~ $ glance image-delete b12c6965-c6f8-4272-a8a0-453fc0fc03e2
mfedosin@winter ~ $ glance image-show b12c6965-c6f8-4272-a8a0-453fc0fc03e2
404 Not Found: No image found with ID b12c6965-c6f8-4272-a8a0-453fc0fc03e2 (HTTP 404)
Trying to access public data will failed after that.
Related content to image-location bugs in his emails is as follows: ####### ####### ####### ####### ####### ####### ####### ####### ####
#######
---
Adoption of glance v2 in Nova requires to allow users to set custom locations for their images to be able to make snapshots on deployments with Ceph. https:/ /github. com/openstack/ nova/blob/ 824c3706a3ea691 781f4fcc4453881 517a9e1c55/ nova/virt/ libvirt/ driver. py#L1517 /bugs.launchpad .net/glance/ +bug/1549483) Example:
Glance v2 implementation of custom locations has security threat and it's not recommended to use by anyone except administrators, because it allows users to replace location of their active images. (Bug https:/
mfedosin@wdev:~$ glance image-create --name good --disk-format qcow2 --container-format bare --visibility public ------- -----+- ------- ------- ------- ------- ------- --+ ------- -----+- ------- ------- ------- ------- ------- --+ 10T18:41: 53Z | 66b7-43e0- 90b5-ebe62232f7 d6 | 8806e46fb4a7edc a3 | 10T18:41: 53Z | ------- -----+- ------- ------- ------- ------- ------- --+ 66b7-43e0- 90b5-ebe62232f7 d6 --url 'https:/ /dl.dropboxuser content. com/u/13626875/ good.txt' ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ 10T18:41: 53Z | 2a745d21- 66b7-43e0- 90b5-ebe62232f7 d6/file | 66b7-43e0- 90b5-ebe62232f7 d6 | /dl.dropboxuser content. com/u/13626875/ good.txt", "metadata": | 8806e46fb4a7edc a3 | 10T18:42: 21Z | ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ 66b7-43e0- 90b5-ebe62232f7 d6 --file ooo 66b7-43e0- 90b5-ebe62232f7 d6 --url 'https:/ /dl.dropboxuser content. com/u/13626875/ bad.txt' ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ 10T18:41: 53Z | 2a745d21- 66b7-43e0- 90b5-ebe62232f7 d6/file | 66b7-43e0- 90b5-ebe62232f7 d6 | /dl.dropboxuser content. com/u/13626875/ good.txt", "metadata": | /dl.dropboxuser content. com/u/13626875/ bad.txt", "metadata": | 8806e46fb4a7edc a3 | 10T18:42: 29Z | ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ 66b7-43e0- 90b5-ebe62232f7 d6 --url 'https:/ /dl.dropboxuser content. com/u/13626875/ good.txt' 66b7-43e0- 90b5-ebe62232f7 d6 --file ooo
+------
| Property | Value |
+------
| checksum | None |
| container_format | bare |
| created_at | 2015-11-
| disk_format | qcow2 |
| id | 2a745d21-
| locations | [] |
| min_disk | 0 |
| min_ram | 0 |
| name | good |
| owner | f3b42d4b90d840b
| protected | False |
| size | None |
| status | queued |
| tags | [] |
| updated_at | 2015-11-
| virtual_size | None |
| visibility | public |
+------
mfedosin@wdev:~$ glance location-add 2a745d21-
+------
| Property | Value |
+------
| checksum | None |
| container_format | bare |
| created_at | 2015-11-
| disk_format | qcow2 |
| file | /v2/images/
| id | 2a745d21-
| locations | [{"url": "https:/
| | {}}] |
| min_disk | 0 |
| min_ram | 0 |
| name | good |
| owner | f3b42d4b90d840b
| protected | False |
| schema | /v2/schemas/image |
| size | 43 |
| status | active |
| tags | [] |
| updated_at | 2015-11-
| virtual_size | None |
| visibility | public |
+------
mfedosin@wdev:~$ glance image-download 2a745d21-
mfedosin@wdev:~$ cat ooo
I'm really good image.
mfedosin@wdev:~$ glance location-add 2a745d21-
+------
| Property | Value |
+------
| checksum | None |
| container_format | bare |
| created_at | 2015-11-
| disk_format | qcow2 |
| file | /v2/images/
| id | 2a745d21-
| locations | [{"url": "https:/
| | {}}, {"url": "https:/
| | {}}] |
| min_disk | 0 |
| min_ram | 0 |
| name | good |
| owner | f3b42d4b90d840b
| protected | False |
| schema | /v2/schemas/image |
| size | 43 |
| status | active |
| tags | [] |
| updated_at | 2015-11-
| virtual_size | None |
| visibility | public |
+------
mfedosin@wdev:~$ glance location-delete 2a745d21-
mfedosin@wdev:~$ glance image-download 2a745d21-
mfedosin@wdev:~$ cat ooo
All your base are belong to us! Muahahaha!
This behavior breaks the promise that images are immutable, because user can easily modify them. The solution is to limit number of possible locations to 1, but it may break some deployments that use this feature with multiple locations.
Another issue he finds is:
Glance v2 is able to show image location to end user. Like in case 2 this feature has to be activated to allow user make snapshots on ceph deployments. If user knows private location url, then he can create own image and set this location there. Then, if user deletes his image, the original data will be deleted as well. Example:
User gets list of images: ------- ------- ------- ------- ----+-- ------- ------- ------- -----+ ------- ------- ------- ------- ----+-- ------- ------- ------- -----+ 6b9f-4eb4- a666-9743a18684 9e | debian- 8-m-agent. qcow2 | 9700-4715- b81d-4463cd7038 de | TestVM | 35cb-4893- b5d4-1a17e23e53 8a | ubuntu14. 04-x64- docker | d5e5-43d1- 9a08-5fc52bda11 a4 | ubuntu14. 04-x64- kubernetes | ------- ------- ------- ------- ----+-- ------- ------- ------- -----+
mfedosin@winter ~ $ glance image-list
+------
| ID | Name |
+------
| 0741cbc7-
| 2e4b6dca-
| 39599dd3-
| 153397f8-
+------
User requests info about public image he wants to delete: 9700-4715- b81d-4463cd7038 de ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ 79d8a229cc70a07 c6 | 11T03:38: 09Z | 648a-44f5- 83ad-f7bd229927 4e/images/ 2e4b6dca- 9700-4715- b81d- | 9700-4715- b81d-4463cd7038 de | 2b10acbab8e25e4 15 | 11T03:38: 30Z | ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+
mfedosin@winter ~ $ glance image-show 2e4b6dca-
+------
| Property | Value |
+------
| checksum | ee1eca47dc88f48
| container_format | bare |
| created_at | 2016-02-
| direct_url | rbd://647f7ae8-
| | 4463cd7038de/snap |
| disk_format | qcow2 |
| id | 2e4b6dca-
| min_disk | 0 |
| min_ram | 64 |
| name | TestVM |
| owner | 1c6cea59a605437
| protected | False |
| size | 13287936 |
| status | active |
| tags | [] |
| updated_at | 2016-02-
| virtual_size | None |
| visibility | public |
+------
Optional: User may try to download image file with "glance image-download 2e4b6dca- 9700-4715- b81d-4463cd7038 de --file gg"
User copies direct image url: from 'direct_url' or 'locations' field 648a-44f5- 83ad-f7bd229927 4e/images/ 2e4b6dca- 9700-4715- b81d-4463cd7038 de/snap
rbd://647f7ae8-
User creates new image instance in db and sets custom location with "glance --os-image- api-version 1 image-create --location" (v1) or "glance location-add --url" (v2) api-version 1 image-create --location "rbd:// 647f7ae8- 648a-44f5- 83ad-f7bd229927 4e/images/ 2e4b6dca- 9700-4715- b81d-4463cd7038 de/snap" --disk-format qcow2 --container-format bare --name rerere ------- -----+- ------- ------- ------- ------- ------- --+ ------- -----+- ------- ------- ------- ------- ------- --+ 17T11:54: 41.000000 | c6f8-4272- a8a0-453fc0fc03 e2 | bbeab08cca99136 79 | 17T11:54: 44.000000 | ------- -----+- ------- ------- ------- ------- ------- --+ c6f8-4272- a8a0-453fc0fc03 e2 ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+ 17T11:54: 41Z | 648a-44f5- 83ad-f7bd229927 4e/images/ 2e4b6dca- 9700-4715- b81d- | c6f8-4272- a8a0-453fc0fc03 e2 | bbeab08cca99136 79 | 17T11:54: 44Z | ------- -----+- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ----+
mfedosin@winter ~ $ glance --os-image-
+------
| Property | Value |
+------
| checksum | None |
| container_format | bare |
| created_at | 2016-02-
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | b12c6965-
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | rerere |
| owner | fa343a042d2b47c
| protected | False |
| size | 13287936 |
| status | active |
| updated_at | 2016-02-
| virtual_size | None |
+------
Optional: User may try to verify that image has desired location
mfedosin@winter ~ $ glance image-show b12c6965-
+------
| Property | Value |
+------
| checksum | None |
| container_format | bare |
| created_at | 2016-02-
| direct_url | rbd://647f7ae8-
| | 4463cd7038de/snap |
| disk_format | qcow2 |
| id | b12c6965-
| min_disk | 0 |
| min_ram | 0 |
| name | rerere |
| owner | fa343a042d2b47c
| protected | False |
| size | 13287936 |
| status | active |
| tags | [] |
| updated_at | 2016-02-
| virtual_size | None |
| visibility | private |
+------
User deletes his image. Image data will be deleted too. c6f8-4272- a8a0-453fc0fc03 e2 c6f8-4272- a8a0-453fc0fc03 e2 c6f8-4272- a8a0-453fc0fc03 e2 c6f8-4272- a8a0-453fc0fc03 e2 (HTTP 404)
glance image-delete b12c6965-
mfedosin@winter ~ $ glance image-delete b12c6965-
mfedosin@winter ~ $ glance image-show b12c6965-
404 Not Found: No image found with ID b12c6965-
Trying to access public data will failed after that.
There is a fix for that (https:/ /bugs.launchpad .net/glance/ +bug/1546507), but it won't work if private locations are shown to end users.
---