Public bug reported: When trying to GET a non-existent metadata key within the VM, like '/latest/meta-data/hostname/abc', the Nova metadata service responses with a 500 HTTP status code:
Inside a VM: $ curl http://169.254.169.254/latest/meta-data/hostname/abc <html> <head> <title>500 Internal Server Error</title> </head> <body> <h1>500 Internal Server Error</h1> An unknown error has occurred. Please try your request again.<br /><br /> </body> </html>$ The nova metadata service logs: CRITICAL nova [None req-3286f047-98c4-41c8-a11b-02a140fd2e4d None None] Unhandled error: TypeError: string indices must be integers ERROR nova Traceback (most recent call last): ERROR nova File "/usr/local/lib/python3.9/site-packages/paste/urlmap.py", line 216, in __call__ ERROR nova return app(environ, start_response) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 129, in __call__ ERROR nova resp = self.call_func(req, *args, **kw) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 193, in call_func ERROR nova return self.func(req, *args, **kwargs) ERROR nova File "/usr/local/lib/python3.9/site-packages/oslo_middleware/base.py", line 124, in __call__ ERROR nova response = req.get_response(self.application) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1313, in send ERROR nova status, headers, app_iter = self.call_application( ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1278, in call_application ERROR nova app_iter = application(self.environ, start_response) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 129, in __call__ ERROR nova resp = self.call_func(req, *args, **kw) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 193, in call_func ERROR nova return self.func(req, *args, **kwargs) ERROR nova File "/usr/local/lib/python3.9/site-packages/oslo_middleware/base.py", line 124, in __call__ ERROR nova response = req.get_response(self.application) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1313, in send ERROR nova status, headers, app_iter = self.call_application( ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1278, in call_application ERROR nova app_iter = application(self.environ, start_response) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 129, in __call__ ERROR nova resp = self.call_func(req, *args, **kw) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 193, in call_func ERROR nova return self.func(req, *args, **kwargs) ERROR nova File "/opt/stack/nova/nova/api/metadata/handler.py", line 129, in __call__ ERROR nova data = meta_data.lookup(req.path_info) ERROR nova File "/opt/stack/nova/nova/api/metadata/base.py", line 576, in lookup ERROR nova data = self.get_ec2_item(path_tokens[1:]) ERROR nova File "/opt/stack/nova/nova/api/metadata/base.py", line 308, in get_ec2_item ERROR nova return find_path_in_tree(data, path_tokens[1:]) ERROR nova File "/opt/stack/nova/nova/api/metadata/base.py", line 737, in find_path_in_tree ERROR nova data = data[path_tokens[i]] ERROR nova TypeError: string indices must be integers ERROR nova [pid: 156048|app: 0|req: 5/9] 10.136.16.184 () {40 vars in 687 bytes} [Tue Mar 26 04:37:44 2024] GET /latest/meta-data/hostname/abc => generated 0 bytes in 82 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0) ** Affects: nova Importance: Undecided Status: New -- 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/2059128 Title: Internal Server Error when attempring to use an incorrect URL within the metadata API Status in OpenStack Compute (nova): New Bug description: When trying to GET a non-existent metadata key within the VM, like '/latest/meta-data/hostname/abc', the Nova metadata service responses with a 500 HTTP status code: Inside a VM: $ curl http://169.254.169.254/latest/meta-data/hostname/abc <html> <head> <title>500 Internal Server Error</title> </head> <body> <h1>500 Internal Server Error</h1> An unknown error has occurred. Please try your request again.<br /><br /> </body> </html>$ The nova metadata service logs: CRITICAL nova [None req-3286f047-98c4-41c8-a11b-02a140fd2e4d None None] Unhandled error: TypeError: string indices must be integers ERROR nova Traceback (most recent call last): ERROR nova File "/usr/local/lib/python3.9/site-packages/paste/urlmap.py", line 216, in __call__ ERROR nova return app(environ, start_response) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 129, in __call__ ERROR nova resp = self.call_func(req, *args, **kw) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 193, in call_func ERROR nova return self.func(req, *args, **kwargs) ERROR nova File "/usr/local/lib/python3.9/site-packages/oslo_middleware/base.py", line 124, in __call__ ERROR nova response = req.get_response(self.application) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1313, in send ERROR nova status, headers, app_iter = self.call_application( ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1278, in call_application ERROR nova app_iter = application(self.environ, start_response) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 129, in __call__ ERROR nova resp = self.call_func(req, *args, **kw) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 193, in call_func ERROR nova return self.func(req, *args, **kwargs) ERROR nova File "/usr/local/lib/python3.9/site-packages/oslo_middleware/base.py", line 124, in __call__ ERROR nova response = req.get_response(self.application) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1313, in send ERROR nova status, headers, app_iter = self.call_application( ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1278, in call_application ERROR nova app_iter = application(self.environ, start_response) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 129, in __call__ ERROR nova resp = self.call_func(req, *args, **kw) ERROR nova File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 193, in call_func ERROR nova return self.func(req, *args, **kwargs) ERROR nova File "/opt/stack/nova/nova/api/metadata/handler.py", line 129, in __call__ ERROR nova data = meta_data.lookup(req.path_info) ERROR nova File "/opt/stack/nova/nova/api/metadata/base.py", line 576, in lookup ERROR nova data = self.get_ec2_item(path_tokens[1:]) ERROR nova File "/opt/stack/nova/nova/api/metadata/base.py", line 308, in get_ec2_item ERROR nova return find_path_in_tree(data, path_tokens[1:]) ERROR nova File "/opt/stack/nova/nova/api/metadata/base.py", line 737, in find_path_in_tree ERROR nova data = data[path_tokens[i]] ERROR nova TypeError: string indices must be integers ERROR nova [pid: 156048|app: 0|req: 5/9] 10.136.16.184 () {40 vars in 687 bytes} [Tue Mar 26 04:37:44 2024] GET /latest/meta-data/hostname/abc => generated 0 bytes in 82 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0) To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/2059128/+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