Fails to get metadata versions without X-Instance-Id when using quantum metadata proxy

Bug #1192774 reported by Hyunsun Moon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Hyunsun Moon

Bug Description

I'm not sure this is bug or not, but it looks like.
When I tries to get metadata service availability for health check with 'curl http://meta_service_ip:8775' , metadata service returns 400 error with the message that X-Instance-ID is missing. (I enabled quantum metadta proxy)

Looking at the related codes, I can see that the service returns available versions without X-Instance-ID checking if no additional path passed.

nova/api/metadata/handler.py
--------------------
class MetadataRequestHandler(wsgi.Application):

    @webob.dec.wsgify(RequestClass=wsgi.Request)
    def __call__(self, req):
        if os.path.normpath("/" + req.path_info) == "/":
            return(base.ec2_md_print(base.VERSIONS + ["latest"]))
--------------------

But os.path.normpath("/" + req.path_info) returns "//" not "/" if I send request "http://meta_service_ip:8775" or "http://meta_service_ip:8775/".
If I remove "/" from ("/" + req.path_info) it works fine and the service returns version correctly.

Tags: api
description: updated
Matt Riedemann (mriedem)
tags: added: api
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/36775

Changed in nova:
assignee: nobody → Hyunsun Moon (hyunsun-moon)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/36775
Committed: http://github.com/openstack/nova/commit/64bdf2a163bca0505541903229e1072a36bba87f
Submitter: Jenkins
Branch: master

commit 64bdf2a163bca0505541903229e1072a36bba87f
Author: Hyunsun Moon <email address hidden>
Date: Fri Jul 12 12:49:46 2013 +0900

    Fix accessing to '/' of metadata server without any checks to work

    Accessing to '/' of metadata server to get version information should
    be allowed without any checks. Due to the wrong comparison condition,
    it failed.

    Change-Id: Ia8603c321839b959b120af1d018f061f438155c7
    Fixes: bug #1192774

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.