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: Ide5cdaf48a27e9c080fd8691b100a601f82ca2bf Closes-Bug: #1082248
This commit is contained in:
parent
829a3b6ac2
commit
0c8f5ae305
|
@ -19,10 +19,10 @@ import json
|
|||
import os
|
||||
import signal
|
||||
import socket
|
||||
import uuid
|
||||
|
||||
from freezerclient import exceptions
|
||||
from oslo_log import log
|
||||
from oslo_utils import uuidutils
|
||||
import psutil
|
||||
|
||||
|
||||
|
@ -83,7 +83,8 @@ def get_jobs_from_disk(path):
|
|||
load_doc_from_json_file(f) for f in find_config_files(path)]
|
||||
for job_doc in job_doc_list:
|
||||
if job_doc:
|
||||
job_doc['job_id'] = job_doc.get('job_id', uuid.uuid4().hex)
|
||||
job_doc['job_id'] = job_doc.get('job_id', uuidutils.generate_uuid(
|
||||
dashed=False))
|
||||
return [x for x in job_doc_list if x]
|
||||
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ Freezer LVM related functions
|
|||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import uuid
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from freezer.common import config as freezer_config
|
||||
from freezer.utils import utils
|
||||
|
@ -92,7 +92,7 @@ def lvm_snap(backup_opt_dict):
|
|||
:param backup_opt_dict: the configuration dict
|
||||
:return: True if the snapshot has been taken, False otherwise
|
||||
"""
|
||||
lvm_uuid = uuid.uuid4().hex
|
||||
lvm_uuid = uuidutils.generate_uuid(dashed=False)
|
||||
|
||||
if not backup_opt_dict.lvm_snapname:
|
||||
backup_opt_dict.lvm_snapname = \
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
import os
|
||||
import shutil
|
||||
import uuid
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from tempest import test
|
||||
|
||||
from freezer.tests.freezer_tempest_plugin.tests.api import base
|
||||
|
@ -28,7 +28,7 @@ class TestFreezerFSBackup(base.BaseFreezerTest):
|
|||
def setUp(self):
|
||||
super(TestFreezerFSBackup, self).setUp()
|
||||
|
||||
test_id = uuid.uuid4().hex
|
||||
test_id = uuidutils.generate_uuid(dashed=False)
|
||||
|
||||
self.backup_source_dir = (
|
||||
"/tmp/freezer-test-backup-source/" + test_id
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
import os
|
||||
import shutil
|
||||
import uuid
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from tempest import test
|
||||
|
||||
from freezer.tests.freezer_tempest_plugin.tests.api import base
|
||||
|
@ -28,7 +28,7 @@ class TestFreezerSwiftBackup(base.BaseFreezerTest):
|
|||
def setUp(self):
|
||||
super(TestFreezerSwiftBackup, self).setUp()
|
||||
|
||||
test_id = uuid.uuid4().hex
|
||||
test_id = uuidutils.generate_uuid(dashed=False)
|
||||
|
||||
self.backup_source_dir = (
|
||||
"/tmp/freezer-test-backup-source/" + test_id
|
||||
|
|
|
@ -17,7 +17,8 @@ from copy import copy
|
|||
import json
|
||||
import os
|
||||
import unittest
|
||||
import uuid
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from freezer.tests.integration import common
|
||||
|
||||
|
@ -64,7 +65,7 @@ class TestBackupFSLocalstorage(common.TestFS):
|
|||
'storage': 'local',
|
||||
'max_level': '6',
|
||||
'max_segment_size': '67108864',
|
||||
'backup_name': uuid.uuid4().hex
|
||||
'backup_name': uuidutils.generate_uuid(dashed=False)
|
||||
}
|
||||
|
||||
restore_args = {
|
||||
|
@ -102,7 +103,7 @@ class TestBackupFSLocalstorage(common.TestFS):
|
|||
'storage': 'local',
|
||||
'max_level': '6',
|
||||
'max_segment_size': '67108864',
|
||||
'backup_name': uuid.uuid4().hex
|
||||
'backup_name': uuidutils.generate_uuid(dashed=False)
|
||||
}
|
||||
|
||||
restore_args = {
|
||||
|
@ -123,7 +124,7 @@ class TestBackupFSLocalstorage(common.TestFS):
|
|||
self.source_tree.add_random_data()
|
||||
self.assertTreesMatchNot()
|
||||
|
||||
backup_name = uuid.uuid4().hex
|
||||
backup_name = uuidutils.generate_uuid(dashed=False)
|
||||
path_to_backup = self.source_tree.path
|
||||
lvm_snapsize = '50M'
|
||||
lvm_snapname = 'freezer-snap_{0}'.format(backup_name)
|
||||
|
@ -185,7 +186,7 @@ class TestBackupSSH(common.TestFS):
|
|||
'path_to_backup': self.source_tree.path,
|
||||
'max_level': '6',
|
||||
'max_segment_size': '67108864',
|
||||
'backup_name': uuid.uuid4().hex,
|
||||
'backup_name': uuidutils.generate_uuid(dashed=False),
|
||||
'storage': 'ssh',
|
||||
'container': self.container,
|
||||
'ssh_key': self.ssh_key,
|
||||
|
@ -239,7 +240,7 @@ class TestBackupSSH(common.TestFS):
|
|||
'path_to_backup': self.source_tree.path,
|
||||
'max_level': '6',
|
||||
'max_segment_size': '67108864',
|
||||
'backup_name': uuid.uuid4().hex,
|
||||
'backup_name': uuidutils.generate_uuid(dashed=False),
|
||||
'storage': 'ssh',
|
||||
'container': self.container,
|
||||
'ssh_key': self.ssh_key,
|
||||
|
@ -292,7 +293,7 @@ class TestBackupSSH(common.TestFS):
|
|||
self.source_tree.add_random_data()
|
||||
self.assertTreesMatchNot()
|
||||
|
||||
backup_name = uuid.uuid4().hex
|
||||
backup_name = uuidutils.generate_uuid(dashed=False)
|
||||
path_to_backup = self.source_tree.path
|
||||
lvm_snapsize = '1G'
|
||||
lvm_snapname = 'freezer-snap_{0}'.format(backup_name)
|
||||
|
@ -377,9 +378,10 @@ class TestBackupUsingSwiftStorage(common.TestFS):
|
|||
'path_to_backup': self.source_tree.path,
|
||||
'max_level': '6',
|
||||
'max_segment_size': '67108864',
|
||||
'backup_name': uuid.uuid4().hex,
|
||||
'backup_name': uuidutils.generate_uuid(dashed=False),
|
||||
'storage': 'swift',
|
||||
'container': 'freezer_test_backups_{0}'.format(uuid.uuid4().hex),
|
||||
'container': 'freezer_test_backups_{0}'.format(
|
||||
uuidutils.generate_uuid(dashed=False)),
|
||||
'metadata_out': '-'
|
||||
}
|
||||
restore_args = {
|
||||
|
@ -439,9 +441,10 @@ class TestBackupUsingSwiftStorage(common.TestFS):
|
|||
'path_to_backup': self.source_tree.path,
|
||||
'max_level': '6',
|
||||
'max_segment_size': '67108864',
|
||||
'backup_name': uuid.uuid4().hex,
|
||||
'backup_name': uuidutils.generate_uuid(dashed=False),
|
||||
'storage': 'swift',
|
||||
'container': 'freezer_test_backups_{0}'.format(uuid.uuid4().hex),
|
||||
'container': 'freezer_test_backups_{0}'.format(
|
||||
uuidutils.generate_uuid(dashed=False)),
|
||||
'metadata_out': '-'
|
||||
}
|
||||
restore_args = {
|
||||
|
@ -497,7 +500,7 @@ class TestBackupUsingSwiftStorage(common.TestFS):
|
|||
def test_backup_swift_mysql(self):
|
||||
self.source_tree = common.Temp_Tree(dir='/var/lib/mysql', create=False)
|
||||
|
||||
backup_name = uuid.uuid4().hex
|
||||
backup_name = uuidutils.generate_uuid(dashed=False)
|
||||
lvm_snapsize = '1G'
|
||||
lvm_snapname = 'freezer-snap_{0}'.format(backup_name)
|
||||
lvm_dirmount = '/var/freezer/freezer-{0}'.format(backup_name)
|
||||
|
@ -551,9 +554,10 @@ class TestBackupUsingSwiftStorage(common.TestFS):
|
|||
'upload_limit': '1M',
|
||||
'download_limit': '1M',
|
||||
'max_segment_size': '67108864',
|
||||
'backup_name': uuid.uuid4().hex,
|
||||
'backup_name': uuidutils.generate_uuid(dashed=False),
|
||||
'storage': 'swift',
|
||||
'container': 'freezer_test_backups_{0}'.format(uuid.uuid4().hex),
|
||||
'container': 'freezer_test_backups_{0}'.format(
|
||||
uuidutils.generate_uuid(dashed=False)),
|
||||
'metadata_out': '-'
|
||||
}
|
||||
restore_args = {
|
||||
|
|
Loading…
Reference in New Issue