Showing posts with label NovaClient. Show all posts
Showing posts with label NovaClient. Show all posts

Thursday, November 13, 2014

NovaClient and Floating IP related errors

Error 1:
ERROR (NotFound): FloatingIpPoolNotFound: Floating ip pool not found. (HTTP 404)

root@puppet:/opt/python-script# nova floating-ip-create
ERROR (NotFound): FloatingIpPoolNotFound: Floating ip pool not found. (HTTP 404) (Request-ID: req-11559652-fb3d-40a2-b260-34a2af1eb9a6)

This error occur when the default nova floating ip pool is not present.

Default floating ip pool is 'nova'.

In my case it was mentioned as 'external'

After specifying the external pool in floating ip create command, ip was successfully created.

root@puppet:/opt/python-script# nova floating-ip-create external
+----------------+-----------+----------+----------+
| Ip             | Server Id | Fixed Ip | Pool     |
+----------------+-----------+----------+----------+
| 192.168.17.156 | -         | -        | external |
+----------------+-----------+----------+----------+

Error 2:
No nw_info cache associated with instance (HTTP 400) (Request-ID: req-ba8c1adc-cc41-4592-8ac2-9d01cd66f6e8)

When trying to add a floating ip address (which is already created) to a newly spawned instance in OpenStack cloud, I was getting the following error.

<FloatingIP fixed_ip=None, id=7e438ee9-4e5e-4b6d-b43b-246d18039890, instance_id=None, ip=192.168.17.159, pool=external>
exception is  No nw_info cache associated with instance (HTTP 400) (Request-ID: req-ba8c1adc-cc41-4592-8ac2-9d01cd66f6e8)

This was due to instance was not properly started its networking operations and we were trying to assign the floating ip address to it.

After introducing a small delay between spawning the instance and assigning the newly created floating ip address to it, the operation was successful.

root@puppet:/opt/python-script# python test.py 
Generating nova credentials...
Retrieving image, flavor and network information...
<Image: suhan-daf-agent-ubuntu12.04>
<Network: network-routable>
7bb05f0b-44b4-4c6d-a36f-7194dc43bd42


ACTIVE
<FloatingIP fixed_ip=None, id=d7938b77-ead2-40ce-b992-65770544304b, instance_id=None, ip=192.168.17.162, pool=external>
{u'network-routable': [{u'OS-EXT-IPS-MAC:mac_addr': u'fa:16:3e:74:b4:80', u'version': 4, u'addr': u'192.168.30.174', u'OS-EXT-IPS:type': u'fixed'}]}
192.168.30.174
940c3175-f066-4062-ba77-9fa3b74904c4
ACTIVE

Monday, November 10, 2014

NovaClient connection errors - simple mistakes to avoid to save your time

1. SSH Permission denied (publickey) - even the key was generated and mentioned.

I have spawned an instance in the OpenStack remote cloud. 
When I tried to connect to the newly spawned instance I got the following error.

root@suhan-VirtualBox:~# ssh -i cloud.key ubuntu@192.168.30.88
Warning: Identity file cloud.key not accessible: No such file or directory.
Permission denied (publickey).

Then I realised there is nothing wrong with the key, but the cloud.key file is not in the location from which I was trying to connect to.

I retried the connection from the location where the cloud.key was present and it was successful.

root@suhan-VirtualBox:/opt/internal-cloud# ls
backup cloud.key  conf.xml  deploy_script.py  printValuesIP.py  test.py
root@suhan-VirtualBox:/opt/internal-cloud# 
root@suhan-VirtualBox:/opt/internal-cloud# ssh -i cloud.key ubuntu@192.168.30.88
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.2.0-57-virtual x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Tue Nov 11 07:39:33 UTC 2014

  System load:  0.0               Processes:           67
  Usage of /:   3.6% of 39.37GB   Users logged in:     0
  Memory usage: 2%                IP address for eth0: 192.168.30.88
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

109 packages can be updated.
63 updates are security updates.

New release '14.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Tue Nov 11 07:09:44 2014 from 10.100.5.175
ubuntu@test-to-delete:~$ 

2. You must provide a username via either --os_username or env[OS_USERNAME]

I tried to ssh the newly created instance via a remote host using the key I created.
Nova credentials are to be embedded to the environmental variables via .bash_profile.
But when I tried to retrieve the nova list got the following error.

ubuntu@test-to-delete:~$ nova list
ERROR: You must provide a username via either --os_username or env[OS_USERNAME]

Environmental variables are also set.

Then I realised I was not logged in as root.

After retrying as root, I got the results I wanted... :)
ubuntu@test-to-delete:~$ sudo -i
root@test-to-delete:~# nova list
+--------------------------------------+------------------------------+--------+-------------------------------------------------------+
|                  ID                  |             Name             | Status |                             Networks                            |
+--------------------------------------+------------------------------+--------+-------------------------------------------------------+
| 200845a1-739e-41cf-bb05-744cec1398c1 | test-to-delete               | ACTIVE | network-routable=192.168.30.88                        |
| 2eeba7a3-f7f7-46d4-baff-7c7ab1f433b9 | lasindudef-ddc               | ACTIVE | network-non-routable=10.0.0.135                       |
| 3a4f8d7e-753d-456b-b26d-058548bc7994 | manula1                      | ACTIVE | network-routable=192.168.30.14, 192.168.30.15         |
| 5902f2bc-2d9d-4822-a3ea-580941717b23 | defaultlas-fb2               | ACTIVE | network-non-routable=10.0.0.108                       |
| 6175c44e-c1bb-45da-af3e-f48e01194729 | ch-stratos                   | ACTIVE | network-non-routable=10.0.0.130, 192.168.17.55        |
| 811d7d88-8e00-4354-b52c-3bb6e05aa80c | centos                       | ACTIVE | network-non-routable=10.0.0.24, 192.168.17.12         |
| 9a215704-0aff-44d4-993d-90fe70c46243 | Lasindu-Stratos              | ACTIVE | network-non-routable=10.0.0.5, 192.168.17.4           |
| aea68060-db94-434e-915f-31e9e72f152a | ch-puppetmaster              | ACTIVE | network-non-routable=10.0.0.88, 192.168.17.33         |
| e3e2558f-1c2d-43ff-a2b8-86315176de45 | CentOSBAM                    | ACTIVE | network-non-routable=10.0.0.25, 192.168.17.13         |
| eae27af4-a500-437a-878a-1a184fee5f7b | S4Test                       | ACTIVE | network-non-routable=10.0.0.56, 192.168.17.58         |
| ee8190bc-db8d-4542-b8d0-ff9a38373e56 | cisco-dev-service            | ACTIVE | network-routable=192.168.30.87                        |
| f47cf558-3435-4f6d-8fd4-739da746ce63 | suhan-daf-master-ubuntu12.04 | ACTIVE | network-routable=192.168.30.86                        |
+--------------------------------------+------------------------------+--------+-------------------------------------------------------+

3. Could not find any suitable endpoint. Correct region?
4. exception is  'Client' object has no attribute 'networks'

This means the python-novaclient is not properly installed.
Try following commands to update python package manager and python-novaclient.

>apt-get update
>apt-get install python-setuptools
>apt-get install python-pip
>pip install --upgrade python-novaclient