tasks: disk_format ignored when 'work_dir' is set
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: 1acdf9b1f89f4aa
Content-Length: 232.
Content-Type: application/
.
{
"type": "import",
"input": {
"import_from": "http://
"import_
"image_
"name": "imgx",
"
"
}
}
}
results in an image with disk_format qcow2:
$ glance image-show e315a86f-
+-----
| Property | Value |
+-----
| checksum | 764efa883dda1e1
| container_format | bare |
| created_at | 2016-04-
| disk_format | qcow2 |
| id | e315a86f-
| min_disk | 0 |
| min_ram | 0 |
| name | imgx |
| owner | 3f2ce9bf40a443f
| protected | False |
| size | 3 |
| status | active |
| tags | [] |
| updated_at | 2016-04-
| 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-
+-----
| Property | Value |
+-----
| checksum | 764efa883dda1e1
| container_format | bare |
| created_at | 2016-04-
| disk_format | raw | <<<<<<<<<<<<<<<
| id | 5d6c4437-
| min_disk | 0 |
| min_ram | 0 |
| name | imgx |
| owner | 3f2ce9bf40a443f
| protected | False |
| size | 3 |
| status | active |
| tags | [] |
| updated_at | 2016-04-
| virtual_size | 512 |
| visibility | private |
+-----
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) ?