[Openstack] Shrink Image's Flavor Requirements

Chris Suttles suttles at gmail.com
Sun Mar 26 03:09:22 UTC 2017


Hello again to you too! :)

Thanks for the update and details.

You might try using qemu-img to modify the file before uploading as a new
image:

https://fatmin.com/2016/12/20/how-to-resize-a-qcow2-image-and-filesystem-with-virt-resize/


http://www.tuxfixer.com/how-to-shrink-openstack-qcow2-image-with-qemu-img/

I think qcow2 image file you copied has embedded metadata that needs to be
modified before you can create the image with a smaller --min-disk. I
haven't done this myself though, and I am away from a OpenStack console at
the moment so I can't verify, but hopefully that gets us one step closer.

Cheers,

-Chris


On Sat, Mar 25, 2017 at 7:52 PM, Georgios Dimitrakakis <giorgis at acmac.uoc.gr
> wrote:

> Hello again!
>
> Unfortunately it doesn't work...
>
> Here is the error: "Flavor's disk is too small for requested image. Flavor
> disk is 21474836480 bytes, image is 53687091200 bytes.]."
>
> This is on an image that was taken when the flavor had root with 50GB and
> tried to upload it using a flavor of 20GB.
>
> The filesystem uses around 2-3GB and I had specified with the "--min-disk
> 5" parameter to be able to spawn on 5GB or more flavors.
>
> Here is the output from "image show" command
>
> +------------------+----------------------------------------
> --------------+
> | Field            | Value                                               |
> +------------------+----------------------------------------
> --------------+
> | checksum         | 66ca6e4b52dc42f563fa5c321b5c3da9                    |
> | container_format | bare                                                |
> | created_at       | 2017-03-26T02:44:54Z                                |
> | disk_format      | qcow2                                               |
> | file             | /v2/images/4ce95fa2-5983-4999-a9ef-c5702b5fae6d/file
> |
> | id               | 4ce95fa2-5983-4999-a9ef-c5702b5fae6d                |
> | min_disk         | 5                                                   |
> | min_ram          | 0                                                   |
> | name             | new                                                 |
> | owner            | 0518e08cac524dacb457c631a9efa7b3                    |
> | protected        | False                                               |
> | schema           | /v2/schemas/image                                   |
> | size             | 3065315328                                          |
> | status           | active                                              |
> | tags             |                                                     |
> | updated_at       | 2017-03-26T02:45:06Z                                |
> | virtual_size     | None                                                |
> | visibility       | public                                              |
> +------------------+----------------------------------------
> --------------+
>
>
> The only thing that I didn't do was to use the "save" command although I
> don't know if that could make a difference!
>
> I 've just went to "/var/lib/glance/images" and taken directly from there
> the file that was corresponding to the image I wanted.
> Do you believe that by "saving" it would make any difference??
>
> Any other ideas that I can try???
>
>
> All the best,
>
> G.
>
>
>
> On Sun, 26 Mar 2017 05:37:47 +0300, Georgios Dimitrakakis wrote:
>
>> Hi Chris!
>>
>> Thanks for pointing out the "--min-disk" parameter. I haven't used
>> that one before.
>>
>> I 'll try it out and post back.
>>
>> Regards,
>>
>> G.
>>
>> On Sat, 25 Mar 2017 18:39:09 -0700, Chris Suttles wrote:
>>
>>> You might be able to change it via openstack command, probably
>>> something like 'openstack show image <Id>'  / 'openstack image set ??
>>> <id>'
>>>
>>> You can definitely download the image to a file and then upload a new
>>> image, specifying --min-disk. Something like 'openstack image save
>>> --file <file> <id>' and then just 'openstack image create --file
>>> <file> --min-disk <disk size in gb> <image name>'
>>>
>>> HTH,
>>>
>>> -Chris
>>>
>>> On Mar 25, 2017, at 5:31 PM, Georgios Dimitrakakis <giorgis at acmac.uoc.gr>
>>>> wrote:
>>>>
>>>>
>>>> Hello!
>>>>
>>>> Let's assume that I have a VM's image that has been taken when the VM
>>>> was launched with a flavor of 50GB for the root disk.
>>>> Now when I try to spawn a new VM out of that image I cannot do it with
>>>> a flavor that has disk less than 50GB even if the VM itself inside uses
>>>> only 5GB.
>>>>
>>>> Is there a way to shrink the image's flavor requirements?
>>>>
>>>> Best,
>>>>
>>>> G.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: http://lists.openstack.org/cgi
>>>> -bin/mailman/listinfo/openstack
>>>> Post to     : openstack at lists.openstack.org
>>>> Unsubscribe : http://lists.openstack.org/cgi
>>>> -bin/mailman/listinfo/openstack
>>>>
>>>
>>
>> _______________________________________________
>> Mailing list: http://lists.openstack.org/cgi
>> -bin/mailman/listinfo/openstack
>> Post to     : openstack at lists.openstack.org
>> Unsubscribe : http://lists.openstack.org/cgi
>> -bin/mailman/listinfo/openstack
>>
>
> --
> Dr. Dimitrakakis Georgios
>
> Networks and Systems Administrator
>
> Archimedes Center for Modeling, Analysis & Computation (ACMAC)
> School of Sciences and Engineering
> University of Crete
> P.O. Box 2208
> 710 - 03 Heraklion
> Crete, Greece
>
> Tel: +30 2810 393717
> Fax: +30 2810 393660
>
> E-mail: giorgis at acmac.uoc.gr
>
>
> _______________________________________________
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstac
> k
> Post to     : openstack at lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstac
> k
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20170325/bde7d394/attachment.html>


More information about the Openstack mailing list