Bug 893449

Summary: "nova network-list" command fails with exception
Product: Red Hat OpenStack Reporter: Rami Vaknin <rvaknin>
Component: openstack-novaAssignee: Nikola Dipanov <ndipanov>
Status: CLOSED ERRATA QA Contact: Rami Vaknin <rvaknin>
Severity: high Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: eglynn, fpercoco, jlabocki, ndipanov, oblaut, pbrady, rbryant, yeylon
Target Milestone: snapshot2Keywords: Triaged
Target Release: 2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-nova-2012.2.2-9.el6ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-14 13:24:41 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Rami Vaknin 2013-01-09 06:10:01 EST
Description of problem:
I found an identical bug in launchpad.net: https://bugs.launchpad.net/nova/+bug/1089430, but it looks like it's not going to be fixed for Folsom.

"nova network-list" command always fails in my environment, it looks like the code tries to access list in a manner it should access a dictionary.

Version-Release number of selected component (if applicable):
Folsom on RHEL6.4
qpid-cpp-server-0.14-22.el6_3.x86_64
python-qpid-0.14-11.el6_3.noarch
qpid-cpp-client-0.14-22.el6_3.x86_64
openstack-nova-console-2012.2.1-2.el6ost.noarch
openstack-nova-objectstore-2012.2.1-2.el6ost.noarch
openstack-utils-2012.2-6.el6.noarch
openstack-nova-api-2012.2.1-2.el6ost.noarch
openstack-nova-network-2012.2.1-2.el6ost.noarch
openstack-nova-volume-2012.2.1-2.el6ost.noarch
openstack-nova-cert-2012.2.1-2.el6ost.noarch
openstack-nova-2012.2.1-2.el6ost.noarch
python-django-openstack-auth-1.0.2-3.1.el6.noarch
openstack-dashboard-2012.2.1-2.el6ost.noarch
openstack-keystone-2012.2.1-1.el6ost.noarch
openstack-cinder-2012.2.1-1.el6ost.noarch
openstack-nova-common-2012.2.1-2.el6ost.noarch
openstack-nova-compute-2012.2.1-2.el6ost.noarch
openstack-nova-scheduler-2012.2.1-2.el6ost.noarch
openstack-nova-novncproxy-0.4-2.el6.noarch
openstack-glance-2012.2.1-1.el6ost.noarch

How reproducible:
Always

Steps to Reproduce:
1. Run "nova network-list"

Additional info:
$ ifconfig
demonetbr0 Link encap:Ethernet  HWaddr 00:9C:02:B0:8F:E8  
          inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::581a:e8ff:fe1c:a383/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3237826 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33476 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:152396794 (145.3 MiB)  TX bytes:104775431 (99.9 MiB)

eth2      Link encap:Ethernet  HWaddr 00:9C:02:B0:8F:E8  
          inet6 addr: fe80::29c:2ff:feb0:8fe8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3966709 errors:0 dropped:3 overruns:0 frame:0
          TX packets:444543 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1109739576 (1.0 GiB)  TX bytes:136684123 (130.3 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:310193 errors:0 dropped:0 overruns:0 frame:0
          TX packets:310193 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1469940824 (1.3 GiB)  TX bytes:1469940824 (1.3 GiB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:42:62:BA  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

vnet0     Link encap:Ethernet  HWaddr FE:16:3E:68:CF:CA  
          inet6 addr: fe80::fc16:3eff:fe68:cfca/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4280 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3183013 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:703024 (686.5 KiB)  TX bytes:192968243 (184.0 MiB)
Comment 3 Rami Vaknin 2013-01-10 03:38:08 EST
Oops, I forgot to paste the exception itself, so here it is:

$ nova network-list
ERROR: string indices must be integers, not str


$ nova --debug network-list

REQ: curl -i http://127.0.0.1:35357/v2.0/tokens -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-novaclient" -d '{"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "123456"}}}'

connect: (127.0.0.1, 35357)
send: 'POST /v2.0/tokens HTTP/1.1\r\nHost: 127.0.0.1:35357\r\nContent-Length: 101\r\ncontent-type: application/json\r\naccept-encoding: gzip, deflate\r\naccept: application/json\r\nuser-agent: python-novaclient\r\n\r\n'
send: '{"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "123456"}}}'
reply: 'HTTP/1.1 200 OK\r\n'
header: Vary: X-Auth-Token
header: Content-Type: application/json
header: Content-Length: 1725
header: Date: Thu, 10 Jan 2013 08:35:41 GMT
RESP:{'date': 'Thu, 10 Jan 2013 08:35:41 GMT', 'vary': 'X-Auth-Token', 'content-length': '1725', 'status': '200', 'content-type': 'application/json'} {"access": {"token": {"expires": "2013-01-11T08:35:40Z", "id": "effaf1f4730146ac911074a3abb0c93e", "tenant": {"enabled": true, "description": null, "name": "admin", "id": "be474fa6381e4c88bf8fabad819f1993"}}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://127.0.0.1:8776/v1/be474fa6381e4c88bf8fabad819f1993", "region": "regionOne", "internalURL": "http://127.0.0.1:8776/v1/be474fa6381e4c88bf8fabad819f1993", "id": "095e6069a5754a2a9782165aae056be6", "publicURL": "http://127.0.0.1:8776/v1/be474fa6381e4c88bf8fabad819f1993"}], "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": [{"adminURL": "http://127.0.0.1:9292/v1", "region": "regionOne", "internalURL": "http://127.0.0.1:9292/v1", "id": "6fd3358c203941c79940646ed373aaef", "publicURL": "http://127.0.0.1:9292/v1"}], "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://127.0.0.1:8774/v1.1/be474fa6381e4c88bf8fabad819f1993", "region": "regionOne", "internalURL": "http://127.0.0.1:8774/v1.1/be474fa6381e4c88bf8fabad819f1993", "id": "e61e7a8e9e0248488426724c71b0299e", "publicURL": "http://127.0.0.1:8774/v1.1/be474fa6381e4c88bf8fabad819f1993"}], "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://127.0.0.1:35357/v2.0", "region": "RegionOne", "internalURL": "http://127.0.0.1:5000/v2.0", "id": "cfe16a46634641d6b87447d94dfc9f31", "publicURL": "http://127.0.0.1:5000/v2.0"}], "endpoints_links": [], "type": "identity", "name": "keystone"}], "user": {"username": "admin", "roles_links": [], "id": "4ab980878b5242d4a70331ce20581967", "roles": [{"name": "admin"}], "name": "admin"}, "metadata": {"is_admin": 0, "roles": ["3340e929829e4e6e8b2ab4a8795d62b1"]}}}


REQ: curl -i http://127.0.0.1:8774/v1.1/be474fa6381e4c88bf8fabad819f1993/os-networks -X GET -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: effaf1f4730146ac911074a3abb0c93e"

connect: (127.0.0.1, 8774)
send: u'GET /v1.1/be474fa6381e4c88bf8fabad819f1993/os-networks HTTP/1.1\r\nHost: 127.0.0.1:8774\r\nx-auth-project-id: admin\r\nx-auth-token: effaf1f4730146ac911074a3abb0c93e\r\naccept-encoding: gzip, deflate\r\naccept: application/json\r\nuser-agent: python-novaclient\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: X-Compute-Request-Id: req-f521a89e-f1cf-41c4-8f88-ebac8d78bfc9
header: Content-Type: application/json
header: Content-Length: 700
header: Date: Thu, 10 Jan 2013 08:35:41 GMT
RESP:{'status': '200', 'content-length': '700', 'content-location': u'http://127.0.0.1:8774/v1.1/be474fa6381e4c88bf8fabad819f1993/os-networks', 'x-compute-request-id': 'req-f521a89e-f1cf-41c4-8f88-ebac8d78bfc9', 'date': 'Thu, 10 Jan 2013 08:35:41 GMT', 'content-type': 'application/json'} {"networks": [{"bridge": "demonetbr0", "vpn_public_port": null, "dhcp_start": "10.0.0.2", "bridge_interface": "em1", "updated_at": timestamp(1357646484.0), "id": "b7cd615b-4c37-4aa0-8cb0-220c3bb3f6f7", "cidr_v6": null, "deleted_at": null, "gateway": "10.0.0.1", "rxtx_base": null, "label": "demonet", "priority": null, "project_id": null, "vpn_private_address": null, "deleted": false, "vlan": null, "broadcast": "10.0.0.255", "netmask": "255.255.255.0", "injected": false, "cidr": "10.0.0.0/24", "vpn_public_address": null, "multi_host": false, "dns2": null, "created_at": timestamp(1357571920.0), "host": "puma39.scl.lab.tlv.redhat.com", "gateway_v6": null, "netmask_v6": null, "dns1": "8.8.4.4"}]}

DEBUG (shell:543) string indices must be integers, not str
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 540, in main
    OpenStackComputeShell().main(sys.argv[1:])
  File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 476, in main
    args.func(self.cs, args)
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/shell.py", line 501, in do_network_list
    network_list = cs.networks.list()
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/networks.py", line 49, in list
    return self._list("/os-networks", "networks")
  File "/usr/lib/python2.6/site-packages/novaclient/base.py", line 67, in _list
    data = body[response_key]
TypeError: string indices must be integers, not str
ERROR: string indices must be integers, not str
Comment 7 Rami Vaknin 2013-02-03 04:03:14 EST
Verified on openstack-nova-2012.2.2-9.el6ost
Comment 8 Brent Eagles 2013-02-12 12:36:55 EST
*** Bug 908514 has been marked as a duplicate of this bug. ***
Comment 10 errata-xmlrpc 2013-02-14 13:24:41 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0260.html