Remove gen_uuid()

Removed gen_uuid and uuid related unittests
Replaced utils.gen_uuid() with uuid.uuid4()

Change-Id: I3020a0d67525eb73cfb8873d2570c93e2022bb76
This commit is contained in:
Zhongyue Luo 2012-11-14 18:25:59 +08:00
parent a9f2d3fac8
commit 67106d4d03
4 changed files with 9 additions and 11 deletions

View File

@ -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'],

View File

@ -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 = {

View File

@ -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'],

View File

@ -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"""