xenapi: ImageTooLarge for instances with 0 disk size

Bug #1155113 reported by Mate Lakat
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Rick Harris

Bug Description

Create two flavors:

nova-manage flavor create --name=m1.nodisk --memory=512 --cpu=1 --root_gb=0 \
--flavor=7 --swap=0 --rxtx_factor=1.0 --is_public=true
nova-manage flavor create --name=m1.onegig --memory=512 --cpu=1 --root_gb=1 \
--flavor=8 --swap=0 --rxtx_factor=1.0 --is_public=true

Upload an image:

glance image-create --name growbug \
--copy-from=https://github.com/downloads/citrix-openstack/warehouse/cirros-0.3.0-x86_64-disk.vhd.tgz \
--container-format=ovf --disk-format=vhd --is-public=True

Wait until it is active, get its id:

IMAGEID=$(glance image-list | grep bugimage | sed -e 's/^| //g' -e 's/ |.*$//g')

Boot it up:

nova boot --image $IMAGEID --flavor 7 growinstance

The instance state will be error:

stack@DevStackOSDomU:~/devstack$ nova list | grep growinstance
| 200fd365-6d7d-45b0-9c35-89ef11d43662 | growinstance | ERROR | |

And you see the following in the n-cpu log:

Failed to spawn, rolling back
Traceback (most recent call last):
  File "/opt/stack/nova/nova/virt/xenapi/vmops.py", line 452, in spawn
    vdis = create_disks_step(undo_mgr, disk_image_type, image_meta)
  File "/opt/stack/nova/nova/virt/xenapi/vmops.py", line 143, in inner
    rv = f(*args, **kwargs)
  File "/opt/stack/nova/nova/virt/xenapi/vmops.py", line 335, in create_disks_step
    block_device_info=block_device_info)
  File "/opt/stack/nova/nova/virt/xenapi/vmops.py", line 306, in _create_disks
    block_device_info=block_device_info)
  File "/opt/stack/nova/nova/virt/xenapi/vm_utils.py", line 518, in get_vdis_for_instance
    context, session, instance, name_label, image, image_type)
  File "/opt/stack/nova/nova/virt/xenapi/vm_utils.py", line 974, in _create_image
    image_id, image_type)
  File "/opt/stack/nova/nova/virt/xenapi/vm_utils.py", line 919, in _create_cached_image
    image_id, image_type)
  File "/opt/stack/nova/nova/virt/xenapi/vm_utils.py", line 994, in _fetch_image
    vdis = _fetch_vhd_image(context, session, instance, image_id)
  File "/opt/stack/nova/nova/virt/xenapi/vm_utils.py", line 1120, in _fetch_vhd_image
    _check_vdi_size(context, session, instance, root_vdi_uuid)
  File "/opt/stack/nova/nova/virt/xenapi/vm_utils.py", line 1157, in _check_vdi_size
    raise exception.ImageTooLarge()
ImageTooLarge: Image is larger than instance type allows

Tags: xenserver
Revision history for this message
Mate Lakat (mate-lakat) wrote :

...

Now, start an instance with a non-zero flavor:
stack@DevStackOSDomU:~/devstack$ nova flavor-list | grep m1.onegig
| 8 | m1.onegig | 512 | 1 | 0 | | 1 | 1.0 | True | {} |

Start it:

nova boot --image $IMAGEID --flavor 8 nonzeroinstance

The instance will be booted:

stack@DevStackOSDomU:~/devstack$ nova list | grep nonzeroinstance
| afda8249-8026-4c6f-a577-3866206606c1 | nonzeroinstance | ACTIVE | private=10.0.0.5 |

Now destroy the non-zero:

nova delete afda8249-8026-4c6f-a577-3866206606c1

And try to launch an instance with auto-disk size:

stack@DevStackOSDomU:~/devstack$ nova flavor-list | grep m1.nodisk
| 7 | m1.nodisk | 512 | 0 | 0 | | 1 | 1.0 | True | {} |

nova boot --image $IMAGEID --flavor 7 growinstance

That will fail in a different way:

Failed to spawn, rolling back
Traceback (most recent call last):
  File "/opt/stack/nova/nova/virt/xenapi/vmops.py", line 456, in spawn
    attach_disks_step(undo_mgr, vm_ref, vdis, disk_image_type)
  File "/opt/stack/nova/nova/virt/xenapi/vmops.py", line 143, in inner
    rv = f(*args, **kwargs)
  File "/opt/stack/nova/nova/virt/xenapi/vmops.py", line 388, in attach_disks_step
    injected_files)
  File "/opt/stack/nova/nova/virt/xenapi/vmops.py", line 568, in _attach_disks
    instance_type['root_gb'])
  File "/opt/stack/nova/nova/virt/xenapi/vm_utils.py", line 769, in auto_configure_disk
    _resize_part_and_fs(dev, start, old_sectors, new_sectors)
  File "/opt/stack/nova/nova/virt/xenapi/vm_utils.py", line 2032, in _resize_part_and_fs
    run_as_root=True)
  File "/opt/stack/nova/nova/utils.py", line 243, in execute
    cmd=' '.join(cmd))
ProcessExecutionError: Unexpected error while running command.
Command: sudo nova-rootwrap /etc/nova/rootwrap.conf resize2fs /dev/xvdb1 -16065s
Exit code: 1
Stdout: ''
Stderr: "resize2fs 1.42 (29-Nov-2011)\n/sbin/resize2fs: invalid option -- '1'\nUsage: /sbin/resize2fs [-d debug_flags] [-f] [-F] [-M] [-P] [-p] device [new_size]\n\n"

tags: added: xenserver
Revision history for this message
Chuck Short (zulcss) wrote :

Which version is this with?

Changed in nova:
status: New → Incomplete
Revision history for this message
Mate Lakat (mate-lakat) wrote :

It was on OS - trunk, XenServer 6.1

Changed in nova:
status: Incomplete → New
Chuck Short (zulcss)
Changed in nova:
status: New → Triaged
Revision history for this message
John Garbutt (johngarbutt) wrote :

There are many issues with disksize 0 flavour.

Changed in nova:
importance: Undecided → Low
Changed in nova:
assignee: nobody → Rick Harris (rconradharris)
status: Triaged → In Progress
Revision history for this message
John Garbutt (johngarbutt) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/29848
Committed: http://github.com/openstack/nova/commit/f692f727236b7e3e97b657c048194870ddf88a47
Submitter: Jenkins
Branch: master

commit f692f727236b7e3e97b657c048194870ddf88a47
Author: Rick Harris <email address hidden>
Date: Mon May 20 23:51:09 2013 +0000

    xenapi: Disable VDI size check when root_gb=0

    Nova uses root_gb=0 to indicate that we should use the image as-is without
    trying to resize the root disk. Currently the xenapi virt-driver doesn't
    properly implement this behavior.

    This patch gets us a step closer by disabling the VDI size check when
    root_gb=0. We still need to ensure that the disk-resize code handle root_gb=0
    as well.

    References bug 1155113

    Change-Id: If91963e079e197a1315c48b8643f3419b42b0b2c

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → 2013.2
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.