Reviewed: https://review.openstack.org/455183 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0c2b73e80141c6bef309097d1cbd0129d6ca094d Submitter: Jenkins Branch: master
commit 0c2b73e80141c6bef309097d1cbd0129d6ca094d Author: Kevin_Zheng <zhengzhe...@huawei.com> Date: Mon Apr 10 17:28:33 2017 +0800 Fix HTTP 500 raised for getConsoleLog for stopped instance Stopped instances with pty console will not contain `source_node` information, and in the current implementation the pty variable used later will result in an UnboundLocalError, which results in a 500 error out of the API. Closes-bug: #1680363 Change-Id: I4dffba959e2292254dc757f22c3f7893d2da72f9 ** Changed in: nova Status: In Progress => Fix Released -- 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/1680363 Title: Raise Unexpected API Error when get console log from stopped instance Status in OpenStack Compute (nova): Fix Released Bug description: (openstack) console log show chenrui_vm Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible. <type 'exceptions.UnboundLocalError'> (HTTP 500) (Request-ID: req-26d4eed4-316f-4d3c-9d2f-040f855ee940) (openstack) server list +--------------------------------------+------------+---------+--------------------------------------------------------+--------------------------+ | ID | Name | Status | Networks | Image Name | +--------------------------------------+------------+---------+--------------------------------------------------------+--------------------------+ | 2cf68078-52f7-4f15-92dc-7333927220f1 | chenrui_vm | SHUTOFF | private=fdb4:4f0f:960b:0:f816:3eff:fe4b:25c3, 10.0.0.8 | cirros-0.3.5-x86_64-disk | +--------------------------------------+------------+---------+--------------------------------------------------------+--------------------------+ n-cpu.log nd /usr/local/lib/python2.7/dist-packages/oslo_messaging/_drivers/amqpdriver.py:473 2017-04-06 16:19:09.814 17016 DEBUG oslo_messaging._drivers.amqpdriver [req-26d4eed4-316f-4d3c-9d2f-040f855ee940 admin admin] CAST unique_id: ada9ebc67fe04118b1c191362bf53d7b NOTIFY exchange 'nova' topic 'versioned_notifications.error' _send /usr/local/lib/python2.7/dist-packages/oslo_messaging/_drivers/amqpdriver.py:473 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server [req-26d4eed4-316f-4d3c-9d2f-040f855ee940 admin admin] Exception during message handling 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server Traceback (most recent call last): 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/server.py", line 157, in _process_incoming 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server res = self.dispatcher.dispatch(message) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 213, in dispatch 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 183, in _do_dispatch 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server result = func(ctxt, **new_args) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/server.py", line 229, in inner 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server return func(*args, **kwargs) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/exception_wrapper.py", line 77, in wrapped 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server function_name, call_dict, binary) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__ 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server self.force_reraise() 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server six.reraise(self.type_, self.value, self.tb) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/exception_wrapper.py", line 68, in wrapped 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server return f(self, context, *args, **kw) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/compute/manager.py", line 214, in decorated_function 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server kwargs['instance'], e, sys.exc_info()) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__ 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server self.force_reraise() 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server six.reraise(self.type_, self.value, self.tb) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/compute/manager.py", line 202, in decorated_function 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server return function(self, context, *args, **kwargs) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/compute/manager.py", line 4543, in get_console_output 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server output = self.driver.get_console_output(context, instance) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 2801, in get_console_output 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server data = self._flush_libvirt_console(pty) 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server UnboundLocalError: local variable 'pty' referenced before assignment 2017-04-06 16:19:09.816 17016 ERROR oslo_messaging.rpc.server 2017-04-06 16:19:09.817 17016 DEBUG oslo_messaging._drivers.amqpdriver [req-26d4eed4-316f-4d3c-9d2f-040f855ee940 admin admin] sending reply msg_id: 9f78f1c6f0af419ca73ae288b2082902 reply queue: reply_d1293bd1e962444caa9999b71ff92cf2 time elapsed: 0.602079593111s _send_reply /usr/local/lib/python2.7/dist-packages/oslo_messaging/_drivers/amqpdriver.py:90 stack@szxbzci0004 ~/logs $ virsh list --all Id Name State ---------------------------------------------------- - instance-00000006 shut off stack@szxbzci0004 ~/logs $ virsh dumpxml instance-00000006 ... <interface type='bridge'> <mac address='fa:16:3e:4b:25:c3'/> <source bridge='qbr86d9c781-31'/> <target dev='tap86d9c781-31'/> <model type='virtio'/> <driver name='qemu'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <log file='/opt/stack/data/nova/instances/2cf68078-52f7-4f15-92dc-7333927220f1/console.log' append='off'/> <target port='0'/> </serial> <console type='pty'> <log file='/opt/stack/data/nova/instances/2cf68078-52f7-4f15-92dc-7333927220f1/console.log' append='off'/> <target type='serial' port='0'/> </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> ... stack@szxbzci0004 ~/logs $ virsh version Compiled against library: libvirt 2.5.0 Using library: libvirt 2.5.0 Using API: QEMU 2.5.0 Running hypervisor: QEMU 2.8.0 stack@szxbzci0004 ~/nova (master) $ git log -1 commit 53296a07027ea434cdae90709c7298ad2fb346c6 Merge: 7660d0c f828f6d Author: Jenkins <jenk...@review.openstack.org> Date: Wed Apr 5 22:08:00 2017 +0000 Merge "docs: update description for AggregateInstanceExtraSpecsFilter" To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1680363/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp