rackspace/python-novaclient — Issue #132: nova show should be smarter about caching details
Author: anotherjesse
Created: 2011-10-16 03:12:31+00:00
State: open

doing a simple nova show on a server results in (at least) 11 api requests

nova show firstpost

With ``NOVA_DEBUG=1`` I see

REQ: curl -i http://192.168.2.50:5000/v2.0/tokens -X POST -H "Content-Type: application/json" -H "User-Agent: python-novaclient"

REQ BODY: {"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "password"}}}

RESP:{'date': 'Sun, 16 Oct 2011 03:03:57 GMT', 'status': '200', 'content-length': '1011', 'content-type': 'application/json; charset=UTF-8'} {"access": {"token": {"expires": "2015-02-05T00:00:00", "id": "123123123", "tenant": {"id": "1", "name": "admin"}}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://192.168.2.50:8774/v1.1/1", "region": "RegionOne", "internalURL": "http://192.168.2.50:8774/v1.1/1", "publicURL": "http://192.168.2.50:8774/v1.1/1"}], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://192.168.2.50:9292/v1.1/1", "region": "RegionOne", "internalURL": "http://192.168.2.50:9292/v1.1/1", "publicURL": "http://192.168.2.50:9292/v1.1/1"}], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://192.168.2.50:35357/v2.0", "region": "RegionOne", "internalURL": "http://192.168.2.50:5000/v2.0", "publicURL": "http://192.168.2.50:5000/v2.0"}], "type": "identity", "name": "keystone"}], "user": {"id": "1", "roles": [{"tenantId": "1", "id": "1", "name": "Admin"}, {"id": "1", "name": "Admin"}, {"id": "3", "name": "KeystoneAdmin"}, {"id": "4", "name": "KeystoneServiceAdmin"}], "name": "admin"}}}

REQ: curl -i http://192.168.2.50:8774/v1.1/1/servers/detail?fresh=1318734237.63 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "X-Auth-Token: 123123123"

REQ: curl -i http://192.168.2.50:8774/v1.1/1/servers/detail?fresh=1318734237.63 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "X-Auth-Token: 123123123"

RESP:{'date': 'Sun, 16 Oct 2011 03:03:57 GMT', 'status': '200', 'content-length': '816', 'content-type': 'application/json', 'content-location': u'http://192.168.2.50:8774/v1.1/1/servers/detail?fresh=1318734237.63'} {"servers": [{"status": "ACTIVE", "updated": "2011-10-16T03:03:52Z", "hostId": "fb73dec3d58adba4c1f50973e198fa7723119ee7a568b74fec1f084e", "user_id": "admin", "name": "firstpost", "links": [{"href": "http://192.168.2.50:8774/v1.1/1/servers/1", "rel": "self"}, {"href": "http://192.168.2.50:8774/1/servers/1", "rel": "bookmark"}], "addresses": {"private": [{"version": 4, "addr": "10.0.0.2"}]}, "tenant_id": "1", "image": {"id": "2", "links": [{"href": "http://192.168.2.50:8774/1/images/2", "rel": "bookmark"}]}, "created": "2011-10-16T03:03:46Z", "uuid": "1cc7175e-ead3-4d8a-980d-1b3969469bd8", "accessIPv4": "", "accessIPv6": "", "key_name": null, "progress": 100, "flavor": {"id": "1", "links": [{"href": "http://192.168.2.50:8774/1/flavors/1", "rel": "bookmark"}]}, "config_drive": "", "id": 1, "metadata": {}}]}

RESP:{'date': 'Sun, 16 Oct 2011 03:03:57 GMT', 'status': '200', 'content-length': '816', 'content-type': 'application/json', 'content-location': u'http://192.168.2.50:8774/v1.1/1/servers/detail?fresh=1318734237.63'} {"servers": [{"status": "ACTIVE", "updated": "2011-10-16T03:03:52Z", "hostId": "fb73dec3d58adba4c1f50973e198fa7723119ee7a568b74fec1f084e", "user_id": "admin", "name": "firstpost", "links": [{"href": "http://192.168.2.50:8774/v1.1/1/servers/1", "rel": "self"}, {"href": "http://192.168.2.50:8774/1/servers/1", "rel": "bookmark"}], "addresses": {"private": [{"version": 4, "addr": "10.0.0.2"}]}, "tenant_id": "1", "image": {"id": "2", "links": [{"href": "http://192.168.2.50:8774/1/images/2", "rel": "bookmark"}]}, "created": "2011-10-16T03:03:46Z", "uuid": "1cc7175e-ead3-4d8a-980d-1b3969469bd8", "accessIPv4": "", "accessIPv6": "", "key_name": null, "progress": 100, "flavor": {"id": "1", "links": [{"href": "http://192.168.2.50:8774/1/flavors/1", "rel": "bookmark"}]}, "config_drive": "", "id": 1, "metadata": {}}]}

REQ: curl -i http://192.168.2.50:8774/v1.1/1/flavors/1?fresh=1318734237.78 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "X-Auth-Token: 123123123"

REQ: curl -i http://192.168.2.50:8774/v1.1/1/flavors/1?fresh=1318734237.78 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "X-Auth-Token: 123123123"

REQ: curl -i http://192.168.2.50:8774/v1.1/1/flavors/1?fresh=1318734237.78 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "X-Auth-Token: 123123123"

RESP:{'date': 'Sun, 16 Oct 2011 03:03:57 GMT', 'status': '200', 'content-length': '268', 'content-type': 'application/json', 'content-location': u'http://192.168.2.50:8774/v1.1/1/flavors/1?fresh=1318734237.78'} {"flavor": {"rxtx_quota": 0, "name": "m1.tiny", "links": [{"href": "http://192.168.2.50:8774/v1.1/1/flavors/1", "rel": "self"}, {"href": "http://192.168.2.50:8774/1/flavors/1", "rel": "bookmark"}], "ram": 512, "vcpus": 1, "rxtx_cap": 0, "swap": 0, "disk": 0, "id": 1}}

RESP:{'date': 'Sun, 16 Oct 2011 03:03:57 GMT', 'status': '200', 'content-length': '268', 'content-type': 'application/json', 'content-location': u'http://192.168.2.50:8774/v1.1/1/flavors/1?fresh=1318734237.78'} {"flavor": {"rxtx_quota": 0, "name": "m1.tiny", "links": [{"href": "http://192.168.2.50:8774/v1.1/1/flavors/1", "rel": "self"}, {"href": "http://192.168.2.50:8774/1/flavors/1", "rel": "bookmark"}], "ram": 512, "vcpus": 1, "rxtx_cap": 0, "swap": 0, "disk": 0, "id": 1}}

RESP:{'date': 'Sun, 16 Oct 2011 03:03:57 GMT', 'status': '200', 'content-length': '268', 'content-type': 'application/json', 'content-location': u'http://192.168.2.50:8774/v1.1/1/flavors/1?fresh=1318734237.78'} {"flavor": {"rxtx_quota": 0, "name": "m1.tiny", "links": [{"href": "http://192.168.2.50:8774/v1.1/1/flavors/1", "rel": "self"}, {"href": "http://192.168.2.50:8774/1/flavors/1", "rel": "bookmark"}], "ram": 512, "vcpus": 1, "rxtx_cap": 0, "swap": 0, "disk": 0, "id": 1}}

REQ: curl -i http://192.168.2.50:8774/v1.1/1/images/2?fresh=1318734237.84 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "X-Auth-Token: 123123123"

REQ: curl -i http://192.168.2.50:8774/v1.1/1/images/2?fresh=1318734237.84 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "X-Auth-Token: 123123123"

REQ: curl -i http://192.168.2.50:8774/v1.1/1/images/2?fresh=1318734237.84 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "X-Auth-Token: 123123123"

REQ: curl -i http://192.168.2.50:8774/v1.1/1/images/2?fresh=1318734237.84 -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "X-Auth-Token: 123123123"

RESP:{'date': 'Sun, 16 Oct 2011 03:03:58 GMT', 'status': '200', 'content-length': '370', 'content-type': 'application/json', 'content-location': u'http://192.168.2.50:8774/v1.1/1/images/2?fresh=1318734237.84'} {"image": {"status": "ACTIVE", "updated": "2011-10-16T03:03:39Z", "name": "ttylinux-uec-amd64-11.2_2.6.35-15_1", "links": [{"href": "http://192.168.2.50:8774/v1.1/1/images/2", "rel": "self"}, {"href": "http://192.168.2.50:8774/1/images/2", "rel": "bookmark"}], "created": "2011-10-16T03:03:39Z", "progress": 100, "id": "2", "metadata": {"kernel_id": "1", "owner": "1"}}}

RESP:{'date': 'Sun, 16 Oct 2011 03:03:58 GMT', 'status': '200', 'content-length': '370', 'content-type': 'application/json', 'content-location': u'http://192.168.2.50:8774/v1.1/1/images/2?fresh=1318734237.84'} {"image": {"status": "ACTIVE", "updated": "2011-10-16T03:03:39Z", "name": "ttylinux-uec-amd64-11.2_2.6.35-15_1", "links": [{"href": "http://192.168.2.50:8774/v1.1/1/images/2", "rel": "self"}, {"href": "http://192.168.2.50:8774/1/images/2", "rel": "bookmark"}], "created": "2011-10-16T03:03:39Z", "progress": 100, "id": "2", "metadata": {"kernel_id": "1", "owner": "1"}}}

RESP:{'date': 'Sun, 16 Oct 2011 03:03:58 GMT', 'status': '200', 'content-length': '370', 'content-type': 'application/json', 'content-location': u'http://192.168.2.50:8774/v1.1/1/images/2?fresh=1318734237.84'} {"image": {"status": "ACTIVE", "updated": "2011-10-16T03:03:39Z", "name": "ttylinux-uec-amd64-11.2_2.6.35-15_1", "links": [{"href": "http://192.168.2.50:8774/v1.1/1/images/2", "rel": "self"}, {"href": "http://192.168.2.50:8774/1/images/2", "rel": "bookmark"}], "created": "2011-10-16T03:03:39Z", "progress": 100, "id": "2", "metadata": {"kernel_id": "1", "owner": "1"}}}

RESP:{'date': 'Sun, 16 Oct 2011 03:03:58 GMT', 'status': '200', 'content-length': '370', 'content-type': 'application/json', 'content-location': u'http://192.168.2.50:8774/v1.1/1/images/2?fresh=1318734237.84'} {"image": {"status": "ACTIVE", "updated": "2011-10-16T03:03:39Z", "name": "ttylinux-uec-amd64-11.2_2.6.35-15_1", "links": [{"href": "http://192.168.2.50:8774/v1.1/1/images/2", "rel": "self"}, {"href": "http://192.168.2.50:8774/1/images/2", "rel": "bookmark"}], "created": "2011-10-16T03:03:39Z", "progress": 100, "id": "2", "metadata": {"kernel_id": "1", "owner": "1"}}}