@yjx (yjx1991):

The version "2013.2.b1" you've referenced to has reached 
"End-Of-Life" [1]. I tried to reproduce the issue as you described with
the current master branch [2]:
* launch an instance (in Horizon)
* log in to mysql database
* in the table "instances" set the field "host" to NULL
* delete instance (in Horizon)

The instance was successfully deleted. The db entry of the instance has
the "deleted" flag:

    mysql> select display_name, hostname, host, deleted from instances;
    +--------------+----------+------+---------+
    | display_name | hostname | host | deleted |
    +--------------+----------+------+---------+
    | test         | test     | NULL |       1 |
    +--------------+----------+------+---------+

The code you referenced to was replaced since stable/icehouse [3].

I set the bug to "invalid". If I understood in a wrong way and you 
could provide more information, please feel free to set the bug to "new"
again.

References:
[1] https://wiki.openstack.org/wiki/Releases
[2] nova: c9ad9549 2015-06-12 libvirt: convert imagebackend to suppo...
[3] 
https://github.com/openstack/nova/blob/stable/icehouse/nova/compute/api.py#L1484
    
https://github.com/openstack/nova/blob/stable/icehouse/nova/objects/instance.py#L354

** Changed in: nova
       Status: Incomplete => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1452697

Title:
  Error Instance can't be deleted when its host is NULL

Status in OpenStack Compute (Nova):
  Invalid

Bug description:
       When I created an instance,it failed and VM-state is ERROR.I query the 
table which named nova.instances ,host is NULL,it results to that I can't be 
able to delete this instance .
  the log is :
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack Traceback (most recent 
call last):
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/api/openstack/__init__.py", line 119, in 
__call__
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return 
req.get_response(self.application)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     application, 
catch_exc_info=False)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in 
call_application
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     app_iter = 
application(self.environ, start_response)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return 
resp(environ, start_response)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/local/lib/python2.7/dist-packages/keystoneclient/middleware/auth_token.py",
 line 690, in __call__
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return 
self.app(env, start_response)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return 
resp(environ, start_response)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return 
resp(environ, start_response)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     response = 
self.app(environ, start_response)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return 
resp(environ, start_response)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     content_type, 
body, accept)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 997, in 
_process_stack
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     action_result = 
self.dispatch(meth, request, action_args)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 1078, in 
dispatch
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return 
method(req=request, **action_args)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/servers.py", line 
989, in _delete
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     
self.compute_api.delete(context, instance)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 202, in wrapped
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return func(self, 
context, target, *args, **kwargs)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 192, in inner
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return 
function(self, context, instance, *args, **kwargs)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 219, in _wrapped
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return fn(self, 
context, instance, *args, **kwargs)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 173, in inner
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return f(self, 
context, instance, *args, **kw)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 1586, in delete
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     
self._delete_instance(context, instance)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 1576, in 
_delete_instance
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     
task_state=task_states.DELETING)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 1410, in _delete
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     user_id=user_id)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 1357, in _delete
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     instance.destroy()
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/objects/base.py", line 147, in wrapper
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return fn(self, 
ctxt, *args, **kwargs)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/objects/instance.py", line 351, in 
destroy
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     
db.instance_destroy(context, self.uuid, constraint=constraint)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/db/api.py", line 593, in instance_destroy
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     rv = 
IMPL.instance_destroy(context, instance_uuid, constraint)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/api.py", line 126, in 
wrapper
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return f(*args, 
**kwargs)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/api.py", line 1661, in 
instance_destroy
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     query = 
constraint.apply(models.Instance, query)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/api.py", line 338, in apply
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     for clause in 
condition.clauses(getattr(model, key)):
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/api.py", line 349, in 
clauses
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return or_([field 
== value for value in self.values])
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File "<string>", 
line 2, in or_
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 1870, 
in or_
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     return 
cls._construct(operators.or_, False_, True_, *clauses)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 1774, 
in _construct
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     clause = 
_literal_as_text(clause)
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack   File 
"/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 3462, 
in _literal_as_text
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack     "SQL expression 
object or string expected."
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack ArgumentError: SQL 
expression object or string expected.
  2015-05-07 16:55:38.240 23178 TRACE nova.api.openstack

  my version is havana and icehouse,I test both,all ERROR.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1452697/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to