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

Bug 910747

Summary: Nova: When attempting to perform 'nova host-action', not implemented exception raised.
Product: Red Hat OpenStack Reporter: Omri Hochman <ohochman>
Component: openstack-novaAssignee: Xavier Queralt <xqueralt>
Status: CLOSED CURRENTRELEASE QA Contact: Omri Hochman <ohochman>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0 (Folsom)CC: dallan, ndipanov, ohochman, sgordon
Target Milestone: ---Keywords: FutureFeature, Triaged
Target Release: 4.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-06 13:24:06 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:
Attachments:
Description Flags
api.log none

Description Omri Hochman 2013-02-13 13:22:51 UTC
Nova: When attempting to perform 'nova host-action', not implemented exception raised.   

Description:
************
When attempting to perform: 'nova host-action' <server name> --action <any action>' the following error occurs: 

ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-652ec715-5c11-4ac6-8b49-a01588e1bb9b)

looking at the api.log, it seems that the functionality is not implemented  (libvirt side?)  


Environment: 
************
openstack-nova-2012.2.2-9.el6ost.noarch
openstack-nova-compute-2012.2.2-9.el6ost.noarch
python-nova-2012.2.2-9.el6ost.noarch
libvirt-python-0.10.2-18.el6.x86_64
libvirt-0.10.2-18.el6.x86_64
libvirt-client-0.10.2-18.el6.x86_64


Note: There's nothing about it in the compute.log (only api.log).

API.log :   
**********

2013-02-13 13:17:52 ERROR nova.api.openstack [req-2e6d455a-e118-404d-88e4-88db43cbfd3f 6288e0b61d5643bb93d2288631d75940 b1de5e0cec444706bf0203cbd80e0e94] Caught error: Re
mote error: NotImplementedError 
[u'Traceback (most recent call last):\n', u'  File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 276, in _process_data\n    rval = self.proxy
.dispatch(ctxt, version, method, **args)\n', u'  File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/dispatcher.py", line 145, in dispatch\n    return getatt
r(proxyobj, method)(ctxt, **kwargs)\n', u'  File "/usr/lib/python2.6/site-packages/nova/exception.py", line 117, in wrapped\n    temp_level, payload)\n', u'  File "/usr/l
ib64/python2.6/contextlib.py", line 23, in __exit__\n    self.gen.next()\n', u'  File "/usr/lib/python2.6/site-packages/nova/exception.py", line 92, in wrapped\n    retur
n f(*args, **kw)\n', u'  File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 1827, in host_power_action\n    return self.driver.host_power_action(host, 
action)\n', u'  File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py", line 2815, in host_power_action\n    raise NotImplementedError()\n', u'NotImplemented
Error\n'].
2013-02-13 13:17:52 10284 TRACE nova.api.openstack Traceback (most recent call last):
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/api/openstack/__init__.py", line 78, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return req.get_response(self.application)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1053, in get_response
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     application, catch_exc_info=False)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1022, in call_application
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     app_iter = application(self.environ, start_response)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return resp(environ, start_response)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/keystone/middleware/auth_token.py", line 278, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return self.app(env, start_response)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return resp(environ, start_response)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return resp(environ, start_response)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return resp(environ, start_response)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/Routes-1.12.3-py2.6.egg/routes/middleware.py", line 131, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     response = self.app(environ, start_response)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return resp(environ, start_response)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     resp = self.call_func(req, *args, **self.kwargs)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return self.func(req, *args, **kwargs)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 894, in __call__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     content_type, body, accept)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 942, in _process_stack
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     action_result = self.dispatch(meth, request, action_args)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 1030, in dispatch
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return method(req=request, **action_args)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/contrib/hosts.py", line 214, in reboot
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return self._host_power_action(req, host=id, action="reboot")
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/api/openstack/compute/contrib/hosts.py", line 199, in _host_power_action
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     action=action)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/compute/api.py", line 2067, in host_power_action
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     host=host)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/compute/rpcapi.py", line 278, in host_power_action
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     action=action), topic)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/proxy.py", line 80, in call
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return rpc.call(context, self._get_topic(topic), msg, timeout)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/__init__.py", line 108, in call
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     return _get_impl().call(cfg.CONF, context, topic, msg, timeout)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/impl_qpid.py", line 543, in call
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     rpc_amqp.get_connection_pool(conf, Connection))
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 369, in call
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     rv = list(rv)
2013-02-13 13:17:52 10284 TRACE nova.api.openstack   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 337, in __iter__
2013-02-13 13:17:52 10284 TRACE nova.api.openstack     raise result
2013-02-13 13:17:52 10284 TRACE nova.api.openstack RemoteError: Remote error: NotImplementedError 
2013-02-13 13:17:52 10284 TRACE nova.api.openstack [u'Traceback (most recent call last):\n', u'  File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 276, in _process_data\n    rval = self.proxy.dispatch(ctxt, version, method, **args)\n', u'  File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/dispatcher.py", line 145, in dispatch\n    return getattr(proxyobj, method)(ctxt, **kwargs)\n', u'  File "/usr/lib/python2.6/site-packages/nova/exception.py", line 117, in wrapped\n    temp_level, payload)\n', u'  File "/usr/lib64/python2.6/contextlib.py", line 23, in __exit__\n    self.gen.next()\n', u'  File "/usr/lib/python2.6/site-packages/nova/exception.py", line 92, in wrapped\n    return f(*args, **kw)\n', u'  File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 1827, in host_power_action\n    return self.driver.host_power_action(host, action)\n', u'  File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py", line 2815, in host_power_action\n    raise NotImplementedError()\n', u'NotImplementedError\n'].
2013-02-13 13:17:52 10284 TRACE nova.api.openstack 
2013-02-13 13:17:52 INFO nova.api.openstack [req-2e6d455a-e118-404d-88e4-88db43cbfd3f 6288e0b61d5643bb93d2288631d75940 b1de5e0cec444706bf0203cbd80e0e94] http://10.35.160.11:8774/v2/b1de5e0cec444706bf0203cbd80e0e94/os-hosts/puma02.scl.lab.tlv.redhat.com/reboot returned with HTTP 500
2013-02-13 13:17:52 INFO nova.osapi_compute.wsgi.server [req-2e6d455a-e118-404d-88e4-88db43cbfd3f 6288e0b61d5643bb93d2288631d75940 b1de5e0cec444706bf0203cbd80e0e94] 10.35.160.11 - - [13/Feb/2013 13:17:52] "GET /v2/b1de5e0cec444706bf0203cbd80e0e94/os-hosts/puma02.scl.lab.tlv.redhat.com/reboot HTTP/1.1" 500 335 0.26246

Comment 1 Omri Hochman 2013-02-13 13:23:20 UTC
Created attachment 696801 [details]
api.log

Comment 3 Daniel Berrangé 2013-02-19 16:26:15 UTC
Looking at the source the method is

    def host_power_action(self, host, action):
        """Reboots, shuts down or powers up the host."""
        raise NotImplementedError()

the reboot / shutdown actions can easily be done for libvirt hosts by just running 'shutdown -h now' (or -r for reboot).

Comment 4 Russell Bryant 2013-02-19 17:50:44 UTC
Couple of things here ...

1) Dan B. says that this method can easily be implemented for the libvirt driver, so we should do that.

2) More generally, if there are other cases where an operation is not implemented, we should ensure that a nasty exception doesn't end up in the logs.  There is some code from Grizzly that we can use to mark certain exceptions as "normal" results from rpc calls so that they won't be logged like this.

Comment 6 Xavier Queralt 2013-09-06 13:24:06 UTC
The generic not implemented error was already fixed in grizzly 2013.1:

$ nova host-action --action reboot openstack2
ERROR: Virt driver does not implement host power management. (HTTP 501) (Request-ID: req-af749222-807b-4f5d-bbb4-6a72fd614351)