← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1262649] [NEW] query images in order, but return result not in the order

 

Public bug reported:

I call  glance rest api to list all images in order, as follows:
curl  -i -H "X-Auth-Token:1b1dd8200e9e426588457619a0240128" -X GET http://127.0.0.1:9292/v1/images/detail?sort_key=name&sort_dir=asc&limit=20,
show as follows,it sort by desc:
{
    "images": [
        {
            "status": "queued",
            "name": "ubuntu",
            "deleted": false,
            "container_format": null,
            "created_at": "2013-12-19T08:59:20",
            "disk_format": null,
            "updated_at": "2013-12-19T08:59:20",
            "min_disk": 0,
            "protected": false,
            "id": "dc35904d-7845-4c04-9e9c-a5ff978156c1",
            "min_ram": 0,
            "checksum": null,
            "owner": "1ce8eacbd5a948ccb0f30ea23ddcc5ae",
            "is_public": false,
            "deleted_at": null,
            "properties": {},
            "size": null
        },
        {
            "status": "active",
            "name": "cirros-0.3.1-x86_64-uec-ramdisk",
            "deleted": false,
            "container_format": "ari",
            "created_at": "2013-12-19T07:47:19",
            "disk_format": "ari",
            "updated_at": "2013-12-19T07:47:19",
            "min_disk": 0,
            "protected": false,
            "id": "32cae363-c8e1-49be-8ab3-d665beab6f0b",
            "min_ram": 0,
            "checksum": "69c33642f44ca552ba4bb8b66ad97e85",
            "owner": "b92b1832d53549bb901a468b4dd752b3",
            "is_public": true,
            "deleted_at": null,
            "properties": {},
            "size": 3714968
        },
        {
            "status": "active",
            "name": "cirros-0.3.1-x86_64-uec-kernel",
            "deleted": false,
            "container_format": "aki",
            "created_at": "2013-12-19T07:47:19",
            "disk_format": "aki",
            "updated_at": "2013-12-19T07:47:19",
            "min_disk": 0,
            "protected": false,
            "id": "af9accc8-b649-45f9-8c56-69b49d0074ae",
            "min_ram": 0,
            "checksum": "c352f4e7121c6eae958bc1570324f17e",
            "owner": "b92b1832d53549bb901a468b4dd752b3",
            "is_public": true,
            "deleted_at": null,
            "properties": {},
            "size": 4955792
        },
        {
            "status": "active",
            "name": "cirros-0.3.1-x86_64-uec",
            "deleted": false,
            "container_format": "ami",
            "created_at": "2013-12-19T07:47:20",
            "disk_format": "ami",
            "updated_at": "2013-12-19T07:47:21",
            "min_disk": 0,
            "protected": false,
            "id": "2f79327c-9ce0-4ddf-81c2-4ad514bbe85b",
            "min_ram": 0,
            "checksum": "f8a2eeee2dc65b3d9b6e63678955bd83",
            "owner": "b92b1832d53549bb901a468b4dd752b3",
            "is_public": true,
            "deleted_at": null,
            "properties": {
                "kernel_id": "af9accc8-b649-45f9-8c56-69b49d0074ae",
                "ramdisk_id": "32cae363-c8e1-49be-8ab3-d665beab6f0b"
            },
            "size": 25165824
        },
        {
            "status": "queued",
            "name": "abestimage",
            "deleted": false,
            "container_format": null,
            "created_at": "2013-12-19T09:15:34",
            "disk_format": null,
            "updated_at": "2013-12-19T09:15:34",
            "min_disk": 0,
            "protected": false,
            "id": "7c22729f-26af-4f89-a96e-f6a4e54ee933",
            "min_ram": 0,
            "checksum": null,
            "owner": "1ce8eacbd5a948ccb0f30ea23ddcc5ae",
            "is_public": false,
            "deleted_at": null,
            "properties": {},
            "size": null
        }
    ]
}

but when I  use glance client command, it lists correctly by asc , why?  
openstack@openstack-HP:~$ glance image-list --sort-key status --sort-dir asc --sort-key name --sort-dir asc
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| ID                                   | Name                            | Disk Format | Container Format | Size     | Status |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| 7c22729f-26af-4f89-a96e-f6a4e54ee933 | abestimage                      |             |                  |          | queued |
| 2f79327c-9ce0-4ddf-81c2-4ad514bbe85b | cirros-0.3.1-x86_64-uec         | ami         | ami              | 25165824 | active |
| af9accc8-b649-45f9-8c56-69b49d0074ae | cirros-0.3.1-x86_64-uec-kernel  | aki         | aki              | 4955792  | active |
| 32cae363-c8e1-49be-8ab3-d665beab6f0b | cirros-0.3.1-x86_64-uec-ramdisk | ari         | ari              | 3714968  | active |
| dc35904d-7845-4c04-9e9c-a5ff978156c1 | ubuntu                          |             |                  |          | queued |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+

** 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/1262649

Title:
  query images in order, but return result not in the order

Status in OpenStack Image Registry and Delivery Service (Glance):
  New

Bug description:
  I call  glance rest api to list all images in order, as follows:
  curl  -i -H "X-Auth-Token:1b1dd8200e9e426588457619a0240128" -X GET http://127.0.0.1:9292/v1/images/detail?sort_key=name&sort_dir=asc&limit=20,
  show as follows,it sort by desc:
  {
      "images": [
          {
              "status": "queued",
              "name": "ubuntu",
              "deleted": false,
              "container_format": null,
              "created_at": "2013-12-19T08:59:20",
              "disk_format": null,
              "updated_at": "2013-12-19T08:59:20",
              "min_disk": 0,
              "protected": false,
              "id": "dc35904d-7845-4c04-9e9c-a5ff978156c1",
              "min_ram": 0,
              "checksum": null,
              "owner": "1ce8eacbd5a948ccb0f30ea23ddcc5ae",
              "is_public": false,
              "deleted_at": null,
              "properties": {},
              "size": null
          },
          {
              "status": "active",
              "name": "cirros-0.3.1-x86_64-uec-ramdisk",
              "deleted": false,
              "container_format": "ari",
              "created_at": "2013-12-19T07:47:19",
              "disk_format": "ari",
              "updated_at": "2013-12-19T07:47:19",
              "min_disk": 0,
              "protected": false,
              "id": "32cae363-c8e1-49be-8ab3-d665beab6f0b",
              "min_ram": 0,
              "checksum": "69c33642f44ca552ba4bb8b66ad97e85",
              "owner": "b92b1832d53549bb901a468b4dd752b3",
              "is_public": true,
              "deleted_at": null,
              "properties": {},
              "size": 3714968
          },
          {
              "status": "active",
              "name": "cirros-0.3.1-x86_64-uec-kernel",
              "deleted": false,
              "container_format": "aki",
              "created_at": "2013-12-19T07:47:19",
              "disk_format": "aki",
              "updated_at": "2013-12-19T07:47:19",
              "min_disk": 0,
              "protected": false,
              "id": "af9accc8-b649-45f9-8c56-69b49d0074ae",
              "min_ram": 0,
              "checksum": "c352f4e7121c6eae958bc1570324f17e",
              "owner": "b92b1832d53549bb901a468b4dd752b3",
              "is_public": true,
              "deleted_at": null,
              "properties": {},
              "size": 4955792
          },
          {
              "status": "active",
              "name": "cirros-0.3.1-x86_64-uec",
              "deleted": false,
              "container_format": "ami",
              "created_at": "2013-12-19T07:47:20",
              "disk_format": "ami",
              "updated_at": "2013-12-19T07:47:21",
              "min_disk": 0,
              "protected": false,
              "id": "2f79327c-9ce0-4ddf-81c2-4ad514bbe85b",
              "min_ram": 0,
              "checksum": "f8a2eeee2dc65b3d9b6e63678955bd83",
              "owner": "b92b1832d53549bb901a468b4dd752b3",
              "is_public": true,
              "deleted_at": null,
              "properties": {
                  "kernel_id": "af9accc8-b649-45f9-8c56-69b49d0074ae",
                  "ramdisk_id": "32cae363-c8e1-49be-8ab3-d665beab6f0b"
              },
              "size": 25165824
          },
          {
              "status": "queued",
              "name": "abestimage",
              "deleted": false,
              "container_format": null,
              "created_at": "2013-12-19T09:15:34",
              "disk_format": null,
              "updated_at": "2013-12-19T09:15:34",
              "min_disk": 0,
              "protected": false,
              "id": "7c22729f-26af-4f89-a96e-f6a4e54ee933",
              "min_ram": 0,
              "checksum": null,
              "owner": "1ce8eacbd5a948ccb0f30ea23ddcc5ae",
              "is_public": false,
              "deleted_at": null,
              "properties": {},
              "size": null
          }
      ]
  }

  but when I  use glance client command, it lists correctly by asc , why?  
  openstack@openstack-HP:~$ glance image-list --sort-key status --sort-dir asc --sort-key name --sort-dir asc
  +--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
  | ID                                   | Name                            | Disk Format | Container Format | Size     | Status |
  +--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
  | 7c22729f-26af-4f89-a96e-f6a4e54ee933 | abestimage                      |             |                  |          | queued |
  | 2f79327c-9ce0-4ddf-81c2-4ad514bbe85b | cirros-0.3.1-x86_64-uec         | ami         | ami              | 25165824 | active |
  | af9accc8-b649-45f9-8c56-69b49d0074ae | cirros-0.3.1-x86_64-uec-kernel  | aki         | aki              | 4955792  | active |
  | 32cae363-c8e1-49be-8ab3-d665beab6f0b | cirros-0.3.1-x86_64-uec-ramdisk | ari         | ari              | 3714968  | active |
  | dc35904d-7845-4c04-9e9c-a5ff978156c1 | ubuntu                          |             |                  |          | queued |
  +--------------------------------------+---------------------------------+-------------+------------------+----------+--------+

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


Follow ups

References