1 |
idella4 13/11/22 04:38:40 |
2 |
|
3 |
Added: neutron-2013.2-nicira.patch |
4 |
neutron-2013.2-sphinx_mapping.patch |
5 |
neutron-2013.2-json-tests.patch |
6 |
Log: |
7 |
Change -> openstack herd, Edit/correct Description, update test deps, add test phase to 2013.2*, testing support from (good ol') Chicago |
8 |
|
9 |
(Portage version: 2.2.0/cvs/Linux x86_64, signed Manifest commit with key 0xB8072B0D) |
10 |
|
11 |
Revision Changes Path |
12 |
1.1 sys-cluster/neutron/files/neutron-2013.2-nicira.patch |
13 |
|
14 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/neutron/files/neutron-2013.2-nicira.patch?rev=1.1&view=markup |
15 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/neutron/files/neutron-2013.2-nicira.patch?rev=1.1&content-type=text/plain |
16 |
|
17 |
Index: neutron-2013.2-nicira.patch |
18 |
=================================================================== |
19 |
https://review.openstack.org/gitweb?p=openstack%2Fneutron.git;a=commitdiff;h=a52ef6ecf19b8b015465ddda2a3ca087f0e12122 |
20 |
index 04dbfef..77f233a 100755 (executable) |
21 |
|
22 |
|
23 |
--- a/neutron/plugins/nicira/vshield/tasks/tasks.py |
24 |
+++ b/neutron/plugins/nicira/vshield/tasks/tasks.py |
25 |
@@ -15,8 +15,6 @@ |
26 |
# License for the specific language governing permissions and limitations |
27 |
# under the License. |
28 |
|
29 |
-from __future__ import print_function |
30 |
- |
31 |
import collections |
32 |
import uuid |
33 |
|
34 |
@@ -167,6 +165,9 @@ class TaskManager(): |
35 |
# A dict to store resource -> resource's tasks |
36 |
self._tasks = {} |
37 |
|
38 |
+ # Current task being executed in main thread |
39 |
+ self._main_thread_exec_task = None |
40 |
+ |
41 |
# New request event |
42 |
self._req = event.Event() |
43 |
|
44 |
@@ -311,8 +312,10 @@ class TaskManager(): |
45 |
continue |
46 |
|
47 |
try: |
48 |
+ self._main_thread_exec_task = task |
49 |
self._execute(task) |
50 |
finally: |
51 |
+ self._main_thread_exec_task = None |
52 |
if task.status is None: |
53 |
# The thread is killed during _execute(). To guarantee |
54 |
# the task been aborted correctly, put it to the queue. |
55 |
@@ -348,20 +351,19 @@ class TaskManager(): |
56 |
self._thread = None |
57 |
|
58 |
def has_pending_task(self): |
59 |
- if self._tasks_queue: |
60 |
- return True |
61 |
- |
62 |
- if self._tasks: |
63 |
+ if self._tasks_queue or self._tasks or self._main_thread_exec_task: |
64 |
return True |
65 |
- |
66 |
- return False |
67 |
+ else: |
68 |
+ return False |
69 |
|
70 |
def show_pending_tasks(self): |
71 |
for task in self._tasks_queue: |
72 |
- print(str(task)) |
73 |
+ LOG.info(str(task)) |
74 |
for resource, tasks in self._tasks.iteritems(): |
75 |
for task in tasks: |
76 |
- print(str(task)) |
77 |
+ LOG.info(str(task)) |
78 |
+ if self._main_thread_exec_task: |
79 |
+ LOG.info(str(self._main_thread_exec_task)) |
80 |
|
81 |
def count(self): |
82 |
count = 0 |
83 |
|
84 |
|
85 |
diff --git a/neutron/tests/unit/nicira/test_edge_router.py b/neutron/tests/unit/nicira/test_edge_router.py |
86 |
|
87 |
index 41efeed..a360b71 100644 (file) |
88 |
|
89 |
|
90 |
--- a/neutron/tests/unit/nicira/test_edge_router.py |
91 |
+++ b/neutron/tests/unit/nicira/test_edge_router.py |
92 |
@@ -135,7 +135,8 @@ class ServiceRouterTest(test_nicira_plugin.NiciraL3NatTest, |
93 |
def tearDown(self): |
94 |
plugin = NeutronManager.get_plugin() |
95 |
manager = plugin.vcns_driver.task_manager |
96 |
- for i in range(20): |
97 |
+ # wait max ~10 seconds for all tasks to be finished |
98 |
+ for i in range(100): |
99 |
if not manager.has_pending_task(): |
100 |
break |
101 |
greenthread.sleep(0.1) |
102 |
@@ -183,8 +184,8 @@ class ServiceRouterTestCase(ServiceRouterTest, NvpRouterTestCase): |
103 |
for k, v in expected_value_1: |
104 |
self.assertEqual(router['router'][k], v) |
105 |
|
106 |
- # wait ~1 seconds for router status update |
107 |
- for i in range(2): |
108 |
+ # wait max ~10 seconds for router status update |
109 |
+ for i in range(20): |
110 |
greenthread.sleep(0.5) |
111 |
res = self._show('routers', router['router']['id']) |
112 |
if res['router']['status'] == 'ACTIVE': |
113 |
|
114 |
|
115 |
diff --git a/neutron/tests/unit/nicira/test_vcns_driver.py b/neutron/tests/unit/nicira/test_vcns_driver.py |
116 |
|
117 |
index b0d69a4..ddc0c33 100644 (file) |
118 |
|
119 |
|
120 |
--- a/neutron/tests/unit/nicira/test_vcns_driver.py |
121 |
+++ b/neutron/tests/unit/nicira/test_vcns_driver.py |
122 |
@@ -253,6 +253,31 @@ class VcnsDriverTaskManagerTestCase(base.BaseTestCase): |
123 |
def test_task_manager_stop_4(self): |
124 |
self._test_task_manager_stop(False, False, 1) |
125 |
|
126 |
+ def test_task_pending_task(self): |
127 |
+ def _exec(task): |
128 |
+ task.userdata['executing'] = True |
129 |
+ while not task.userdata['tested']: |
130 |
+ greenthread.sleep(0) |
131 |
+ task.userdata['executing'] = False |
132 |
+ return TaskStatus.COMPLETED |
133 |
+ |
134 |
+ userdata = { |
135 |
+ 'executing': False, |
136 |
+ 'tested': False |
137 |
+ } |
138 |
+ manager = ts.TaskManager().start(100) |
139 |
+ task = ts.Task('name', 'res', _exec, userdata=userdata) |
140 |
+ manager.add(task) |
141 |
+ |
142 |
+ while not userdata['executing']: |
143 |
+ greenthread.sleep(0) |
144 |
+ self.assertTrue(manager.has_pending_task()) |
145 |
+ |
146 |
+ userdata['tested'] = True |
147 |
+ while userdata['executing']: |
148 |
+ greenthread.sleep(0) |
149 |
+ self.assertFalse(manager.has_pending_task()) |
150 |
+ |
151 |
|
152 |
class VcnsDriverTestCase(base.BaseTestCase): |
153 |
|
154 |
@@ -298,6 +323,10 @@ class VcnsDriverTestCase(base.BaseTestCase): |
155 |
self.edge_id = None |
156 |
self.result = None |
157 |
|
158 |
+ def tearDown(self): |
159 |
+ self.vcns_driver.task_manager.stop() |
160 |
+ super(VcnsDriverTestCase, self).tearDown() |
161 |
+ |
162 |
def _deploy_edge(self): |
163 |
task = self.vcns_driver.deploy_edge( |
164 |
'router-id', 'myedge', 'internal-network', {}, wait_for_exec=True) |
165 |
@@ -355,12 +384,13 @@ class VcnsDriverTestCase(base.BaseTestCase): |
166 |
self.assertTrue(jobdata.get('edge_deploy_result')) |
167 |
|
168 |
def test_deploy_edge_fail(self): |
169 |
- self.vcns_driver.deploy_edge( |
170 |
+ task1 = self.vcns_driver.deploy_edge( |
171 |
'router-1', 'myedge', 'internal-network', {}, wait_for_exec=True) |
172 |
- task = self.vcns_driver.deploy_edge( |
173 |
+ task2 = self.vcns_driver.deploy_edge( |
174 |
'router-2', 'myedge', 'internal-network', {}, wait_for_exec=True) |
175 |
- task.wait(TaskState.RESULT) |
176 |
- self.assertEqual(task.status, TaskStatus.ERROR) |
177 |
+ task1.wait(TaskState.RESULT) |
178 |
+ task2.wait(TaskState.RESULT) |
179 |
+ self.assertEqual(task2.status, TaskStatus.ERROR) |
180 |
|
181 |
def test_get_edge_status(self): |
182 |
self._deploy_edge() |
183 |
|
184 |
|
185 |
|
186 |
1.1 sys-cluster/neutron/files/neutron-2013.2-sphinx_mapping.patch |
187 |
|
188 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/neutron/files/neutron-2013.2-sphinx_mapping.patch?rev=1.1&view=markup |
189 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/neutron/files/neutron-2013.2-sphinx_mapping.patch?rev=1.1&content-type=text/plain |
190 |
|
191 |
Index: neutron-2013.2-sphinx_mapping.patch |
192 |
=================================================================== |
193 |
diff -ur neutron-2013.2.orig/doc/source/conf.py neutron-2013.2/doc/source/conf.py |
194 |
--- doc/source/conf.py 2013-10-17 22:01:20.000000000 +0800 |
195 |
+++ doc/source/conf.py 2013-11-15 19:42:42.701213324 +0800 |
196 |
@@ -238,12 +238,3 @@ |
197 |
|
198 |
# If false, no module index is generated. |
199 |
#latex_use_modindex = True |
200 |
- |
201 |
-# Example configuration for intersphinx: refer to the Python standard library. |
202 |
-intersphinx_mapping = {'python': ('http://docs.python.org/', None), |
203 |
- 'nova': ('http://nova.openstack.org', None), |
204 |
- 'swift': ('http://swift.openstack.org', None), |
205 |
- 'glance': ('http://glance.openstack.org', None), |
206 |
- 'horizon': ('http://horizon.openstack.org', None), |
207 |
- 'keystone': ('http://keystone.openstack.org', None), |
208 |
- } |
209 |
|
210 |
|
211 |
|
212 |
1.1 sys-cluster/neutron/files/neutron-2013.2-json-tests.patch |
213 |
|
214 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/neutron/files/neutron-2013.2-json-tests.patch?rev=1.1&view=markup |
215 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/neutron/files/neutron-2013.2-json-tests.patch?rev=1.1&content-type=text/plain |
216 |
|
217 |
Index: neutron-2013.2-json-tests.patch |
218 |
=================================================================== |
219 |
https://github.com/openstack/neutron/commit/d26dfed7d47926425bb55893da45f650d6549b9a |
220 |
diff --git a/neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py b/neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py |
221 |
index ba76786..fa2c2c0 100644 |
222 |
--- a/neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py |
223 |
+++ b/neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py |
224 |
@@ -97,11 +97,6 @@ def setUp(self): |
225 |
super(TestLinuxBridgeAgent, self).setUp() |
226 |
cfg.CONF.set_override('rpc_backend', |
227 |
'neutron.openstack.common.rpc.impl_fake') |
228 |
- self.lbmgr_patcher = mock.patch('neutron.plugins.linuxbridge.agent.' |
229 |
- 'linuxbridge_neutron_agent.' |
230 |
- 'LinuxBridgeManager') |
231 |
- self.lbmgr_mock = self.lbmgr_patcher.start() |
232 |
- self.addCleanup(self.lbmgr_patcher.stop) |
233 |
self.execute_p = mock.patch.object(ip_lib.IPWrapper, '_execute') |
234 |
self.execute = self.execute_p.start() |
235 |
self.addCleanup(self.execute_p.stop) |
236 |
@@ -113,8 +108,6 @@ def setUp(self): |
237 |
self.get_mac.return_value = '00:00:00:00:00:01' |
238 |
|
239 |
def test_update_devices_failed(self): |
240 |
- lbmgr_instance = self.lbmgr_mock.return_value |
241 |
- lbmgr_instance.update_devices.side_effect = RuntimeError |
242 |
agent = linuxbridge_neutron_agent.LinuxBridgeNeutronAgentRPC({}, |
243 |
0, |
244 |
None) |
245 |
@@ -125,17 +118,18 @@ def info_mock(msg): |
246 |
raise_exception[0] += 1 |
247 |
else: |
248 |
raise RuntimeError() |
249 |
- |
250 |
- with mock.patch.object(linuxbridge_neutron_agent.LOG, 'info') as log: |
251 |
- log.side_effect = info_mock |
252 |
- with testtools.ExpectedException(RuntimeError): |
253 |
- agent.daemon_loop() |
254 |
- self.assertEqual(3, log.call_count) |
255 |
+ with mock.patch.object(agent.br_mgr, |
256 |
+ "update_devices") as update_devices: |
257 |
+ update_devices.side_effect = RuntimeError |
258 |
+ with mock.patch.object(linuxbridge_neutron_agent.LOG, |
259 |
+ 'info') as log: |
260 |
+ log.side_effect = info_mock |
261 |
+ with testtools.ExpectedException(RuntimeError): |
262 |
+ agent.daemon_loop() |
263 |
+ self.assertEqual(3, log.call_count) |
264 |
|
265 |
def test_process_network_devices_failed(self): |
266 |
device_info = {'current': [1, 2, 3]} |
267 |
- lbmgr_instance = self.lbmgr_mock.return_value |
268 |
- lbmgr_instance.update_devices.return_value = device_info |
269 |
agent = linuxbridge_neutron_agent.LinuxBridgeNeutronAgentRPC({}, |
270 |
0, |
271 |
None) |
272 |
@@ -147,15 +141,18 @@ def info_mock(msg): |
273 |
else: |
274 |
raise RuntimeError() |
275 |
|
276 |
- with contextlib.nested( |
277 |
- mock.patch.object(linuxbridge_neutron_agent.LOG, 'info'), |
278 |
- mock.patch.object(agent, 'process_network_devices') |
279 |
- ) as (log, process_network_devices): |
280 |
- log.side_effect = info_mock |
281 |
- process_network_devices.side_effect = RuntimeError |
282 |
- with testtools.ExpectedException(RuntimeError): |
283 |
- agent.daemon_loop() |
284 |
- self.assertEqual(3, log.call_count) |
285 |
+ with mock.patch.object(agent.br_mgr, |
286 |
+ "update_devices") as update_devices: |
287 |
+ update_devices.side_effect = device_info |
288 |
+ with contextlib.nested( |
289 |
+ mock.patch.object(linuxbridge_neutron_agent.LOG, 'info'), |
290 |
+ mock.patch.object(agent, 'process_network_devices') |
291 |
+ ) as (log, process_network_devices): |
292 |
+ log.side_effect = info_mock |
293 |
+ process_network_devices.side_effect = RuntimeError |
294 |
+ with testtools.ExpectedException(RuntimeError): |
295 |
+ agent.daemon_loop() |
296 |
+ self.assertEqual(3, log.call_count) |
297 |
|
298 |
|
299 |
class TestLinuxBridgeManager(base.BaseTestCase): |