Bug 890207

Summary: Ensure that glance operates properly with v2 API disabled
Product: Red Hat OpenStack Reporter: Perry Myers <pmyers>
Component: openstack-glanceAssignee: Flavio Percoco <fpercoco>
Status: CLOSED ERRATA QA Contact: Attila Fazekas <afazekas>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0 (Folsom)CC: dpaikov, fpercoco, hateya, jhenner
Target Milestone: snapshot1   
Target Release: 3.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-29 11:03:20 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Perry Myers 2012-12-25 12:59:40 EST
Ensure that glance operates properly with v2 API disabled
Comment 1 Flavio Percoco 2013-05-03 06:00:06 EDT
Steps to verify:

1) Edit /etc/glance/glance-api.conf and set enable_v2_api = False
2) Restart glance-api

Issued commands:

# Verify v2 is actually disabled
[ec2-user@test-v2-disabled devstack]$ curl http://localhost:9292/ | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   220  100   220    0     0   6330      0 --:--:-- --:--:-- --:--:--  8461
{
    "versions": [
        {
            "id": "v1.1", 
            "links": [
                {
                    "href": "http://localhost:9292/v1/", 
                    "rel": "self"
                }
            ], 
            "status": "CURRENT"
        }, 
        {
            "id": "v1.0", 
            "links": [
                {
                    "href": "http://localhost:9292/v1/", 
                    "rel": "self"
                }
            ], 
            "status": "SUPPORTED"
        }
    ]
}

# List images
[ec2-user@test-v2-disabled devstack]$ glance image-list
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| ID                                   | Name                            | Disk Format | Container Format | Size     | Status |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| 356d6155-1143-4703-bae9-b6705e5239a1 | cirros-0.3.1-x86_64-uec         | ami         | ami              | 25165824 | active |
| d7ea175c-8e5a-4d53-9494-4e77bcff680f | cirros-0.3.1-x86_64-uec-kernel  | aki         | aki              | 4955792  | active |
| 54b77080-4661-4a80-8cad-0a7899148ee5 | cirros-0.3.1-x86_64-uec-ramdisk | ari         | ari              | 3714968  | active |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+

# Show image
[ec2-user@test-v2-disabled devstack]$ glance image-show 356d6155-1143-4703-bae9-b6705e5239a1
+-----------------------+--------------------------------------+
| Property              | Value                                |
+-----------------------+--------------------------------------+
| Property 'kernel_id'  | d7ea175c-8e5a-4d53-9494-4e77bcff680f |
| Property 'ramdisk_id' | 54b77080-4661-4a80-8cad-0a7899148ee5 |
| checksum              | f8a2eeee2dc65b3d9b6e63678955bd83     |
| container_format      | ami                                  |
| created_at            | 2013-05-03T09:03:08                  |
| deleted               | False                                |
| disk_format           | ami                                  |
| id                    | 356d6155-1143-4703-bae9-b6705e5239a1 |
| is_public             | True                                 |
| min_disk              | 0                                    |
| min_ram               | 0                                    |
| name                  | cirros-0.3.1-x86_64-uec              |
| owner                 | 7a8d1024a8e844ed80678d3afe3aaa57     |
| protected             | False                                |
| size                  | 25165824                             |
| status                | active                               |
| updated_at            | 2013-05-03T09:03:09                  |
+-----------------------+--------------------------------------+

# Create Image
[ec2-user@test-v2-disabled cirros-0.3.1-x86_64-uec]$ glance image-create --name test --container-format ami --disk-format ami < cirros-0.3.1-x86_64-blank.img
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | f8a2eeee2dc65b3d9b6e63678955bd83     |
| container_format | ami                                  |
| created_at       | 2013-05-03T09:53:27                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | ami                                  |
| id               | 7c2ec94b-da5e-43df-9934-c6c4a08f09ee |
| is_public        | False                                |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | test                                 |
| owner            | c8b5cad6deec47529d442dd9c318fabb     |
| protected        | False                                |
| size             | 25165824                             |
| status           | active                               |
| updated_at       | 2013-05-03T09:53:29                  |
+------------------+--------------------------------------+

# Delete Image
[ec2-user@test-v2-disabled cirros-0.3.1-x86_64-uec]$ glance image-delete 7c2ec94b-da5e-43df-9934-c6c4a08f09ee

# Member add
[ec2-user@test-v2-disabled cirros-0.3.1-x86_64-uec]$ glance member-list --image-id 356d6155-1143-4703-bae9-b6705e5239a1


# Verify that called URL is actually using v1
[ec2-user@test-v2-disabled cirros-0.3.1-x86_64-uec]$ glance -d image-list                                                                                                                                                                      
curl -i -X GET -H 'X-Auth-Token: HUGE TOKEN' -H 'Content-Type: application/json' -H 'User-Agent: python-glanceclient' http://10.10.10.6:9292/v1/images/detail?sort_key=name&sort_dir=asc&limit=20

HTTP/1.1 200 OK
date: Fri, 03 May 2013 09:58:58 GMT
content-length: 1513
content-type: application/json; charset=UTF-8
x-openstack-request-id: req-dc65cbcb-1c8a-4808-b24f-975987c6020b

{"images": [{"status": "active", "name": "cirros-0.3.1-x86_64-uec", "deleted": false, "container_format": "ami", "created_at": "2013-05-03T09:03:08", "disk_format": "ami", "updated_at": "2013-05-03T09:03:09", "id": "356d6155-1143-4703-bae9-b6705e5239a1", "min_disk": 0, "protected": false, "min_ram": 0, "checksum": "f8a2eeee2dc65b3d9b6e63678955bd83", "owner": "7a8d1024a8e844ed80678d3afe3aaa57", "is_public": true, "deleted_at": null, "properties": {"kernel_id": "d7ea175c-8e5a-4d53-9494-4e77bcff680f", "ramdisk_id": "54b77080-4661-4a80-8cad-0a7899148ee5"}, "size": 25165824}, {"status": "active", "name": "cirros-0.3.1-x86_64-uec-kernel", "deleted": false, "container_format": "aki", "created_at": "2013-05-03T09:03:03", "disk_format": "aki", "updated_at": "2013-05-03T09:03:04", "id": "d7ea175c-8e5a-4d53-9494-4e77bcff680f", "min_disk": 0, "protected": false, "min_ram": 0, "checksum": "c352f4e7121c6eae958bc1570324f17e", "owner": "7a8d1024a8e844ed80678d3afe3aaa57", "is_public": true, "deleted_at": null, "properties": {}, "size": 4955792}, {"status": "active", "name": "cirros-0.3.1-x86_64-uec-ramdisk", "deleted": false, "container_format": "ari", "created_at": "2013-05-03T09:03:05", "disk_format": "ari", "updated_at": "2013-05-03T09:03:06", "id": "54b77080-4661-4a80-8cad-0a7899148ee5", "min_disk": 0, "protected": false, "min_ram": 0, "checksum": "69c33642f44ca552ba4bb8b66ad97e85", "owner": "7a8d1024a8e844ed80678d3afe3aaa57", "is_public": true, "deleted_at": null, "properties": {}, "size": 3714968}]}

+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| ID                                   | Name                            | Disk Format | Container Format | Size     | Status |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| 356d6155-1143-4703-bae9-b6705e5239a1 | cirros-0.3.1-x86_64-uec         | ami         | ami              | 25165824 | active |
| d7ea175c-8e5a-4d53-9494-4e77bcff680f | cirros-0.3.1-x86_64-uec-kernel  | aki         | aki              | 4955792  | active |
| 54b77080-4661-4a80-8cad-0a7899148ee5 | cirros-0.3.1-x86_64-uec-ramdisk | ari         | ari              | 3714968  | active |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
[ec2-user@test-v2-disabled cirros-0.3.1-x86_64-uec]$
Comment 5 Daniel Paikov 2013-05-22 10:21:07 EDT
Checked on openstack-glance-2013.1-3.
Comment 7 errata-xmlrpc 2013-05-29 11:03:20 EDT
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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2013-0878.html