libvirt: resize of whole disk image fails

Bug #1094373 reported by Vish Ishaya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Michael Still

Bug Description

Attempting to resize an image that is a whole disk:

2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp temp_level, payload)2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp self.gen.next()2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/exception.py", line 87, in wrapped2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp return f(*args, **kw)2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 211, in decorated_function2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp pass2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp self.gen.next()2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 197, in decorated_function2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp return function(self, context, *args, **kwargs)2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 238, in decorated_function2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp kwargs['instance']['uuid'], e, sys.exc_info())2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp self.gen.next()2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 226, in decorated_function2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp return function(self, context, *args, **kwargs)
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 2046, in finish_resize2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp self._set_instance_error_state(context, instance['uuid'])
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp self.gen.next()
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 2034, in finish_resize
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp disk_info, image)
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 2002, in _finish_resize
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp block_device_info)
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/exception.py", line 112, in wrapped
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp temp_level, payload)
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp self.gen.next()
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/exception.py", line 87, in wrapped
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp return f(*args, **kw)
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 2946, in finish_migration
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp disk.can_resize_fs(info['path'], size, use_cow=True)):
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/disk/api.py", line 136, in can_resize_fs
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp inject_data(image, use_cow=True)
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/disk/api.py", line 274, in inject_data
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp fs.setup()
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/disk/vfs/localfs.py", line 84, in setup
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp raise e
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp Exception: Failed to mount image: Failed to mount filesystem: Unexpected error while running command.
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp Command: sudo nova-rootwrap /etc/nova/rootwrap.conf mount /dev/nbd2 /tmp/openstack-vfs-localfsvFKSfy
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp Exit code: 32
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp Stdout: ''
2012-12-28 14:43:59 TRACE nova.openstack.common.rpc.amqp Stderr: 'mount: you must specify the filesystem type\n'

the can_resize method shouldn't be failing if the mount doesn't work.

Vish

Changed in nova:
importance: Undecided → Medium
summary: - resize of whole disk image fails
+ libvirt: resize of whole disk image fails
Michael Still (mikal)
Changed in nova:
status: New → Triaged
assignee: nobody → Michael Still (mikalstill)
Changed in nova:
status: Triaged → In Progress
Revision history for this message
Michael Still (mikal) wrote :

Vish -- this system should probably have guestfs installed, which would have meant this code path wasn't followed. I believe guestfs is more secure for this stuff.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/18743

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/18743
Committed: http://github.com/openstack/nova/commit/2397c6b902174ef39bff5f9194a06f82c6746267
Submitter: Jenkins
Branch: master

commit 2397c6b902174ef39bff5f9194a06f82c6746267
Author: Michael Still <email address hidden>
Date: Sat Dec 29 19:22:54 2012 +1100

    Report failures to mount in localfs correctly.

    The wrong exception type was being thrown, which meant that the virt
    disk api though the disk could be resized when it couldn't. I've
    added two unit tests to cover regressions as well, but this code needs
    more unit testing in general. Resolves bug 1094373.

    Change-Id: I9c974e138ff90e8b7a5a40f5b31dcdb25a59622d

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/18872

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/18872
Committed: http://github.com/openstack/nova/commit/54ee787d7ae1d7635bd5dac8efd985e3a93ad1c2
Submitter: Jenkins
Branch: master

commit 54ee787d7ae1d7635bd5dac8efd985e3a93ad1c2
Author: Pádraig Brady <email address hidden>
Date: Thu Jan 3 03:09:00 2013 +0000

    fix resize of unpartitioned images with libguestfs

    Following on from I9c974e138ff90e8b7a5a40f5b31dcdb25a59622d
    Ensure that the libguestfs path also throws a NovaException,
    handled by can_resize_fs().

    * nova/virt/disk/vfs/guestfs.py (setup): Move the debug message
    and guestfs handle outside the exception handler as we
    don't want to map failure of those to a NovaException
    that indicates an issue with the image as opposed to the
    nova code or libguestfs installation. Change to a more explicit
    exception thrown by guestfs, so as to avoid masking other issues.
    (teardown): Remove redundant calls to str().
    * nova/virt/disk/api.py (can_resize_fs): Cleanup the debug messages,
    and use the newer vfs API directly, rather than the slightly
    hacky call to inject_data() with no data to inject.

    Fixes bug: 1094373
    Change-Id: I3e1305cf6bb64278a8caf37e4c5005cb9683f632

Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-2 → 2013.1
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.