Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1043664

Summary: booting an instance with swap or ephemeral secondary disks doesn't work
Product: Red Hat OpenStack Reporter: Xavier Queralt <xqueralt>
Component: openstack-novaAssignee: Xavier Queralt <xqueralt>
Status: CLOSED ERRATA QA Contact: Ami Jeain <ajeain>
Severity: high Docs Contact:
Priority: high    
Version: 4.0CC: dallan, hateya, jagee, mlopes, ndipanov, pbrady, sclewis, ukalifon, xqueralt, yeylon
Target Milestone: rc   
Target Release: 4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-nova-2013.2-10.el6ost Doc Type: Bug Fix
Doc Text:
Cause: The fix for CVE-2013-4463 introduced a regression which prevented users from booting instances using flavors that specify a swap and/or secondary ephemeral disks. Consequence: The fix mentioned above added a new argument to the method that creates an ephemeral disk from a glance image. This argument was also passed to the methods that create the swap and secondary ephemeral disks which didn't expect it and crashed, causing the whole boot process to fail. Fix: The new argument has been added to the swap and secondary ephemeral disk creation methods. Result:
Story Points: ---
Clone Of:
: 1044016 1044562 (view as bug list) Environment:
Last Closed: 2013-12-20 00:44:53 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:
Bug Depends On:    
Bug Blocks: 1044562    

Description Xavier Queralt 2013-12-16 20:53:18 UTC
Description of problem:
While verifying bug 893374 I've noticed that none of the ephemeral and swap disks work any more.
 
Booting an instance with an swap and/or ephemeral disk(s) will fail moving the instance to ERROR. This is the default if the flavor specifies an swap or ephemeral disk.

This bug was introduced in https://review.openstack.org/54767 which introduces a new argument in the fetch_image/fetch_to_raw methods to enforce the maximum size an image can have. Erroneously, this argument is also passed to the _create_ephemeral and _create_swap methods which don't recognize it and crash dramatically while trying to create the images.

Version-Release number of selected component (if applicable):
openstack-nova-2013.2-9.el6ost.noarch

How reproducible:
Always.

Steps to Reproduce:
1. nova flavor-create m1.custom auto 64 0 1 --ephemeral 1 --swap 1024
2. nova boot --image cirros --flavor m1.custom nuvol
3. instance goes to ERROR state when spawning
4. In compute.log we can encounter the tracebacks specified below. 

Actual results:
Instances don't boot and are moved to the ERROR state.

Expected results:
Instance boots with the swap and/or ephemeral disks.

Additional info:

 Traceback (most recent call last):
   File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 1037, in _build_instance
     set_access_ip=set_access_ip)
   File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 1420, in _spawn
     LOG.exception(_('Instance failed to spawn'), instance=instance)
   File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 1417, in _spawn
     block_device_info)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py", line 2063, in spawn
     admin_pass=admin_password)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py", line 2370, in _create_image
     ephemeral_size=ephemeral_gb)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/imagebackend.py", line 174, in cache
     *args, **kwargs)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/imagebackend.py", line 307, in
     prepare_template(target=base, max_size=size, *args, **kwargs)
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/lockutils.py", line 246, in inner
     return f(*args, **kwargs)
   File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__                                                                                                                                
     self.gen.throw(type, value, traceback)
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/lockutils.py", line 205, in lock
     yield lock
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/lockutils.py", line 246, 
     return f(*args, **kwargs)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/imagebackend.py", line 162, in call_if_not_exists
     fetch_func(target=target, *args, **kwargs)
 TypeError: _create_ephemeral() got an unexpected keyword argument 'max_size'

 Traceback (most recent call last):                                                                                                                                                               
   File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 1417, in _spawn
     block_device_info)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py", line 2063, in spawn
     admin_pass=admin_password)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py", line 2402, in _create_image
     swap_mb=swap_mb)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/imagebackend.py", line 174, in cache
     *args, **kwargs)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/imagebackend.py", line 307, in create_image
     prepare_template(target=base, max_size=size, *args, **kwargs)
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/lockutils.py", line 246, in inner
     return f(*args, **kwargs)
   File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
     self.gen.throw(type, value, traceback)
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/lockutils.py", line 205, in lock 
     yield lock
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/lockutils.py", line 246, in inner
     return f(*args, **kwargs)
   File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/imagebackend.py", line 162, in call_if_not_exists
     fetch_func(target=target, *args, **kwargs)
 TypeError: _create_swap() got an unexpected keyword argument 'max_size'

Comment 4 Udi Kalifon 2013-12-17 16:14:24 UTC
Tested in: openstack-nova-2013.2-10.el6ost.noarch
Successfully created and ran a RHEL instance with ephrmal disk and swap.

Comment 5 Xavier Queralt 2013-12-17 19:57:50 UTC
No doc text required because the bug was never in a released component.

Comment 7 errata-xmlrpc 2013-12-20 00:44:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1859.html