← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1539722] Re: Image "container_format" incorrectly modified when editing image

 

Reviewed:  https://review.opendev.org/664132
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=ba75bafc69c03f04b3c7d4f50e1cc9e3123743a3
Submitter: Zuul
Branch:    master

commit ba75bafc69c03f04b3c7d4f50e1cc9e3123743a3
Author: 白子玉 <baiziyu@xxxxxxxxxx>
Date:   Sat Jun 8 15:14:51 2019 +0800

    Specify proper container_format for 'vhd' disk_format
    
    When editing an image, if the disk_fomrat is 'vhd',
    the container_format was wrongly set to 'bare' before.
    'ovf' is the correct container_format for 'vhd' disk images.
    
    Closes-Bug: #1539722
    Change-Id: Ic6b0c66af0d5c8db2d802d6eea2b97721d92b7eb


** Changed in: horizon
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1539722

Title:
  Image "container_format" incorrectly modified when editing image

Status in OpenStack Dashboard (Horizon):
  Fix Released

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/openstack-
  dashboard/openstack_dashboard/dashboards/project/images/images/forms.py.
  In the function "create_image_metadata", there is a section which
  states:

  if disk_format in ('ami', 'aki', 'ari',):
      container_format = disk_format
  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_format = 'docker'
  else:
      container_format = 'bare'

  
  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_format = disk_format
  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_format = 'docker'
  elif disk_format == 'vhd':
      container_format = 'ovf'
  else:
      container_format = 'bare'

  
  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

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


References