Bug 1012467

Summary: Booting a <200MB image with a 1GB root disk: "Instance type's disk is too small for requested image"
Product: [Community] RDO Reporter: Sandro Mathys <sandro>
Component: openstack-novaAssignee: RHOS Maint <rhos-maint>
Status: CLOSED NOTABUG QA Contact: Ami Jeain <ajeain>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ndipanov, rbryant, xqueralt, yeylon
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-18 23:03:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sandro Mathys 2013-09-26 14:02:57 UTC
Description of problem:
Importing e.g. the Fedora 20 Alpha x86_64 (<200MB) image into OpenStack and then trying to launch an instance with a 1GB root disk results in error "InstanceTypeDiskTooSmall: Instance type's disk is too small for requested image."

Version-Release number of selected component (if applicable):
openstack-nova-compute-2013.2-0.19.b3.el6.noarch

How reproducible:
Always

Steps to Reproduce:
1. Set up OpenStack (from Havana repo)
2. Import Fedora 19 or Fedora 20 (x86_64) cloud images into Glance
3. Create a flavor with a 1GB root disk (e.g. modify the m1.tiny flavor accordingly)
4. Launch the Fedora image with that flavor

Actual results:
2013-09-26 15:51:35.704 2890 ERROR nova.virt.libvirt.imagebackend [req-0b97ba16-3b57-464b-a683-1901121decf7 317f58024bf54e01a70399e976b126ae 6a63ca1f66de4a70a2add1bb2e59d67c] /var/lib/nova/instances/_base/c6f57ab653e737a149293af93d4d83da3cb9ec42 virtual size 2147483648larger than fla
vor root disk size 1073741824
2013-09-26 15:51:35.705 2890 ERROR nova.compute.manager [req-0b97ba16-3b57-464b-a683-1901121decf7 317f58024bf54e01a70399e976b126ae 6a63ca1f66de4a70a2add1bb2e59d67c] [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440] Instance failed to spawn
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440] Traceback (most recent call last):
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]   File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 1416, in _spawn
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]     block_device_info)
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py", line 2019, in spawn
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]     admin_pass=admin_password)
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py", line 2309, in _create_image
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]     project_id=instance['project_id'])
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/imagebackend.py", line 174, in cache
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]     *args, **kwargs)
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/imagebackend.py", line 311, in create_image
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440]     raise exception.InstanceTypeDiskTooSmall()
2013-09-26 15:51:35.705 2890 TRACE nova.compute.manager [instance: 8ac1fdeb-ad52-4c5b-bf68-5fb2b4bad440] InstanceTypeDiskTooSmall: Instance type's disk is too small for requested image.


Expected results:
Instance being spawned successfully

Additional info:
The error message indicated the image is 2147483648 Bytes (2GB) in size while Glance correctly reports a size of 208535552 Bytes (~199 MB). Checking the file size of the image as saved by Nova compute, it indeed is 2GB for some reason:
-rw-r--r--. 1 nova nova 2.0G Sep 26 15:51 /var/lib/nova/instances/_base/c6f57ab653e737a149293af93d4d83da3cb9ec42

Comment 1 Xavier Queralt 2013-10-23 10:01:50 UTC
Hi Sandro,

I've just checked the Fedora 19 image and verified that it indeed has a virtual size of 2GB. Even though the disk physical size is only 200MB the real size of the disk (and any derivate disk) will be of 2GB. As glance doesn't understand the format of the image, it will still report the physical size although while creating the instance nova will notice that the size exceeds the one specified in the flavor (1GB) and fail.

I suggest you to set the min_disk value to 2GB when importing that image to glance (to agree with the virtual size).

If you feel brave enough and want to use that image on an instance with 1GB disk you can try to downsize the image by first resizing the filesystem and then the qcow disk.

Comment 2 Sandro Mathys 2013-10-23 10:28:44 UTC
Xavier, thanks for investigating this. Figure you're right and while it's a discrepancy between Glance and Nova it probably can't be fixed, right?

I just had a look at the kickstart file used to create the Fedora cloud image and indeed, it creates a 2048 MB partition while 1GB would suffice (it's <600MB expanded). Raising it with the Cloud SIG instead.

Feel free to close this unless you think the discrepancy should and can be resolved.

Comment 3 Xavier Queralt 2013-11-18 23:03:22 UTC
I think we can close this because as of now glance cannot guess the size of a qcow2 image unless it is set in the min_disk when uploading it.

Comment 4 Sandro Mathys 2013-11-19 07:41:49 UTC
FWIW: F20 cloud images will come with a <=1GB partition (and auto-grow if more disk space is available). This way it will be possible to boot it with a 1GB root disk.