tasks: disk_format ignored when 'work_dir' is set

Bug #1570801 reported by Stuart McLaren
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
Abhijeet Malawade

Bug Description

If, in glance-api.conf work_dir is not defined:

[task]
#work_dir

The following API call (with disk_format=qcow2):

 POST /v2/tasks HTTP/1.1.
 User-Agent: curl/7.38.0.
 Host: localhost:9292.
 Accept: */*.
 x-auth-token: 1acdf9b1f89f4aaf983079250fcefb3d.
 Content-Length: 232.
 Content-Type: application/x-www-form-urlencoded.
 .
 {
  "type": "import",
  "input": {
    "import_from": "http://localhost:54321/hi.txt",
    "import_from_format": "bare",
    "image_properties": {
      "name": "imgx",
      "disk_format": "qcow2",
      "container_format": "bare"
    }
  }
 }

results in an image with disk_format qcow2:

 $ glance image-show e315a86f-5b58-478a-9f34-c99f2d6e8365
 +------------------+--------------------------------------+
 | Property | Value |
 +------------------+--------------------------------------+
 | checksum | 764efa883dda1e11db47671c4a3bbd9e |
 | container_format | bare |
 | created_at | 2016-04-15T11:01:52Z |
 | disk_format | qcow2 |
 | id | e315a86f-5b58-478a-9f34-c99f2d6e8365 |
 | min_disk | 0 |
 | min_ram | 0 |
 | name | imgx |
 | owner | 3f2ce9bf40a443f2b072a69ff10bba92 |
 | protected | False |
 | size | 3 |
 | status | active |
 | tags | [] |
 | updated_at | 2016-04-15T11:01:54Z |
 | virtual_size | None |
 | visibility | private |
 +------------------+--------------------------------------+

If the work_dir is defined

[task]
work_dir = /tmp/work

and the same API call is made, the disk_format is not qcow2, but 'raw':

 $ glance image-show 5d6c4437-c7c2-4e95-aa81-c973fed2f2bd
 +------------------+--------------------------------------+
 | Property | Value |
 +------------------+--------------------------------------+
 | checksum | 764efa883dda1e11db47671c4a3bbd9e |
 | container_format | bare |
 | created_at | 2016-04-15T11:03:01Z |
 | disk_format | raw | <<<<<<<<<<<<<<<
 | id | 5d6c4437-c7c2-4e95-aa81-c973fed2f2bd |
 | min_disk | 0 |
 | min_ram | 0 |
 | name | imgx |
 | owner | 3f2ce9bf40a443f2b072a69ff10bba92 |
 | protected | False |
 | size | 3 |
 | status | active |
 | tags | [] |
 | updated_at | 2016-04-15T11:03:03Z |
 | virtual_size | 512 |
 | visibility | private |
 +------------------+--------------------------------------+

Revision history for this message
Abhijeet Malawade (abhijeet-malawade) wrote :

After defining 'work_dir' config option, 'disk_format' is getting changed to 'raw' in _Introspect task (https://github.com/openstack/glance/blob/master/glance/async/flows/introspect.py#L72). _Introspect task gets correct disk format of file using qemu-img info command.

_Introspect task gets run only when 'work_dir' config option is defined.

Is this correct behaviour OR do we need to set 'disk_format' of image to whatever user has provided (i.e.- do not update 'disk_format' in _Introspect task) ?

Changed in glance:
assignee: nobody → Abhijeet Malawade (abhijeet-malawade)
Revision history for this message
Wenjun Wang (wangwenjun) wrote :

We should check the image's disk_format whether is the same with the user provided,an exception will be good if they are not matched as I think,what do you think of my opinion?

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.