yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #62073
[Bug 1668828] Re: ip filtering short circuits based on regex
Reviewed: https://review.openstack.org/439428
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=7d8f7c5669f42178ae47aa1a6446eda42910a390
Submitter: Jenkins
Branch: master
commit 7d8f7c5669f42178ae47aa1a6446eda42910a390
Author: zhufl <zhu.fanglei@xxxxxxxxxx>
Date: Wed Mar 1 15:41:41 2017 +0800
Correct test_list_servers_filtered_by_ip for bug 1668828"
test_list_servers_filtered_by_ip will fail occasionally, because
now on Nova side filter by ip is always "regexp match",
https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/schemas/servers.py#L355
so if server1's ip is "10.1.1.1" and servers2's ip is "10.1.1.10",
filter by server1's ip "10.1.1.1" will get both servers in the list.
This is to use the longest ip for the filter, i.e., if server1's
ip is "10.1.1.1" and server2's ip is "10.1.1.10", then we should use
"10.1.1.10" for the filter, so to ensure only one server is returned
in the list.
Change-Id: I87c325cb80a95861287c54fbd1b5718cfb9ef310
Closes-Bug: #1668828
** Changed in: tempest
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1668828
Title:
ip filtering short circuits based on regex
Status in OpenStack Compute (nova):
Invalid
Status in tempest:
Fix Released
Bug description:
1. Problem:
test_list_servers_filtered_by_ip sometimes fails with:
Traceback (most recent call last):
File "/home/zfl/tempest_m_git_local/tempest/api/compute/servers/test_list_server_filters.py", line 284, in test_list_servers_filtered_by_ip
self.assertNotIn(self.s2_name, map(lambda x: x['name'], servers))
File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 392, in assertNotIn
self.assertThat(haystack, matcher, message)
File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 433, in assertThat
raise mismatch_error
MismatchError: [u'tempest-ListServerFiltersTestJSON-instance-328761420'] matches Contains('tempest-ListServerFiltersTestJSON-instance-328761420')
2. Reason:
We can see from nova code that filter by ip is always "regexp match",
so if server2' ip happened to be part of server1's ip, then filter by
server1's ip will also return server2.
https://github.com/openstack/nova/blob/63805735c25a54ad1b9b97e05080c1a6153d8e22/nova/compute/api.py
get_all
3. Solution:
There are 3 possibles ways,
1) create servers with specified ips, such as 1.1.1.1, 1.1.1.2, 1.1.1.3
2) find the longest ip in servers, and filter it by that ip, then only
one server will be returned
3) filter using server1's ip, and using assertIn or assertNotIn according
to whether other server ip is part of server1's ip
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1668828/+subscriptions