HowTo access metadata from RDO Havana Instance on Fedora 20

Per  Direct_access _to_Nova_metadata

In an environment running Neutron, a request from your instance must traverse a number of steps:

1. From the instance to a router,
2. Through a NAT rule in the router namespace,
3. To an instance of the neutron-ns-metadata-proxy,
4. To the actual Nova metadata service

   Reproducing  Dirrect_access_to_Nova_metadata   I was able to get only list of EC2 metadata available, but not the values. However, the major concern is getting  values of metadata obtained in post  Direct_access _to_Nova_metadata
and also at  /openstack  location. The last  ones seem to me important not less then present  in EC2 list . This metadata are also not provided by this list.

Commands been run bellow are supposed to verify Nova&Neutron Setup to be performed  successfully , otherwise passing four steps 1,2,3,4 is supposed to fail and it will force you to analyse corresponding Logs file ( View References). It doesn’t matter did you set up cloud environment  manually or via RDO packstack

Run on Controller Node :-

[root@dallas1 ~(keystone_admin)]$ ip netns list

qrouter-cb80b040-f13f-4a67-a39e-353b1c873a0d
qdhcp-166d9651-d299-47df-a5a1-b368e87b612f

Check on the Routing on Cloud controller’s router namespace, it should show port 80 for 169.254.169.254 routes to the host at port 8700

[root@dallas1 ~(keystone_admin)]$ ip netns exec qrouter-cb80b040-f13f-4a67-a39e-353b1c873a0d iptables -L -t nat | grep 169

REDIRECT   tcp  —  anywhere             169.254.169.254      tcp dpt:http redir ports  8700

Check routing table inside the router namespace:

[root@dallas1 ~(keystone_admin)]$ ip netns exec qrouter-cb80b040-f13f-4a67-a39e-353b1c873a0d ip r

default via 192.168.1.1 dev qg-8fbb6202-3d
10.0.0.0/24 dev qr-2dd1ba70-34  proto kernel  scope link  src 10.0.0.1
192.168.1.0/24 dev qg-8fbb6202-3d  proto kernel  scope link  src 192.168.1.100

[root@dallas1 ~(keystone_admin)]$ ip netns exec qrouter-cb80b040-f13f-4a67-a39e-353b1c873a0d netstat -na

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:8700            0.0.0.0:*               LISTEN   
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   Path

[root@dallas1 ~(keystone_admin)]$ ip netns exec qdhcp-166d9651-d299-47df-a5a1-b368e87b612f netstat -na

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 10.0.0.3:53             0.0.0.0:*               LISTEN
tcp6       0      0 fe80::f816:3eff:feef:53 :::*                    LISTEN
udp        0      0 10.0.0.3:53             0.0.0.0:*
udp        0      0 0.0.0.0:67              0.0.0.0:*
udp6       0      0 fe80::f816:3eff:feef:53 :::*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   Path

[root@dallas1 ~(keystone_admin)]$ iptables-save | grep 8700

-A INPUT -p tcp -m multiport –dports 8700 -m comment –comment “001 metadata incoming” -j ACCEPT

[root@dallas1 ~(keystone_admin)]$ netstat -lntp | grep 8700

tcp        0      0 0.0.0.0:8700            0.0.0.0:*               LISTEN      2830/python  

[root@dallas1 ~(keystone_admin)]$ ps -ef | grep 2830
nova      2830     1  0 09:41 ?        00:00:57 /usr/bin/python /usr/bin/nova-api –logfile /var/log/nova/api.log
nova      2856  2830  0 09:41 ?        00:00:00 /usr/bin/python /usr/bin/nova-api –logfile /var/log/nova/api.log
nova      2874  2830  0 09:41 ?        00:00:09 /usr/bin/python /usr/bin/nova-api –logfile /var/log/nova/api.log
nova      2875  2830  0 09:41 ?        00:00:01 /usr/bin/python /usr/bin/nova-api –logfile /var/log/nova/api.log

1. At this point  you should be able (inside any running Havana instance) to launch your browser (“links” at least if there is no Light Weight X environment)  to

http://169.254.169.254/openstack/latest (not EC2)

The response  will be  :    meta_data.json password vendor_data.json

 If Light Weight X Environment is unavailable then use “links”

 

 

 What is curl   http://curl.haxx.se/docs/faq.html#What_is_cURL

Now you should be able to run 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 (in my case Ubuntu 14.04 )

 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”}

Running VMs on Compute node:-

[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 |

+————————————–+—————+———–+————+————-+——————–

Launching browser to http://169.254.169.254/openstack/latest/meta_data.json on another Two Node Neutron GRE+OVS F20 Cluster. Output is sent directly to browser

2. I have provided some information about the OpenStack metadata api, which is available at /openstack, but if you are concerned  about the EC2 metadata API , browser should be launched to  http://169.254.169.254/latest/meta-data/

 What allows to to get any of displayed parameters

For instance :-

 

   OR via CLI

ubuntu@ubuntutrs0407:~$ curl  http://169.254.169.254/latest/meta-data/instance-id

i-000000a4

ubuntu@ubuntutrs0407:~$ curl  http://169.254.169.254/latest/meta-data/public-hostname

ubuntutrs0407.novalocal

ubuntu@ubuntutrs0407:~$ curl  http://169.254.169.254/latest/meta-data/public-ipv4

192.168.1.107

To verify instance-id launch virt-manger connected to Compute Node

 

 

which shows same value “000000a4”

Another option in text mode is “links” browser

$ ssh -l ubuntu -i key2.pem 192.168.1.109

Inside Ubuntu 14.04 instance  :-

# apt-get -y install links

# links

Press ESC to get to menu:-

 

 

 

 

References

1.https://ask.openstack.org/en/question/10140/wget-http1692541692542009-04-04meta-datainstance-id-error-404/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: