Image "container_format" incorrectly modified when editing image
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Dashboard (Horizon) |
Fix Released
|
Medium
|
Ziyu Bai |
Bug Description
Hello,
When editing a Glance image in Horizon (for example, changing its name), Horizon is incorrectly changing the container_format to "bare", losing whatever the value previously was. This is affecting images which have been taken from XenServer, as the container_format is changed from "ovf" to "bare". The end-result of this, is that Cinder does not run through the proper image conversion procedures (coalesce, etc.) when creating a Volume from that Image. Instead it will just dump the .gz file onto the volume, which is obviously unbootable.
We have traced the problem down to the file /usr/share/
if disk_format in ('ami', 'aki', 'ari',):
container_
elif disk_format == 'docker':
# To support docker containers we allow the user to specify
# 'docker' as the format. In that case we really want to use
# 'raw' as the disk format and 'docker' as the container format.
disk_format = 'raw'
container_
else:
container_
It's clear to see here how this is overriding the container_format from its proper value. I believe an appropriate patch would be to add an an "elif disk_format=='vhd' " section. For example, we have done the following which is working for us:
if disk_format in ('ami', 'aki', 'ari',):
container_
elif disk_format == 'docker':
# To support docker containers we allow the user to specify
# 'docker' as the format. In that case we really want to use
# 'raw' as the disk format and 'docker' as the container format.
disk_format = 'raw'
container_
elif disk_format == 'vhd':
container_
else:
container_
I'm not enough of a developer to know if this is truly the correct patch, or if this will break some other functionality for someone else. Could a real developer please take a look at this, and patch as appropriate?
Thanks in advance,
Alex Oughton
Changed in horizon: | |
status: | New → Confirmed |
Changed in horizon: | |
status: | In Progress → New |
assignee: | Renjie Sun (sunrenjie6) → nobody |
Changed in horizon: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
milestone: | none → next |
Changed in horizon: | |
status: | Confirmed → In Progress |
assignee: | nobody → Ziyu Bai (baiziyu-inspur) |
Changed in horizon: | |
status: | In Progress → Fix Committed |
Changed in horizon: | |
status: | Fix Committed → In Progress |
Changed in horizon: | |
status: | In Progress → Fix Committed |
I took a cirros qcow2 image, convert to vhd (using qemu-img command given in [1]), upload with container_ format= ovf to a devstack+kvm installation to give it a run.
The part of modifying container_format to bare while editing the image is verified, as expected. However, the vhd image with bare container_format can be used to boot vm (maybe some kvm vs. Xen thing?). Therefore, there is no strong reason to give a disk=vhd => container=ovf deduction (correct me if possible). Anyway, the inline comments and docs [2] do not say much about that.
That said, the idea I come up is that, we could take the existing container value into account in create_ image_metadata( ). If the image format does not change during the image update, we could re-use the old container_format. Otherwise, we shall fall back to the existing deduction logic. Such modest approach may fit horizon better, being a client as thin as possible.
I created a quick-and-dirty patch for it. Please take a look at it. :)
[1] http:// docs.openstack. org/image- guide/convert- images. html docs.openstack. org/image- guide/image- formats. html
[2] http://