From c4aa8e97dfc95a663b2273478ea5105bad5358fd Mon Sep 17 00:00:00 2001 From: Luong Anh Tuan Date: Tue, 8 Nov 2016 13:57:22 +0700 Subject: [PATCH] Replaces uuid.uuid4 with uuidutils.generate_uuid() Openstack common has a wrapper for generating uuids.We should use that function when generating uuids for consistency. Change-Id: Ifab42440663323f43a7fdb5abe3887414f60602d Closes-Bug: #1082248 --- ironic/tests/unit/drivers/modules/test_pxe.py | 6 +++--- ironic/tests/unit/drivers/modules/test_seamicro.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ironic/tests/unit/drivers/modules/test_pxe.py b/ironic/tests/unit/drivers/modules/test_pxe.py index 3aa9ef3b5b..2849372987 100644 --- a/ironic/tests/unit/drivers/modules/test_pxe.py +++ b/ironic/tests/unit/drivers/modules/test_pxe.py @@ -19,13 +19,13 @@ import filecmp import os import shutil import tempfile -import uuid from ironic_lib import utils as ironic_utils import mock from oslo_config import cfg from oslo_serialization import jsonutils as json from oslo_utils import fileutils +from oslo_utils import uuidutils from ironic.common import boot_devices from ironic.common import dhcp_factory @@ -302,11 +302,11 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase): deploy_kernel, deploy_ramdisk] = [ 'swift_kernel', 'swift_ramdisk'] image_info = { - 'deploy_kernel': (str(uuid.uuid4()), + 'deploy_kernel': (uuidutils.generate_uuid(), os.path.join(root_dir, self.node.uuid, 'deploy_kernel')), - 'deploy_ramdisk': (str(uuid.uuid4()), + 'deploy_ramdisk': (uuidutils.generate_uuid(), os.path.join(root_dir, self.node.uuid, 'deploy_ramdisk')) diff --git a/ironic/tests/unit/drivers/modules/test_seamicro.py b/ironic/tests/unit/drivers/modules/test_seamicro.py index f2b2489cb2..c6651aca10 100644 --- a/ironic/tests/unit/drivers/modules/test_seamicro.py +++ b/ironic/tests/unit/drivers/modules/test_seamicro.py @@ -12,7 +12,6 @@ """Test class for Ironic SeaMicro driver.""" -import uuid import mock from oslo_utils import uuidutils @@ -68,7 +67,8 @@ class Fake_Server(object): class Fake_Volume(object): def __init__(self, id=None, *args, **kwargs): if id is None: - self.id = "%s/%s/%s" % ("0", "ironic-p6-6", str(uuid.uuid4())) + self.id = "%s/%s/%s" % ("0", "ironic-p6-6", + uuidutils.generate_uuid()) else: self.id = id