Regression prevents to start any instance through libvirt

Bug #728342 reported by Kevin Jackson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Critical
Thierry Carrez

Bug Description

When launching an instance using 2011.2~bzr757 I get the instances failing to spawn due to SQL syntax error:

2011-03-03 10:19:08,357 DEBUG nova.utils [-] Running cmd (subprocess): qemu-img create -f qcow2 -o cluster_size=2M,backing_file=/var/lib/nova/instances/_base/ami-reey5wk5_sm /var/lib/nova/instances/instance-0000002a/disk from (pid=1327) execute /usr/lib/pymodules/python2.6/nova/utils.py:132
2011-03-03 10:19:08,441 ERROR nova.exception [-] Uncaught exception
(nova.exception): TRACE: Traceback (most recent call last):
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/exception.py", line 116, in _wrap
(nova.exception): TRACE: return f(*args, **kw)
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/libvirt_conn.py", line 410, in spawn
(nova.exception): TRACE: self._create_image(instance, xml)
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/libvirt_conn.py", line 610, in _create_image
(nova.exception): TRACE: type_data = instance_types.get_instance_type([inst['instance_type']])
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/compute/instance_types.py", line 110, in get_instance_type
(nova.exception): TRACE: inst_type = db.instance_type_get_by_name(ctxt, name)
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/db/api.py", line 1025, in instance_type_get_by_name
(nova.exception): TRACE: return IMPL.instance_type_get_by_name(context, name)
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/db/sqlalchemy/api.py", line 108, in wrapper
(nova.exception): TRACE: return f(*args, **kwargs)
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/db/sqlalchemy/api.py", line 2119, in instance_type_get_by_name
(nova.exception): TRACE: filter_by(name=name).\
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/query.py", line 1496, in first
(nova.exception): TRACE: ret = list(self[0:1])
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/query.py", line 1405, in __getitem__
(nova.exception): TRACE: return list(res)
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/query.py", line 1565, in __iter__
(nova.exception): TRACE: return self._execute_and_instances(context)
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/query.py", line 1570, in _execute_and_instances
(nova.exception): TRACE: mapper=self._mapper_zero_or_none())
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/session.py", line 735, in execute
(nova.exception): TRACE: clause, params or {})
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1157, in execute
(nova.exception): TRACE: params)
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1237, in _execute_clauseelement
(nova.exception): TRACE: return self.__execute_context(context)
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1268, in __execute_context
(nova.exception): TRACE: context.parameters[0], context=context)
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1367, in _cursor_execute
(nova.exception): TRACE: context)
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1360, in _cursor_execute
(nova.exception): TRACE: context)
(nova.exception): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/default.py", line 288, in do_execute
(nova.exception): TRACE: cursor.execute(statement, parameters)
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in execute
(nova.exception): TRACE: self.errorhandler(self, exc, value)
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 35, in defaulterrorhandler
(nova.exception): TRACE: raise errorclass, errorvalue
(nova.exception): TRACE: ProgrammingError: (ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') \n LIMIT 0, 1' at line 3") 'SELECT instance_types.created_at AS instance_types_created_at, instance_types.updated_at AS instance_types_updated_at, instance_types.deleted_at AS instance_types_deleted_at, instance_types.deleted AS instance_types_deleted, instance_types.id AS instance_types_id, instance_types.name AS instance_types_name, instance_types.memory_mb AS instance_types_memory_mb, instance_types.vcpus AS instance_types_vcpus, instance_types.local_gb AS instance_types_local_gb, instance_types.flavorid AS instance_types_flavorid, instance_types.swap AS instance_types_swap, instance_types.rxtx_quota AS instance_types_rxtx_quota, instance_types.rxtx_cap AS instance_types_rxtx_cap \nFROM instance_types \nWHERE instance_types.name = %s \n LIMIT 0, 1' (['m1.tiny'],)
(nova.exception): TRACE:
2011-03-03 10:19:08,481 ERROR nova.compute.manager [X56G6NWZ7B0FTO62PJE4 kevinj myproject] instance 42: Failed to spawn
(nova.compute.manager): TRACE: Traceback (most recent call last):
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/compute/manager.py", line 213, in run_instance
(nova.compute.manager): TRACE: self.driver.spawn(instance_ref)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/exception.py", line 122, in _wrap
(nova.compute.manager): TRACE: raise Error(str(e))
(nova.compute.manager): TRACE: Error: (ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') \n LIMIT 0, 1' at line 3") 'SELECT instance_types.created_at AS instance_types_created_at, instance_types.updated_at AS instance_types_updated_at, instance_types.deleted_at AS instance_types_deleted_at, instance_types.deleted AS instance_types_deleted, instance_types.id AS instance_types_id, instance_types.name AS instance_types_name, instance_types.memory_mb AS instance_types_memory_mb, instance_types.vcpus AS instance_types_vcpus, instance_types.local_gb AS instance_types_local_gb, instance_types.flavorid AS instance_types_flavorid, instance_types.swap AS instance_types_swap, instance_types.rxtx_quota AS instance_types_rxtx_quota, instance_types.rxtx_cap AS instance_types_rxtx_cap \nFROM instance_types \nWHERE instance_types.name = %s \n LIMIT 0, 1' (['m1.tiny'],)

Related branches

Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Critical
status: New → Confirmed
Revision history for this message
Thierry Carrez (ttx) wrote :

This would be wrong:

=== modified file 'nova/virt/libvirt_conn.py'
@@ -606,7 +607,7 @@
                           user=user,
                           project=project,
                           size=size)
- type_data = instance_types.INSTANCE_TYPES[inst['instance_type']]
+ type_data = instance_types.get_instance_type([inst['instance_type']])

Should be:
type_data = instance_types.get_instance_type(inst['instance_type']) ??

Revision history for this message
Kevin Jackson (kevin-linuxservices) wrote :

nova/virt/libvirt_conn.py already has that in line 610

        self._cache_image(fn=self._fetch_image,
    603 target=basepath('disk'),
    604 fname=root_fname,
    605 cow=FLAGS.use_cow_images,
    606 image_id=disk_images['image_id'],
    607 user=user,
    608 project=project,
    609 size=size)
    610 type_data = instance_types.get_instance_type([inst['instance_type']])

-rw-r--r-- 1 root root 57239 2011-03-03 02:09 /usr/share/pyshared/nova/virt/libvirt_conn.py

(Packages from PPA installed:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============================-==============================-============================================================================
ii nova-api 2011.2~bzr757-0ubuntu0ppa1~mav OpenStack Compute - Nova - API frontend
ii nova-common 2011.2~bzr757-0ubuntu0ppa1~mav OpenStack Compute - Nova - common files
ii nova-compute 2011.2~bzr757-0ubuntu0ppa1~mav OpenStack Compute - Nova - compute node
ii nova-network 2011.2~bzr757-0ubuntu0ppa1~mav OpenStack Compute - Nova - Network thingamajig
ii nova-objectstore 2011.2~bzr757-0ubuntu0ppa1~mav OpenStack Compute - Nova - object store
ii nova-scheduler 2011.2~bzr757-0ubuntu0ppa1~mav OpenStack Compute - Nova - Scheduler

)

Revision history for this message
Thierry Carrez (ttx) wrote :

nova/virt/libvirt_conn.py has the *erroneous* line at line 610 (the one with the extra pair of braces)

Thierry Carrez (ttx)
Changed in nova:
assignee: nobody → Thierry Carrez (ttx)
status: Confirmed → In Progress
Thierry Carrez (ttx)
summary: - ProgrammingError "You have an error in your SQL syntax ... (near ) \n
- LIMIT 0, 1' at line 3)
+ Regression prevents to start any instance through libvirt
Thierry Carrez (ttx)
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → 2011.2
status: Fix Committed → Fix Released
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.