Ask Your Question
0

Why does openstack image create of cirros result in size 0

asked 2017-01-26 17:30:34 -0500

naveensan1 gravatar image

updated 2017-01-30 13:35:04 -0500

I'm trying to install Newton on Ubuntu 16.04 and going step by step through the http://docs.openstack.org/newton/install-guide-ubuntu/glance-verify.html (official openstack guide).

At glance verification stage I downloaded the cirros-0.3.4-x86_64-disk.img and executed the following:

root@osc-1:~# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img   --disk-format qcow2 --container-format bare --public
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | d41d8cd98f00b204e9800998ecf8427e                     |
| container_format | bare                                                 |
| created_at       | 2017-01-26T23:10:14Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/69a929b4-3c47-4a26-86da-819b857fbfa6/file |
| id               | 69a929b4-3c47-4a26-86da-819b857fbfa6                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | cirros                                               |
| owner            | 35b549fd72ca4b398bfecf1572ca9738                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 0                                                    |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2017-01-26T23:10:14Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+

Looking closely at the output the size is '0':

| size             | 0                                                    |

   root@osc-1:/var/lib/glance/images# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 69a929b4-3c47-4a26-86da-819b857fbfa6 | cirros | active |
+--------------------------------------+--------+--------+

Under /var/lib/glance the image size is 0 as well:

  root@osc-1:/var/lib/glance# ls -lart
    total 16
    drwxr-xr-x  5 glance glance 4096 Jan 17 18:16 image-cache
    drwxr-xr-x 54 root   root   4096 Jan 26 13:26 ..
    drwxr-xr-x  4 glance glance 4096 Jan 26 15:04 .
    drwxr-xr-x  2 glance glance 4096 Jan 26 15:10 images
    root@osc-1:/var/lib/glance# cd images
    root@osc-1:/var/lib/glance/images# ls -lart
    total 8
    drwxr-xr-x 4 glance glance 4096 Jan 26 15:04 ..
    -rw-r----- 1 glance glance    0 Jan 26 15:10 69a929b4-3c47-4a26-86da-819b857fbfa6
    drwxr-xr-x 2 glance glance 4096 Jan 26 15:10 .

I've been through the installation once before to know that at the end, VM boot fails. From the VM console the message "no bootable device" appears and that's because the disk size is 0 as well.

cat /etc/glance/glance-api.conf | grep -v ^# | grep -v ^$
[DEFAULT]
debug=True
[cors]
[cors.subdomain]
[database]
sqlite_db = /var/lib/glance/glance.sqlite
backend = sqlalchemy
connection = mysql+pymysql://glance:######@10.100.100.20/glance
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[image_format]
disk_formats = ami,ari,aki,vhd,vhdx,vmdk,raw,qcow2,vdi,iso,root-tar
[keystone_authtoken]
auth_uri = http://10.100.100.20:5000
auth_url = http://10.100.100.20:35357
memcached_servers = 10.100.100.20:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = services
username = glance
password = #######
[matchmaker_redis]
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]

I've tried some other images too like an ISO and another QCOW but it is always size 0

Update

I've narrowed down the problem to a package I installed before openstack configuration. The problem stems from "pip install networking-bgpvpn==5.0.0" which is a requirement for the controller I'm setting up. That package seems to make a lot of modifications to core openstack python libraries and utilities (oslo, Jinja2 etc).

I went through another round of installation and configuration but this time without installing networking-bgpvpn and was successfully able to create an image with the correct size (not zero).

I have raised a launchpad bug against the newtorking-bgpvpn project highlighting this issue. Thanks for all the feedback!

edit retag flag offensive close merge delete

Comments

I would look at the glance api log and search for entries that contain the image ID. The log entries that describe how the file is uploaded may contain clues.

Bernd Bausch gravatar imageBernd Bausch ( 2017-01-27 05:53:55 -0500 )edit

4 answers

Sort by ยป oldest newest most voted
1

answered 2017-02-04 11:39:13 -0500

hyphon81 gravatar image

Same one. The size 0 image was created in my environment with no error.

Eventually, I found it to happen when glanceclient is sending PUT message. I modified glanceclient code and I could create images correctly.

I'm trying to construct OpenStack Newton with source build and I referred from http://docs.openstack.org/newton/install-guide-ubuntu/index.html.

The python "requests" package version 2.13.0 needs to receive the "file-like" object. (http://docs.python-requests.org/en/master/api/) However, the glanceclient version 2.5.0 was sending generator object.

For the moment, I patched this code to glanceclient and I got image has right image size.

diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py
index 352ba10..e49442f 100644
--- a/glanceclient/common/http.py
+++ b/glanceclient/common/http.py
@@ -84,7 +84,12 @@ class _BaseHTTPClient(object):
# Here we assume it's
# a file-like object
# and we'll chunk it
- data = self._chunk_body(data)
+ #data = self._chunk_body(data)
+
+ # WORKAROUND
+ # The chunked generator object
+ # caused creating size 0 image
+ data = data

headers['Content-Type'] = content_type
kwargs['stream'] = content_type == 'application/octet-stream'

edit flag offensive delete link more

Comments

may be not data=data, may be simple "pass" ?

Alexey Shabalin gravatar imageAlexey Shabalin ( 2017-02-27 02:30:04 -0500 )edit

Yes, you are right. I thought the file object was inserted to data. However, "pass" is simpler and better.

hyphon81 gravatar imagehyphon81 ( 2017-03-09 20:05:35 -0500 )edit
0

answered 2017-02-21 07:34:28 -0500

kmadac gravatar image

Same problem here. I just reported bug here https://bugs.launchpad.net/python-glanceclient/+bug/1666511

edit flag offensive delete link more
0

answered 2017-02-14 18:53:41 -0500

Thank you very much! I meet same issue! In my test Openstack Newton environment, the glance create image normal. $ pip list|egrep 'requests|glance' glance (13.0.0) glance-store (0.18.0) python-glanceclient (2.5.0) requests (2.12.4) But in my new Newton environment, the glance create image always size=0+active, even default_store=rbd or file. $ pip list|egrep 'requests|glance' glance (13.0.0) glance-store (0.20.0) python-glanceclient (2.5.0) requests (2.13.0)

Because my test environment is two controller nodes HA, new environment is 3 controller nodes cluster, then I re-install a standalone controller node only with keystone and glance. After setup, I find created images still with size=0+active! glance (13.0.0) glance-store (0.20.0) python-glanceclient (2.6.0) requests (2.13.0)

Finally I find your email, then I think it caused by new version requests and python-glanceclient! I modify as your mail, it do work!

Thank you again! It waste my 3 weeks.

edit flag offensive delete link more
0

answered 2017-01-30 05:15:24 -0500

Rupesh Chowdary gravatar image

Here i followed the steps , which mentioned the same above, image description image description

After upload the image i am able to see the complete image. Please check the below two things

  1. After download the image check size of the image before upload.
  2. Check the free space in the disk.

No Need to do any additional configurations.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-01-26 17:30:34 -0500

Seen: 294 times

Last updated: Jan 30