Fixes eventlet monotonic clock issue

The eventlet clock must be patched with the monotonic clock
in order to avoid issues caused by drifs of system time.

This is done in nova/__init__.py, but if compute-hyperv is
installed after nova, compute-hyperv will overwrite that
file.

Closes-Bug: #1749088

Change-Id: I0d32406a65d1f4d57435766d41a0f1c1efba2782
This commit is contained in:
Claudiu Belu 2018-02-08 21:44:59 -08:00
parent 19917084d3
commit 897321130a
2 changed files with 21 additions and 0 deletions

View File

@ -14,7 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import eventlet.hubs as hubs
import mock
import monotonic
from os_win import utilsfactory
from compute_hyperv.tests import test
@ -39,3 +41,11 @@ class HyperVBaseTestCase(test.NoDBTestCase):
'.'.join([class_type.__module__, class_type.__name__]),
mocked_class)
patcher.start()
class MonotonicTestCase(test.NoDBTestCase):
def test_monotonic(self):
import nova # noqa
hub = hubs.get_hub()
self.assertEqual(monotonic.monotonic, hub.clock)

View File

@ -13,3 +13,14 @@
# under the License.
__import__('pkg_resources').declare_namespace(__name__)
import os
os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
# NOTE(rpodolyaka): import oslo_service first, so that it makes eventlet hub
# use a monotonic clock to avoid issues with drifts of system time (see
# LP 1510234 for details)
import oslo_service # noqa
import eventlet # noqa