Cinder copy-to-image does not set Glance image size

asked 2015-01-02 09:51:54 -0500

Michiel K gravatar image

I've got an issue with Cinder during upload-to-image, where Glance reports the image to be size 0 (causing issues during downloading and nova launch). See the transcript below. I'm using Havana with Ceph as backend for both Glance and Cinder. Config files are also supplied.

From playing with "glance --debug image-upload" i understand that usually the client should set the image size when uploading, but I've been digging though the source code of Cinder and was unable to find where this would be done.

According to the following articles, uploading an volume from cinder to glance should not result in size 0.

Am I missing a config entry?

root@cc1:~# glance image-show 7b19eb80-3879-4601-940b-be992168c7fe
+--------------------------+--------------------------------------+
| Property                 | Value                                |
+--------------------------+--------------------------------------+
| Property 'image_os_type' | linux                                |
| checksum                 | 740f11888415319c43a93a3bf53cb6ef     |
| container_format         | bare                                 |
| created_at               | 2014-12-08T14:37:14                  |
| deleted                  | False                                |
| disk_format              | raw                                  |
| id                       | 7b19eb80-3879-4601-940b-be992168c7fe |
| is_public                | True                                 |
| min_disk                 | 0                                    |
| min_ram                  | 0                                    |
| name                     | Ubuntu 14.04                         |
| owner                    | e9ce570f6b6345ccb785f528e57ba4b9     |
| protected                | False                                |
| size                     | 2361393152                           |
| status                   | active                               |
| updated_at               | 2014-12-10T13:36:31                  |
+--------------------------+--------------------------------------+
root@cc1:~# cinder create 3 --display-name ubuntu-test --image-id 7b19eb80-3879-4601-940b-be992168c7fe
+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|     attachments     |                  []                  |
|  availability_zone  |                 nova                 |
|       bootable      |                false                 |
|      created_at     |      2015-01-02T15:24:04.708899      |
| display_description |                 None                 |
|     display_name    |             ubuntu-test              |
|          id         | 73953210-9dd2-4d98-9c24-fe772737b5cb |
|       image_id      | 7b19eb80-3879-4601-940b-be992168c7fe |
|       metadata      |                  {}                  |
|         size        |                  3                   |
|     snapshot_id     |                 None                 |
|     source_volid    |                 None                 |
|        status       |               creating               |
|     volume_type     |                 None                 |
+---------------------+--------------------------------------+
root@cc1:~# cinder show 73953210-9dd2-4d98-9c24-fe772737b5cb
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|            Property            |                                                                                                                            Value                                                                                                                            |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|          attachments           |                                                                                                                              []                                                                                                                             |
|       availability_zone        |                                                                                                                             nova                                                                                                                            |
|            bootable            |                                                                                                                             true                                                                                                                            |
|           created_at           |                                                                                                                  2015-01-02T15:24:04.000000                                                                                                                 |
|      display_description       |                                                                                                                             None                                                                                                                            |
|          display_name          |                                                                                                                         ubuntu-test                                                                                                                         |
|               id               |                                                                                                             73953210-9dd2-4d98-9c24-fe772737b5cb                                                                                                            |
|            metadata            |                                                                                                                              {}                                                                                                                             |
|     os-vol-host-attr:host      |                                                                                                                             cn4                                                                                                                             |
| os-vol-mig-status-attr:migstat |                                                                                                                             None                                                                                                                            |
| os-vol-mig-status-attr:name_id |                                                                                                                             None                                                                                                                            |
|  os-vol-tenant-attr:tenant_id  |                                                                                                               e9ce570f6b6345ccb785f528e57ba4b9                                                                                                              |
|              size              |                                                                                                                              3                                                                                                                              |
|          snapshot_id           |                                                                                                                             None                                                                                                                            |
|          source_volid          |                                                                                                                             None                                                                                                                            |
|             status             |                                                                                                                          available                                                                                                                          |
|     volume_image_metadata      | {u'container_format': u'bare', u'min_ram': u'0', u'disk_format': u'raw', u'image_name': u'Ubuntu 14.04', u'image_id': u'7b19eb80-3879-4601-940b-be992168c7fe', u'checksum': u'740f11888415319c43a93a3bf53cb6ef', u'min_disk': u'0', u'size': u'2361393152'} |
|          volume_type           |                                                                                                                             None                                                                                                                            |
+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
root@cc1:~# cinder upload-to-image 73953210-9dd2-4d98-9c24-fe772737b5cb ubuntu-test
+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|   container_format  |                 bare                 |
|     disk_format     |                 raw                  |
| display_description |                 None                 |
|          id         | 73953210-9dd2-4d98-9c24-fe772737b5cb |
|       image_id      | e7ec2db5-a9c8-4ee7-8d73-c804ff80d7ac |
|      image_name     |             ubuntu-test              |
|         size        |                  3                   |
|        status       |              uploading               |
|      updated_at     |      2015-01-02T15:24:06.000000      |
|     volume_type     |                 None                 |
+---------------------+--------------------------------------+

All OK so far.. But when looking in Glance:

root@cc1:~# glance image-show e7ec2db5-a9c8-4ee7-8d73-c804ff80d7ac
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| container_format | bare                                 |
| created_at       | 2015-01-02T15:28:04                  |
| deleted          | False                                |
| disk_format      | raw                                  |
| id               | e7ec2db5-a9c8-4ee7-8d73-c804ff80d7ac |
| is_public        | False                                |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | ubuntu-test                          |
| owner            | e9ce570f6b6345ccb785f528e57ba4b9     |
| protected        | False                                |
| status           | saving                               |
| updated_at       | 2015-01-02T15:28:33                  |
+------------------+--------------------------------------+
# waiting for upload to complete...
root@cc1:~# glance image-show e7ec2db5-a9c8-4ee7-8d73-c804ff80d7ac
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 24d7cb88cc5cbff14a09de523a8bc66f     |
| container_format | bare                                 |
| created_at       | 2015-01-02T15:28:04                  |
| deleted          | False                                |
| disk_format      | raw                                  |
| id               | e7ec2db5-a9c8-4ee7-8d73-c804ff80d7ac |
| is_public        | False                                |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | ubuntu-test                          |
| owner            | e9ce570f6b6345ccb785f528e57ba4b9     |
| protected        | False                                |
| size             | 0                                    |
| status           | active                               |
| updated_at       | 2015-01-02T15:29:31                  |
+------------------+--------------------------------------+

Config files:

root@cc1:~# cat /etc/cinder/cinder.conf | grep -v '^#' | grep -v '^$'
[DEFAULT]
debug=False
verbose=False
lock_path=/var/lock/cinder
notification_driver=cinder.openstack.common.notifier.rpc_notifier
log_file = /var/log/cinder/cinder.log
sql_connection=mysql://cinder:PASSWORD@10.0.9.8:3306/cinder
state_path=/var/lib/cinder
my_ip=10.0.9.143
glance_host=10.0.9.8
glance_port=9292
api_rate_limit=True
storage_availability_zone=nova
rootwrap_config=/etc/cinder/rootwrap.conf
auth_strategy=keystone
quota_volumes=10
quota_gigabytes=1000
quota_driver=cinder.quota.DbQuotaDriver
backup_ceph_conf=/etc/ceph/ceph.conf
backup_ceph_user=volumes-backup
backup_ceph_chunk_size=134217728
backup_ceph_pool ...
(more)
edit retag flag offensive close merge delete

Comments

The image size would actually be zero because it's not a full blown copy, it's still a write on copy, it's just differences between it and the original copy. I'm not 100% sure though, I'm not an expert on Ceph.

mpetason gravatar imagempetason ( 2015-01-05 14:54:04 -0500 )edit

Good point. I've tested if this also occurs on boot-from-volume cases, where the instance (Windows in this case) has been booted, a folder created and shut down. Windows should write at least some data. Result: The uploaded image has a different checksum than the initial image, but its size is 0.

Michiel K gravatar imageMichiel K ( 2015-01-06 05:46:46 -0500 )edit