← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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

** Affects: horizon
     Importance: Undecided
         Status: New

-- 
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):
  New

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


Follow ups