KeyError in _get_server_ip

Bug #1268274 reported by Avishay Traeger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Invalid
Undecided
Unassigned
tempest
Fix Released
Undecided
Armando Migliaccio

Bug Description

In gate-tempest-dsvm-neutron test:

2014-01-11 16:39:43.311 | Traceback (most recent call last):
2014-01-11 16:39:43.311 | File "tempest/scenario/test_cross_tenant_connectivity.py", line 482, in test_cross_tenant_traffic
2014-01-11 16:39:43.311 | self._test_in_tenant_block(self.demo_tenant)
2014-01-11 16:39:43.311 | File "tempest/scenario/test_cross_tenant_connectivity.py", line 380, in _test_in_tenant_block
2014-01-11 16:39:43.311 | ip=self._get_server_ip(server),
2014-01-11 16:39:43.311 | File "tempest/scenario/test_cross_tenant_connectivity.py", line 326, in _get_server_ip
2014-01-11 16:39:43.311 | return server.networks[network_name][0]
2014-01-11 16:39:43.312 | KeyError: u'network-smoke--tempest-1504528870'

http://logs.openstack.org/39/65039/4/gate/gate-tempest-dsvm-neutron/cb3457d/console.html

Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

This might be triggered by Neutron but there's no good excuse for Tempest to spit out a KeyError like this.

Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

Similar stacktrace:

Traceback (most recent call last):
  File "tempest/scenario/test_security_groups_basic_ops.py", line 173, in setUp
    self._verify_mac_addr(self.primary_tenant)
  File "tempest/scenario/test_security_groups_basic_ops.py", line 456, in _verify_mac_addr
    server_ip = self._get_server_ip(tenant.access_point)
  File "tempest/scenario/test_security_groups_basic_ops.py", line 324, in _get_server_ip
    return server.networks[network_name][0]
KeyError: u'network-smoke--2062576759'

Occurrence here:

http://logs.openstack.org/88/67288/15/gate/gate-tempest-dsvm-neutron-pg/d7a3cc5/logs/testr_results.html.gz

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tempest (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/75610

Changed in tempest:
status: New → In Progress
assignee: nobody → Armando Migliaccio (armando-migliaccio)
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :
Download full text (7.2 KiB)

I think this fails because when the server boots up, a call to Nova to show the Server details returns no network information:

RESP BODY: {"server": {"status": "ACTIVE", "updated": "2014-02-22T02:49:14Z", "hostId": "b6b929e9b38fe925dd96096914de11b6931941fbff8157352696bb07", "addresses": {}, "links": [{"href": "http://127.0.0.1:8774/v2/2889867c5b1e4e179468e0335bd7f60e/servers/56a1c377-ff6b-4b84-954c-e9bc7df34915", "rel": "self"}, {"href": "http://127.0.0.1:8774/2889867c5b1e4e179468e0335bd7f60e/servers/56a1c377-ff6b-4b84-954c-e9bc7df34915", "rel": "bookmark"}], "key_name": "keypair-smoke--1833441024", "image": {"id": "d6a7eadc-beb7-48ee-ac12-2c450822fba3", "links": [{"href": "http://127.0.0.1:8774/2889867c5b1e4e179468e0335bd7f60e/images/d6a7eadc-beb7-48ee-ac12-2c450822fba3", "rel": "bookmark"}]}, "OS-EXT-STS:task_state": null, "OS-EXT-STS:vm_state": "active", "OS-SRV-USG:launched_at": "2014-02-22T02:49:14.000000", "flavor": {"id": "42", "links": [{"href": "http://127.0.0.1:8774/2889867c5b1e4e179468e0335bd7f60e/flavors/42", "rel": "bookmark"}]}, "id": "56a1c377-ff6b-4b84-954c-e9bc7df34915", "security_groups": [{"name": "secgroup_access--1740712187"}, {"name": "secgroup_general--1734494704"}], "OS-SRV-USG:terminated_at": null, "OS-EXT-AZ:availability_zone": "nova", "user_id": "6dba13b494db45a2bf3748fd78561183", "name": "server-TestSecurityGroupsBasicOps-773273890-access_point--1654550048", "created": "2014-02-22T02:49:09Z", "tenant_id": "2889867c5b1e4e179468e0335bd7f60e", "OS-DCF:diskConfig": "MANUAL", "os-extended-volumes:volumes_attached": [], "accessIPv4": "", "accessIPv6": "", "progress": 0, "OS-EXT-STS:power_state": 1, "config_drive": "", "metadata": {}}}

See in particular:

"accessIPv4": "", "accessIPv6": "",

Looking at the nova-api log, it shows that the cache is updated with empty values:

2014-02-22 02:49:40.701 DEBUG nova.network.neutronv2.api [req-f2d4697c-81ac-4c86-bc81-9f214f8a1fef None None] get_instance_nw_info() for server-TestSecurityGroupsBasicOps-773273890-access_point--1654550048 _get_instance_nw_info /opt/stack/new/nova/nova/network/neutronv2/api.py:452
2014-02-22 02:49:40.702 10897 DEBUG neutronclient.client [-]
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-neutronclient" -d '{"auth": {"tenantName": "service", "passwordCredentials": {"username": "neutron", "password": "REDACTED"}}}'
 http_log_req /opt/stack/new/python-neutronclient/neutronclient/common/utils.py:173
2014-02-22 02:49:40.861 10897 DEBUG neutronclient.client [-] RESP:{'date': 'Sat, 22 Feb 2014 02:49:40 GMT', 'vary': 'X-Auth-Token', 'content-length': '11103', 'status': '200', 'content-type': 'application/json'} {"access": {"token": {"issued_at": "2014-02-22T02:49:40.805621", "expires": "2014-02-22T03:49:40Z", "id": PweI3glfY1abptlwkIYdQS0d4rl2VMwYhACyZZuM55INXOIOf57bvD0LvCd0rkItxtfEK4q-AQj4YLkc-V--t2Tl8u+ss523qxinHdNVv+806XQsE=" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient"
 http_log_req /opt/stack/new/python-neutronclient/neutronclient/common/utils.py:173
2014-02-22 02:49:41.044 10897 DEBUG neutronclient...

Read more...

Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

Ultimately this might be yet another manifestation of issues related to Neutron, Nova and instance cache

Revision history for this message
Matt Riedemann (mriedem) wrote :
tags: added: network testing
Revision history for this message
Matt Riedemann (mriedem) wrote :
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

Nice, thanks Matt!

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to tempest (master)

Reviewed: https://review.openstack.org/75610
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=d03f26409761a9a40222668e208bbf66016dd777
Submitter: Jenkins
Branch: master

commit d03f26409761a9a40222668e208bbf66016dd777
Author: armando-migliaccio <email address hidden>
Date: Fri Feb 21 19:55:50 2014 -0800

    Avoid masking an assert failure with a KeyError Exception

    This patch does not address the underlying issue as to
    why the key was not in the data dictionary, but it serves
    the purpose of getting a better error message due to the
    failure in meeting the pre-conditions to the test.

    Change-Id: I507a34456e8d047728bb7c1d1e5d189e3d00e7c1
    Related-bug: #1268274

Revision history for this message
Joe Gordon (jogo) wrote :

what is the nova issue here? the keyerror appears to becoming from tempest.

Changed in nova:
status: New → Incomplete
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

Joe, please refer to comment #6.

Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

This bug would've not manifested itself if it wasn't for Nova not reporting the port information correctly.

Changed in tempest:
status: In Progress → Fix Committed
Joe Gordon (jogo)
Changed in neutron:
status: New → Invalid
Revision history for this message
Aaron Rosen (arosen) wrote :
no longer affects: nova
Changed in tempest:
status: Fix Committed → Fix Released
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.