diff --git a/nova/tests/hyperv/db_fakes.py b/nova/tests/hyperv/db_fakes.py index 9f5572fd1..e240483ea 100644 --- a/nova/tests/hyperv/db_fakes.py +++ b/nova/tests/hyperv/db_fakes.py @@ -19,6 +19,7 @@ Stubouts, mocks and fixtures for the test suite """ import time +import uuid from nova.compute import task_states from nova.compute import vm_states @@ -29,7 +30,7 @@ from nova import utils def get_fake_instance_data(name, project_id, user_id): return {'name': name, 'id': 1, - 'uuid': utils.gen_uuid(), + 'uuid': uuid.uuid4(), 'project_id': project_id, 'user_id': user_id, 'image_ref': "1", @@ -124,7 +125,7 @@ def stub_out_db_instance_api(stubs): base_options = { 'name': values['name'], 'id': values['id'], - 'uuid': utils.gen_uuid(), + 'uuid': uuid.uuid4(), 'reservation_id': utils.generate_uid('r'), 'image_ref': values['image_ref'], 'kernel_id': values['kernel_id'], diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index 001880483..39d3e1b1f 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -20,6 +20,7 @@ """Unit tests for the DB API""" import datetime +import uuid as uuidutils from nova import config from nova import context @@ -29,7 +30,7 @@ from nova import flags from nova.openstack.common import timeutils from nova import test from nova.tests import matchers -from nova import utils + CONF = config.CONF CONF.import_opt('reserved_host_memory_mb', 'nova.compute.resource_tracker') @@ -145,7 +146,7 @@ class DbApiTestCase(test.TestCase): self.assertRaises(exception.MarkerNotFound, db.instance_get_all_by_filters, self.context, {'display_name': '%test%'}, - marker=str(utils.gen_uuid())) + marker=str(uuidutils.uuid4())) def test_migration_get_unconfirmed_by_dest_compute(self): ctxt = context.get_admin_context() @@ -286,7 +287,7 @@ class DbApiTestCase(test.TestCase): def test_instance_fault_create(self): """Ensure we can create an instance fault""" ctxt = context.get_admin_context() - uuid = str(utils.gen_uuid()) + uuid = str(uuidutils.uuid4()) # Create a fault fault_values = { diff --git a/nova/tests/vmwareapi/db_fakes.py b/nova/tests/vmwareapi/db_fakes.py index a469c4706..dd19f4929 100644 --- a/nova/tests/vmwareapi/db_fakes.py +++ b/nova/tests/vmwareapi/db_fakes.py @@ -20,6 +20,7 @@ Stubouts, mocks and fixtures for the test suite """ import time +import uuid from nova.compute import task_states from nova.compute import vm_states @@ -62,7 +63,7 @@ def stub_out_db_instance_api(stubs): base_options = { 'name': values['name'], 'id': values['id'], - 'uuid': utils.gen_uuid(), + 'uuid': uuid.uuid4(), 'reservation_id': utils.generate_uid('r'), 'image_ref': values['image_ref'], 'kernel_id': values['kernel_id'], diff --git a/nova/utils.py b/nova/utils.py index 5f78b93da..7ee58bdd8 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -37,7 +37,6 @@ import struct import sys import tempfile import time -import uuid import weakref from xml.sax import saxutils @@ -776,10 +775,6 @@ def parse_server_string(server_str): return ('', '') -def gen_uuid(): - return uuid.uuid4() - - def bool_from_str(val): """Convert a string representation of a bool into a bool value"""