run ServersTestManualDisk setUpClass failed

Bug #1596456 reported by miaoyimin
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Expired
Low
Unassigned

Bug Description

run ServersTestManualDisk setUpClass failed,the exception is as follows:
FAIL: setUpClass (tempest.api.compute.servers.test_create_server.ServersTestManualDisk)
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Traceback (most recent call last):
File "/home/defcore/refstack-client-master/.tempest/tempest/test.py", line 274, in setUpClass
six.reraise(etype, value, trace)
File "/home/defcore/refstack-client-master/.tempest/tempest/test.py", line 267, in setUpClass
cls.resource_setup()
File "/home/defcore/refstack-client-master/.tempest/tempest/api/compute/servers/test_create_server.py", line 51, in resource_setup
super(ServersTestJSON, cls).resource_setup()
File "/home/defcore/refstack-client-master/.tempest/tempest/api/compute/base.py", line 99, in resource_setup
super(BaseComputeTest, cls).resource_setup()
File "/home/defcore/refstack-client-master/.tempest/tempest/test.py", line 387, in resource_setup
cls.os, cls.validation_resources)
File "/home/defcore/refstack-client-master/.tempest/tempest/common/validation_resources.py", line 56, in create_validation_resources
if validation_resources['security_group_rules']:
KeyError: 'security_group_rules'

the test cases list are as follows:
......
tempest.api.compute.servers.test_create_server.ServersTestJSON.test_list_servers[id-9a438d88-10c6-4bcd-8b5b-5b6e25e1346f]
tempest.api.compute.servers.test_create_server.ServersTestJSON.test_list_servers_with_detail[id-585e934c-448e-43c4-acbf-d06a9b899997]
tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_list_servers[id-9a438d88-10c6-4bcd-8b5b-5b6e25e1346f]
tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_list_servers_with_detail[id-585e934c-448e-43c4-acbf-d06a9b899997]
......

first test case test_list_servers_with_detail run failed because of to build server failed, log is as follows:

2016-06-26 11:16:59.044 4098 INFO tempest_lib.common.rest_client [req-e0cac365-614b-40ea-9eb8-6b47b1cfb071 ] Request (ServersTestJSON:setUpClass): 204 DELETE https://ecs.eu-de.otc.t-systems.com/v2/59297a5a26ea42d2adc69112e8f6d853/servers/bb911aa2-45a2-4123-b6c5-d19678d26180 0.356s
2016-06-26 11:16:59.045 4098 INFO tempest.test [-] <class 'tempest.exceptions.BuildErrorException'> raised in ServersTestJSON.setUpClass. Invoking tearDownClass.
2016-06-26 11:16:59.357 4098 ERROR tempest_lib.common.rest_client [-] body is {'status': '400', 'content-length': '103', 'x-xss-protection': '1; mode=block', 'x-download-options': 'noopen', 'x-content-type-options': 'nosniff', 'x-compute-request-id': 'req-0259dc07-80e4-45e3-a5a9-8c7a2eaee957', 'server': 'Web Server', 'connection': 'close', 'cache-control': 'no-cache', 'date': 'Sun, 26 Jun 2016 03:17:01 GMT', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'application/json; charset=UTF-8'}
2016-06-26 11:16:59.358 4098 ERROR tempest_lib.common.rest_client [-] body is {"badRequest": {"message": "Security Group 77d003f0-55a7-4758-b910-38e756cd17dc in use.", "code": 400}}
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources [-] Exception raised while deleting security group 77d003f0-55a7-4758-b910-38e756cd17dc
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources Traceback (most recent call last):
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources File "/home/defcore/refstack-client-master/.tempest/tempest/common/validation_resources.py", line 87, in clear_validation_resources
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources security_group_client.delete_security_group(sec_id)
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources File "/home/defcore/refstack-client-master/.tempest/tempest/services/compute/json/security_groups_client.py", line 75, in delete_security_group
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources 'os-security-groups/%s' % security_group_id)
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources File "/home/defcore/refstack-client-master/.tempest/.venv/local/lib/python2.7/site-packages/tempest_lib/common/rest_client.py", line 290, in delete
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources return self.request('DELETE', url, extra_headers, headers, body)
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources File "/home/defcore/refstack-client-master/.tempest/.venv/local/lib/python2.7/site-packages/tempest_lib/common/rest_client.py", line 646, in request
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources resp, resp_body)
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources File "/home/defcore/refstack-client-master/.tempest/.venv/local/lib/python2.7/site-packages/tempest_lib/common/rest_client.py", line 704, in _error_checker
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources raise exceptions.BadRequest(resp_body, resp=resp)
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources BadRequest: Bad request
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources Details: {u'message': u'Security Group 77d003f0-55a7-4758-b910-38e756cd17dc in use.', u'code': 400}
2016-06-26 11:16:59.358 4098 ERROR tempest.common.validation_resources

when build server faild, test deletes the server without waiting the server to be deleted. then in tearDownClass will delete the Security Group failed as shown above.in the function resource_cleanup of file test.py.

    @classmethod
    def resource_cleanup(cls):
        """Class level resource cleanup for test cases.
        Resource cleanup must be able to handle the case of partially setup
        resources, in case a failure during `resource_setup` should happen.
        """
        if cls.validation_resources:
            if hasattr(cls, "os"):
                vresources.clear_validation_resources(cls.os,
                                                      cls.validation_resources) --here will raise exception when delete Security Group failed.
                cls.validation_resources = {} --here cls.validation_resources will be left and effect the ServersTestManualDisk.setUpClass
            else:
                LOG.warn("Client manager not found, validation resources not"
                         " deleted")

Revision history for this message
Andrea Frittoli (andrea-frittoli) wrote :

I think the problem lies in the implementation of the clear_servers method (http://git.openstack.org/cgit/openstack/tempest/tree/tempest/api/compute/base.py#n134).
There is no distinction between a server that is in ERROR state before delete is attempted and a server that gets into the ERROR state as a consequence of an attempted delete.

In case the state was ERROR to begin with, it could try to delete the server until the timeout is reached, so that, if successful, the subsequent SG deletion would go through.

Note though that even in that case, the test case would still fail, because of the original server creation error; the only difference is that logging would be clearer and easier to read, since there would be no SG group deletion exception.

Note that it is also possible that a server in ERROR state cannot be deleted. In such case the SG deletion would fail same as in your example above.

Since all the relevant logging information is in the log, but there is currently some extra one which is confusing, I will keep the priority of this issue rather low.

Changed in tempest:
status: New → Confirmed
importance: Undecided → Medium
importance: Medium → Low
Revision history for this message
Martin Kopec (mkopec) wrote :

Is this still a valid issue? There has been no activity for more than 4 years. The tempest codebase has changed significantly since then - there is no line containing "validation_resources['security_group_rules']", also there is no file tempest/common/validation_resources.py ...

Therefore I'm marking this as Incomplete for now. If you still experience the issue, please provide new info and feel free to reopen this again.

Changed in tempest:
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for tempest because there has been no activity for 60 days.]

Changed in tempest:
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.