I can't delete an instance when using postgresql, because the code is passing an integer instance id where a UUID is expected to instance_info_cache_delete_by_instance_id. I expect the bug also exists on MySQL, but MySQL is much more liberal with parameter conversion, though the data won't be deleted.
2011-12-12 01:56:01,892 DEBUG nova.api [092ca398-491c-c49c-e6b0-d9de0123a2c3 e51d453d-e88d-ed8d-886f-f7f91f111a2d e51d453d-e88d-ed8d-886f-f7f91f111a2d] arg: InstanceId.1 val: i-00000001 from (pid=7157) __call__ /usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/api/ec2/__init__.py:253
2011-12-12 01:56:01,892 DEBUG nova.api.ec2.cloud [092ca398-491c-c49c-e6b0-d9de0123a2c3 e51d453d-e88d-ed8d-886f-f7f91f111a2d e51d453d-e88d-ed8d-886f-f7f91f111a2d] Going to start terminating instances from (pid=7157) terminate_instances /usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/api/ec2/cloud.py:1296
2011-12-12 01:56:01,957 DEBUG nova.compute.api [092ca398-491c-c49c-e6b0-d9de0123a2c3 e51d453d-e88d-ed8d-886f-f7f91f111a2d e51d453d-e88d-ed8d-886f-f7f91f111a2d] Going to try to terminate a7da7be8-0369-cf4a-bfee-f7a74a2b029d from (pid=7157) delete /usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/compute/api.py:812
2011-12-12 01:56:01,964 ERROR nova.api [092ca398-491c-c49c-e6b0-d9de0123a2c3 e51d453d-e88d-ed8d-886f-f7f91f111a2d e51d453d-e88d-ed8d-886f-f7f91f111a2d] Unexpected error raised: (ProgrammingError) operator does not exist: character varying = integer
LINE 3: WHERE instance_info_caches.instance_id = 1
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
(nova.api): TRACE: Traceback (most recent call last):
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/api/ec2/__init__.py", line 357, in __call__
(nova.api): TRACE: result = api_request.invoke(context)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/api/ec2/apirequest.py", line 90, in invoke
(nova.api): TRACE: result = method(context, **args)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/api/ec2/cloud.py", line 1300, in terminate_instances
(nova.api): TRACE: self.compute_api.delete(context, instance)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/scheduler/api.py", line 321, in wrapped_f
(nova.api): TRACE: return f(*args, **kwargs)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/compute/api.py", line 817, in delete
(nova.api): TRACE: self._delete(context, instance)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/compute/api.py", line 807, in _delete
(nova.api): TRACE: self.db.instance_destroy(context, instance['id'])
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/api.py", line 514, in instance_destroy
(nova.api): TRACE: return IMPL.instance_destroy(context, instance_id)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 113, in wrapper
(nova.api): TRACE: return f(*args, **kwargs)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 1136, in instance_destroy
(nova.api): TRACE: session=session)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 113, in wrapper
(nova.api): TRACE: return f(*args, **kwargs)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 1625, in instance_info_cache_delete_by_instance_id
(nova.api): TRACE: instance_info_cache_update(context, instance_id, values, session)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 113, in wrapper
(nova.api): TRACE: return f(*args, **kwargs)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 1605, in instance_info_cache_update
(nova.api): TRACE: session=session)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 1625, in instance_info_cache_delete_by_instance_id
(nova.api): TRACE: instance_info_cache_update(context, instance_id, values, session)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 113, in wrapper
(nova.api): TRACE: return f(*args, **kwargs)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 1605, in instance_info_cache_update
(nova.api): TRACE: session=session)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 113, in wrapper
(nova.api): TRACE: return f(*args, **kwargs)
(nova.api): TRACE: File "/usr/lib/python2.6/site-packages/nova-2012.1-py2.6.egg/nova/db/sqlalchemy/api.py", line 1589, in instance_info_cache_get
(nova.api): TRACE: filter_by(instance_id=instance_id).\
(nova.api): TRACE: File "build/bdist.solaris-2.11-i86pc/egg/sqlalchemy/orm/query.py", line 1988, in first
(nova.api): TRACE: ret = list(self[0:1])
(nova.api): TRACE: File "build/bdist.solaris-2.11-i86pc/egg/sqlalchemy/orm/query.py", line 1882, in __getitem__
(nova.api): TRACE: return list(res)
(nova.api): TRACE: File "build/bdist.solaris-2.11-i86pc/egg/sqlalchemy/orm/query.py", line 2057, in __iter__
(nova.api): TRACE: return self._execute_and_instances(context)
(nova.api): TRACE: File "build/bdist.solaris-2.11-i86pc/egg/sqlalchemy/orm/query.py", line 2072, in _execute_and_instances
(nova.api): TRACE: result = conn.execute(querycontext.statement, self._params)
(nova.api): TRACE: File "build/bdist.solaris-2.11-i86pc/egg/sqlalchemy/engine/base.py", line 1405, in execute
(nova.api): TRACE: params)
(nova.api): TRACE: File "build/bdist.solaris-2.11-i86pc/egg/sqlalchemy/engine/base.py", line 1538, in _execute_clauseelement
(nova.api): TRACE: compiled_sql, distilled_params
(nova.api): TRACE: File "build/bdist.solaris-2.11-i86pc/egg/sqlalchemy/engine/base.py", line 1646, in _execute_context
(nova.api): TRACE: context)
(nova.api): TRACE: File "build/bdist.solaris-2.11-i86pc/egg/sqlalchemy/engine/base.py", line 1639, in _execute_context
(nova.api): TRACE: context)
(nova.api): TRACE: File "build/bdist.solaris-2.11-i86pc/egg/sqlalchemy/engine/default.py", line 330, in do_execute
(nova.api): TRACE: cursor.execute(statement, parameters)
(nova.api): TRACE: ProgrammingError: (ProgrammingError) operator does not exist: character varying = integer
(nova.api): TRACE: LINE 3: WHERE instance_info_caches.instance_id = 1
(nova.api): TRACE: ^
(nova.api): TRACE: HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
(nova.api): TRACE: 'SELECT instance_info_caches.created_at AS instance_info_caches_created_at, instance_info_caches.updated_at AS instance_info_caches_updated_at, instance_info_caches.deleted_at AS instance_info_caches_deleted_at, instance_info_caches.deleted AS instance_info_caches_deleted, instance_info_caches.id AS instance_info_caches_id, instance_info_caches.network_info AS instance_info_caches_network_info, instance_info_caches.instance_id AS instance_info_caches_instance_id \nFROM instance_info_caches \nWHERE instance_info_caches.instance_id = %(instance_id_1)s \n LIMIT %(param_1)s' {'param_1': 1, 'instance_id_1': 1}
This is true! It's as simple as instance_destroy passes instance id instead of instance uuid into instance_ info_cache_ delete in nova/db/ sqlalchemy/ api.py.