Image type should be a facet - Can't select snapshots vs images

Bug #1569485 reported by Travis Tripp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Searchlight
Fix Released
High
Lakshmi N Sampath

Bug Description

Glance images can either be of type Image or of type Snapshot.

This is determined with the image_type property.

This property is ONLY set if the image is of type snapshot.

Doing free form text queries work, eg. image_type:snapshot

However, there is no facet for image_type which makes filtering in the UI harder.

openstack search facet list --type OS::Glance::Image
+-------------------+---------+------------------+-------------------------------------------------+
| Resource Type | Type | Name | Options |
+-------------------+---------+------------------+-------------------------------------------------+
| OS::Glance::Image | string | status | active(10) |
| OS::Glance::Image | date | created_at | |
| OS::Glance::Image | long | virtual_size | |
| OS::Glance::Image | string | name | |
| OS::Glance::Image | string | tags | fedora(3), python(3), apache(2), web(2), dev(1) |
| OS::Glance::Image | string | kernel_id | |
| OS::Glance::Image | string | container_format | bare(7), aki(1), ami(1), ari(1) |
| OS::Glance::Image | long | min_ram | |
| OS::Glance::Image | string | ramdisk_id | |
| OS::Glance::Image | string | disk_format | raw(5), qcow2(2), aki(1), ami(1), ari(1) |
| OS::Glance::Image | date | updated_at | |
| OS::Glance::Image | string | visibility | private(5), public(5) |
| OS::Glance::Image | string | owner | |
| OS::Glance::Image | boolean | protected | F(9), T(1) |
| OS::Glance::Image | string | members | |
| OS::Glance::Image | string | checksum | |
| OS::Glance::Image | long | min_disk | |
| OS::Glance::Image | long | size | |
| OS::Glance::Image | string | id | |
| OS::Glance::Image | string | description | |
+-------------------+---------+------------------+-------------------------------------------------+

See UI screen shot (no facet shown, had to do freeform query: http://pasteboard.co/8tYEOU2.png)

I propose that we had image_type as a mapping:

https://github.com/openstack/searchlight/blob/master/searchlight/elasticsearch/plugins/glance/images.py#L42

And that we add a default value of "image" to image_type when serializing the image if another value is not found:

https://github.com/openstack/searchlight/blob/master/searchlight/elasticsearch/plugins/glance/__init__.py#L56

And we add image_type to types with options:

https://github.com/openstack/searchlight/blob/master/searchlight/elasticsearch/plugins/glance/images.py#L75

summary: - Image type should be a facet
+ Image type should be a facet - Can't select snapshots vs images
Changed in searchlight:
importance: Undecided → High
Revision history for this message
Steve McLellan (sjmc7) wrote :

I don't have a problem doing this. Are there any other fields that might also be candidates for adding that only appear for snapshots?

Steve McLellan (sjmc7)
Changed in searchlight:
assignee: nobody → Steve McLellan (sjmc7)
assignee: Steve McLellan (sjmc7) → nobody
Changed in searchlight:
assignee: nobody → Lakshmi N Sampath (lakshmi-sampath)
milestone: none → newton-1
Changed in searchlight:
status: New → In Progress
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Strictly speaking, image_type isn't a Glance thing, but the Nova proxy to Glance uses it when you add the 'type=whatever' query string to the Compute API list-images or list-images-detail calls. That being said, most OpenStack clouds will have image_type: base for what we call "public" images in Glance, and image_type: snapshot for snapshots. (If they don't add image_type on their base images, then they can't be listed using the Compute API.) Nova also has 'backup' reserved as an image_type, but I'm not sure how widely used that is.

I believe that by default Nova will add the base_image_ref property to snapshots. "Base" images and imported images will not have this property.

Another useful one is instance_uuid, which Nova will add to snapshots. Again, "base" images and imported images will not have this property.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to searchlight (master)

Fix proposed to branch: master
Review: https://review.openstack.org/317741

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to searchlight (master)

Reviewed: https://review.openstack.org/317741
Committed: https://git.openstack.org/cgit/openstack/searchlight/commit/?id=0074de28e893318dae4108e2f83e059cddcfcc8c
Submitter: Jenkins
Branch: master

commit 0074de28e893318dae4108e2f83e059cddcfcc8c
Author: Lakshmi N Sampath <email address hidden>
Date: Tue May 17 14:25:21 2016 -0700

    Image type should be a facet

    Glance images can either be of type Image or of type Snapshot.
    This is determined with the image_type property. This property
    is ONLY set if the image is of type snapshot.

    However, there is no facet for image_type which makes filtering
    in the UI harder.

    To make it consistent, Searchlight will insert a value('image')
    in 'image_type' field for base images.
    For images based on snapshot glance provides 'snapshot' as value

    Change-Id: Ib4d73b12d82229a2bb85434f665d734b171557b7
    Closes-Bug: #1569485

Changed in searchlight:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/searchlight 1.0.0.0b2

This issue was fixed in the openstack/searchlight 1.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.