diff --git a/nova/virt/zun/driver.py b/nova/virt/zun/driver.py index 2b8a822f2..fec2f4642 100644 --- a/nova/virt/zun/driver.py +++ b/nova/virt/zun/driver.py @@ -22,7 +22,6 @@ import os import shutil import socket import time -import uuid from docker import errors import eventlet @@ -31,6 +30,7 @@ from oslo_log import log from oslo_utils import fileutils from oslo_utils import importutils from oslo_utils import units +from oslo_utils import uuidutils from oslo_utils import versionutils from nova.compute import flavors @@ -393,7 +393,8 @@ class DockerDriver(driver.ComputeDriver): fileutils.ensure_tree(snapshot_directory) with utils.tempdir(dir=snapshot_directory) as tmpdir: try: - out_path = os.path.join(tmpdir, uuid.uuid4().hex) + out_path = os.path.join(tmpdir, + uuidutils.generate_uuid(dashed=False)) LOG.debug('Fetching image with id %s from glance', image_meta.id) diff --git a/zun/common/short_id.py b/zun/common/short_id.py index 6894ffdb9..29750585c 100644 --- a/zun/common/short_id.py +++ b/zun/common/short_id.py @@ -16,6 +16,7 @@ The IDs each comprise 12 (lower-case) alphanumeric characters. """ import base64 +from oslo_utils import uuidutils import uuid import six @@ -60,4 +61,4 @@ def get_id(source_uuid): def generate_id(): """Generate a short (12 character), random id.""" - return get_id(uuid.uuid4()) + return uuidutils.generate_uuid()