Nova API - nova.servers.get(server id) is not working as expected

Bug #1631881 reported by Ali Jabbar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Expired
Undecided
Unassigned

Bug Description

When Trying to use nova api to check the server instance it is not working.. code is here

nova list

stack@cinv-V:/home/cinv/devstack$ nova list
+--------------------------------------+------+--------+------------+-------------+--------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------+--------+------------+-------------+--------------------+
| 78e7f066-5ef1-4791-a781-71251491ffb1 | test | ACTIVE | - | Running | private=10.0.0.119 |
+--------------------------------------+------+--------+------------+-------------+--------------------+

---------------------------------------------------------------------------------
import os
import time
#import novaclient.v2_0.client as nvclient
#from novaclient.v1_1 import client
from novaclient import client
from t2 import get_nova_creds
creds = get_nova_creds()
nova = client.Client(version=2,**creds)
footest = nova.servers.get('78e7f066-5ef1-4791-a781-71251491ffb1')
print footest.interface_list()

stack@cinv-V:/home/cinv/devstack$

---------------------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 14, in <module>
    print footest.interface_list()
  File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/servers.py", line 511, in interface_list
    return self.manager.interface_list(self)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/servers.py", line 1639, in interface_list
    'interfaceAttachments')
  File "/usr/local/lib/python2.7/dist-packages/novaclient/base.py", line 242, in _list
    resp, body = self.api.client.get(url)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 452, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 430, in _cs_request
    resp, body = self._time_request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 403, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 397, in request
    raise exceptions.from_response(resp, body, url, method)
novaclient.exceptions.HTTPNotImplemented: The requested functionality is not supported. (HTTP 501) (Request-ID: req-f92b463a-3c3e-4263-9ee2-6e4c75e0c00c)
___________________

Ali Jabbar (jabbar-ali)
description: updated
Revision history for this message
NITIN GUPTA (nitin-29-gupta) wrote :

Jabbar,
Could you please provide the information regarding "t2" in your code ?

Changed in python-novaclient:
status: New → Confirmed
status: Confirmed → New
Revision history for this message
Ali Jabbar (jabbar-ali) wrote :

Here is the code in t2.py

-------------------------------------
#!/usr/bin/env python
import os

def get_keystone_creds():
    d = {}
    d['username'] = os.environ['OS_USERNAME']
    d['password'] = os.environ['OS_PASSWORD']
    d['auth_url'] = os.environ['OS_AUTH_URL']
    d['tenant_name'] = os.environ['OS_TENANT_NAME']
    print d
    return d

def get_nova_creds():
    d = {}
    d['username'] = os.environ['OS_USERNAME']
    d['api_key'] = os.environ['OS_PASSWORD']
    d['auth_url'] = os.environ['OS_AUTH_URL']
    d['project_id'] = os.environ['OS_TENANT_NAME']
    print d
    return d
----------------------------
Just copy and try

Revision history for this message
NITIN GUPTA (nitin-29-gupta) wrote :

I tried with same code, and got the same issue.

-------------------------------------------------
stack@devtest-vm:~$ python test.py
{'username': 'admin', 'project_id': 'admin', 'api_key': 'abc123', 'auth_url': 'http://10.254.254.57:5000/v2.0'}
Traceback (most recent call last):
  File "test.py", line 12, in <module>
    print footest.interface_list()
  File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/servers.py", line 511, in interface_list
    return self.manager.interface_list(self)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/servers.py", line 1639, in interface_list
    'interfaceAttachments')
  File "/usr/local/lib/python2.7/dist-packages/novaclient/base.py", line 242, in _list
    resp, body = self.api.client.get(url)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 452, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 430, in _cs_request
    resp, body = self._time_request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 403, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 397, in request
    raise exceptions.from_response(resp, body, url, method)
novaclient.exceptions.HTTPNotImplemented: The requested functionality is not supported. (HTTP 501) (Request-ID: req-3248fbf3-6c95-488e-8380-2d7761cecbd7)
-------------------------------------------------

Changed in python-novaclient:
status: New → Confirmed
Revision history for this message
int32bit (int32bit) wrote :

It seems all right on my environment, I ran this as follows:

[root@int32bit-centos ~(keystone_admin)]# cat test.py
import os
import time

from novaclient import client

def get_nova_creds():
    d = {}
    d['username'] = os.environ['OS_USERNAME']
    d['api_key'] = os.environ['OS_PASSWORD']
    d['auth_url'] = os.environ['OS_AUTH_URL']
    d['project_id'] = os.environ['OS_TENANT_NAME']
    print d
    return d

def main():
    creds = get_nova_creds()
    nova = client.Client(version=2,**creds)
    footest = nova.servers.get('d61af42c-d3b3-488a-98e2-2dc283b7c56b')
    print footest.interface_list()

if __name__ == '__main__':
    main()
[root@int32bit-centos ~(keystone_admin)]# python test.py
{'username': 'admin', 'project_id': 'admin', 'api_key': '8b9dada240e4476e', 'auth_url': 'http://192.168.0.4:5000/v2.0'}
[<NetworkInterface: b9512ecc-0981-42ea-b2eb-d6a34089f9cf>]

It seems work fine.

int32bit (int32bit)
Changed in python-novaclient:
status: Confirmed → Incomplete
Revision history for this message
Akshil Verma (akshilv) wrote :

Tested on my local devstack setup with novaclient version 6.0.0. It is working fine. Seems like the issue might be on your setup or the novaclient version you are using.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for python-novaclient because there has been no activity for 60 days.]

Changed in python-novaclient:
status: Incomplete → Expired
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.