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

No comments:

Post a Comment