]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
BigSwitch: Use eventlet.sleep in watchdog
authorKevin Benton <blak111@gmail.com>
Thu, 13 Mar 2014 00:47:28 +0000 (17:47 -0700)
committerKevin Benton <blak111@gmail.com>
Thu, 13 Mar 2014 00:48:53 +0000 (17:48 -0700)
Changes the consistency watchdog that runs
in the background to use eventlet.sleep instead
of time.sleep to avoid blocking other members of
the same pool.

Closes-Bug: #1291695
Change-Id: I5ec842cca1063cef761c2cd09d63617baf27d191

neutron/plugins/bigswitch/servermanager.py
neutron/tests/unit/bigswitch/test_servermanager.py

index 5efafed7e5f4f208269d286d59b57b6100b91d0d..86b087f97dee8cd2d8c14e0bb503d9639e7ea11b 100644 (file)
@@ -37,7 +37,6 @@ import json
 import os
 import socket
 import ssl
-import time
 
 import eventlet
 from oslo.config import cfg
@@ -551,7 +550,7 @@ class ServerPool(object):
             # rest call and the consistency header will be added. If it
             # doesn't match, the backend will return a synchronization error
             # that will be handled by the rest_call.
-            time.sleep(polling_interval)
+            eventlet.sleep(polling_interval)
             self.rest_call('GET', HEALTH_PATH)
 
 
index e09858cdc2e29c81fbe48faab19e5371ff44377c..18e63f3df700a7cfb586aafe65188144363c7d38 100644 (file)
@@ -54,7 +54,7 @@ class ServerManagerTests(test_rp.BigSwitchProxyPluginV2TestCase):
         pl.servers.capabilities = []
         self.watch_p.stop()
         with nested(
-            mock.patch('time.sleep'),
+            mock.patch('eventlet.sleep'),
             mock.patch(
                 SERVERMANAGER + '.ServerPool.rest_call',
                 side_effect=servermanager.RemoteRestError(