Ask Your Question
0

wget http://169.254.169.254/2009-04-04/meta-data/instance-id - error 404?

asked 2014-01-07 15:46:21 -0600

antonnoble gravatar image

I want to verify if my metadata service is working properly.

So I perform:

wget http://169.254.169.254/2009-04-04/meta-data/instance-id

I get an ERROR 404 not found. Is this normal? If not, how can I get my metadata service working properly?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2014-04-05 21:25:38 -0600

larsks gravatar image

dbaxps has provided some information about the OpenStack metadata api, which is available at /openstack, but you are asking about the EC2 metadata API. Yes, one would expect the given request to succeed; for example, on one of my local instances, that returns:

$ curl http://169.254.169.254/2009-04-04/meta-data/instance-id
i-00000129

You can try replace 2009-04-04 with latest, which will always refer to the latest version of the API, but either should work.

If your metadata service is not working correctly, there are several places to check:

  • The metadata service is started by nova-api, and logs to /var/log/nova/api.log. Are there any errors here?
  • If you are running Neutron, then there is a proxy service that connects instances to the metadata service running inside your Neutron router namespaces. This service logs to /var/log/neutron/metadata-agent.log, but you may need to enable debug logging in your configuration file to get anything useful.

If your reqests are actually going where they're supposed to, one or both of these locations should show some activity when you make a request.

If you don't see any activity here and you're still getting these errors, drop a comment here and we can take a closer look.

edit flag offensive delete link more
0

answered 2016-01-02 01:14:24 -0600

uts9 gravatar image

updated 2016-01-03 00:03:51 -0600

Facing same issue on Kilo setup

Node1: Controller + Network + Compute (l3_agent.ini -> agent_type dvr_snat ) Node2: Compute (l3_agent.ini -> agent_type dvr)

Update: Issue is resolved after setting use_forwarded_for=True in /etc/nova/nova.conf

nova/api/metadata/handler.py

  144     def _handle_remote_ip_request(self, req):
  145         remote_address = req.remote_addr
  146         if CONF.use_forwarded_for:
  147             remote_address = req.headers.get('X-Forwarded-For', remote_address)
  148 
  149         try:
  150             meta_data = self.get_metadata_by_remote_address(remote_address)
  151         except Exception:
  152             LOG.exception(_('Failed to get metadata for ip: %s'),
  153                           remote_address)
  154             msg = _('An unknown error has occurred. '
  155                     'Please try your request again.')
  156             raise webob.exc.HTTPInternalServerError(explanation=unicode(msg))
  157 
  158         if meta_data is None:
  159             LOG.error(_LE('Failed to get metadata for ip: %s'),
  160                       remote_address)
  161 
  162         return meta_data
edit flag offensive delete link more
-2

answered 2014-04-05 09:45:55 -0600

dbaxps gravatar image

updated 2014-04-05 10:14:33 -0600

You should be able to launch your browser (links at least) to http://169.254.169.254/openstack/latest
The respond will be
meta_data.json password vendor_data.json
On F20 instance

[root@vf20rs0404 ~] # curl http://169.254.169.254/openstack/latest/meta_data.json | tee meta_data.json
                  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                                 Dload  Upload   Total   Spent    Left  Speed
                100  1286  100  1286    0     0   1109      0  0:00:01  0:00:01 --:--:--  1127
                . . . . . . . . 
                "uuid": "10142280-44a2-4830-acce-f12f3849cb32",
                "availability_zone": "nova",
                "hostname": "vf20rs0404.novalocal", 
                "launch_index": 0, 
                "public_keys": {"key2": "ssh-rsa . . . . .  Generated by Nova\n"}, 
                "name": "VF20RS0404"

        On another instance Ubuntu 14.04 (nightly build)

            root@ubuntutrs0407:~#curl http://169.254.169.254/openstack/latest/meta_data.json | tee meta_data.json
              % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                             Dload  Upload   Total   Spent    Left  Speed
            100  1292  100  1292    0     0    444      0  0:00:02  0:00:02 --:--:--   446
            {"random_seed": "...", 
            "uuid": "8c79e60c-4f1d-44e5-8446-b42b4d94c4fc", 
            "availability_zone": "nova", 
            "hostname": "ubuntutrs0407.novalocal", 
            "launch_index": 0, 
            "public_keys": {"key2": "ssh-rsa .... Generated by Nova\n"}, 
            "name": "UbuntuTRS0407"}

    [root@dallas1 ~(keystone_boris)]$ nova list
    +--------------------------------------+---------------+-----------+------------+-------------+-----------------------------+
    | ID                                   | Name          | Status    | Task State | Power State | Networks                    |
    +--------------------------------------+---------------+-----------+------------+-------------+-----------------------------+
    | d0f947b1-ff6a-4ff0-b858-b63a3d07cca3 | UbuntuTRS0405 | SUSPENDED | None       | Shutdown    | int=10.0.0.7, 192.168.1.106 |
    | 8c79e60c-4f1d-44e5-8446-b42b4d94c4fc | UbuntuTRS0407 | ACTIVE    | None       | Running     | int=10.0.0.6, 192.168.1.107 |
    | 8775924c-dbbd-4fbb-afb8-7e38d9ac7615 | VF20RS037     | SUSPENDED | None       | Shutdown    | int=10.0.0.2, 192.168.1.115 |
    | d22a2376-33da-4a0e-a066-d334bd2e511d | VF20RS0402    | SUSPENDED | None       | Shutdown    | int=10.0.0.4, 192.168.1.103 |
    | 10142280-44a2-4830-acce-f12f3849cb32 | VF20RS0404    | ACTIVE    | None       | Running     | int=10.0.0.5, 192.168.1.105 |
    +--------------------------------------+---------------+-----------+------------+-------------+-----------------------------+
edit flag offensive delete link more

Comments

That is final draft for Access metadata from RDO Havana Instance on Fedora 20

Yes, I realise that it was not answering the question. However , I would suggest to run  also :-
                    # ip netns list 
                    qrouter-cb80b040-f13f-4a67-a39e-353b1c873a0d 
                    qdhcp-166d9651-d299-47df-a5a1-b368e87b612f 
                    #  ip netns exec qrouter-cb80b040-f13f-4a67-a39e-353b1c873a0d iptables -L -t nat | grep 169 
                        with corresponding name cloud controller's router namespace. In case ouuput like :- 
                    REDIRECT   tcp  --  anywhere             169.254.169.254      tcp dpt:http redir ports  port_number 
                    Run:-
                    #  netstat -lntp | grep port_number 
                    tcp        0      0 0.0.0.0:8700            0.0.0.0:*               LISTEN      2589/python         
                    # ps -ef | grep 2589
                    nova      2589     1  0 07:05 ?        00:02:46 /usr/bin/python /usr/bin/nova-api --logfile /var/log
            /nova/api.log
                    nova      2628  2589  0 07:05 ?        00:00:00 /usr/bin/python /usr/bin/nova-api --logfile /var/log/nova/api.log
                    nova      2629  2589  0 07:05 ?        00:00:15 /usr/bin/python /usr ...
(more)
dbaxps gravatar imagedbaxps ( 2014-04-06 06:09:09 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-01-07 15:46:21 -0600

Seen: 6,198 times

Last updated: Jan 03 '16