create a volume from an image raise AttributeError

Bug #1347376 reported by Zhang Hao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Invalid
Wishlist
Zhang Hao

Bug Description

I'm working under RHEL7 + ICEHOUSE 2014.1
For glance, image is stored in local file system.

I want to create a volume from an image.

First,I use glance cli to upload an image
"glance image-create --name imgtest --disk-format qcow2 --is-public false --copy-from 'http://10.43.179.2:8081/files/linux/cirros-0.3.0-x86_64-disk.img'"

Then,I run command
"cinder create --image-id ${image_id} --display-name ${name} ${size}"

But I get error "glanceclient AttributeError: container_format" ,in ciner-api debug info:

------------------------------ ciner-api debug log ------------------------------------
2014-07-22 17:25:32.310 15514 TRACE cinder.api.middleware.fault base_image_meta = self._translate_from_glance(image)

2014-07-22 17:25:32.310 15514 TRACE cinder.api.middleware.fault output[attr] = getattr(image, attr)

2014-07-22 17:25:32.310 15514 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/glanceclient/common/base.py", line 95, in __getattr__

2014-07-22 17:25:32.310 15514 TRACE cinder.api.middleware.fault return self.__getattr__(k)

2014-07-22 17:25:32.310 15514 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/site-packages/glanceclient/common/base.py", line 97, in __getattr__

2014-07-22 17:25:32.310 15514 TRACE cinder.api.middleware.fault raise AttributeError(k)

2014-07-22 17:25:32.310 15514 TRACE cinder.api.middleware.fault AttributeError: container_format
--------------------------------------------------------------------------------------

Then I find out, using glance cli to upload an image, the value of this image's container_format is 'None' in mysql.

But use dashboard to upload an image, the value of container_format is default to 'Bare'.

When we create a volume from an image, glanceclient checks the Attribute container_format. So we get this error.

Zhang Hao (zhang-hao16)
summary: - create a volume from a image raise AttributeError
+ create a volume from an image raise AttributeError
description: updated
Zhang Hao (zhang-hao16)
Changed in glance:
assignee: nobody → Zhang Hao (zhang-hao16)
Zhang Hao (zhang-hao16)
description: updated
Zhang Hao (zhang-hao16)
description: updated
Revision history for this message
Zhang Hao (zhang-hao16) wrote :

I add a check in glance\api\v1\images.py: Controller.create(), if the value of container_format is 'None', default to set the value 'Bare'.
Then I create a volume from an image successfully.

In order to maintain consistent, as far as i am concern, the default value of container_format in glance cli should also be provided like it does in dashboard.

Revision history for this message
Mark Washenberger (markwash) wrote :

I like the idea of making the default container format 'bare' in the server as well. I think that would save a lot of the headache that is experienced by client users.

We could do one of two ways:
  #1 in glanceclient, during image-create, if data is given (--copy-from or --file or --stdin), but --container-format is not specified, set container-format: 'bare' during the api request.
  #2 just make the server default for container format bare

#1 is way less invasive but it doesn't cover all of the use cases
#2 is better coverage but also slightly backwards incompatible

Either way I don't really think of this as a bug (since honestly the current behavior in glance is intentional), but as a feature request. I'm willing to file a spec for it, and I've added it to the next team meeting agenda.

Changed in glance:
status: New → Invalid
importance: Undecided → Wishlist
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.