Use uuidutils instead of uuid.uuid4()
Openstack common has a wrapper for generating uuids.We should use that function when generating uuids for consistency. Replaces uuid.uuid4 with uuidutils.generate_uuid() Change-Id: I7687b9ce8ef76ea9e670dca10006476735fca475
This commit is contained in:
parent
b9e21fdd77
commit
86eb9e8dce
@ -22,7 +22,6 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
import uuid
|
|
||||||
|
|
||||||
from docker import errors
|
from docker import errors
|
||||||
import eventlet
|
import eventlet
|
||||||
@ -31,6 +30,7 @@ from oslo_log import log
|
|||||||
from oslo_utils import fileutils
|
from oslo_utils import fileutils
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from oslo_utils import versionutils
|
from oslo_utils import versionutils
|
||||||
|
|
||||||
from nova.compute import flavors
|
from nova.compute import flavors
|
||||||
@ -393,7 +393,8 @@ class DockerDriver(driver.ComputeDriver):
|
|||||||
fileutils.ensure_tree(snapshot_directory)
|
fileutils.ensure_tree(snapshot_directory)
|
||||||
with utils.tempdir(dir=snapshot_directory) as tmpdir:
|
with utils.tempdir(dir=snapshot_directory) as tmpdir:
|
||||||
try:
|
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',
|
LOG.debug('Fetching image with id %s from glance',
|
||||||
image_meta.id)
|
image_meta.id)
|
||||||
|
@ -16,6 +16,7 @@ The IDs each comprise 12 (lower-case) alphanumeric characters.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
from oslo_utils import uuidutils
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import six
|
import six
|
||||||
@ -60,4 +61,4 @@ def get_id(source_uuid):
|
|||||||
|
|
||||||
def generate_id():
|
def generate_id():
|
||||||
"""Generate a short (12 character), random id."""
|
"""Generate a short (12 character), random id."""
|
||||||
return get_id(uuid.uuid4())
|
return uuidutils.generate_uuid()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user