import optparse
import os
import sys
+import uuid
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import sessionmaker
# TODO(renukaapte) Add backend_introduce.
ctxt = context.get_admin_context()
params = dict(map(self._splitfun, args))
- sr_uuid = utils.gen_uuid()
+ sr_uuid = uuid.uuid4()
if flavor_label is None:
print "error: backend needs to be associated with flavor"
"""RequestContext: context for requests that persist through all of cinder."""
import copy
+import uuid
from cinder.openstack.common import local
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils
from cinder import policy
-from cinder import utils
LOG = logging.getLogger(__name__)
def generate_request_id():
- return 'req-' + str(utils.gen_uuid())
+ return 'req-' + str(uuid.uuid4())
class RequestContext(object):
import datetime
import functools
+import uuid
import warnings
from sqlalchemy.exc import IntegrityError
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils
from cinder.openstack.common import uuidutils
-from cinder import utils
FLAGS = flags.FLAGS
reservations = []
for resource, delta in deltas.items():
reservation = reservation_create(elevated,
- str(utils.gen_uuid()),
+ str(uuid.uuid4()),
usages[resource],
context.project_id,
resource, delta, expire,
models.VolumeMetadata)
volume_ref = models.Volume()
if not values.get('id'):
- values['id'] = str(utils.gen_uuid())
+ values['id'] = str(uuid.uuid4())
volume_ref.update(values)
session = get_session()
def snapshot_create(context, values):
snapshot_ref = models.Snapshot()
if not values.get('id'):
- values['id'] = str(utils.gen_uuid())
+ values['id'] = str(uuid.uuid4())
snapshot_ref.update(values)
session = get_session()
# under the License.
import datetime
+import uuid
import routes
import webob
from cinder import context
from cinder import exception as exc
from cinder.openstack.common import timeutils
-from cinder import utils
from cinder import wsgi
def get_fake_uuid(token=0):
if not token in FAKE_UUIDS:
- FAKE_UUIDS[token] = str(utils.gen_uuid())
+ FAKE_UUIDS[token] = str(uuid.uuid4())
return FAKE_UUIDS[token]
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
# Copyright 2012 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# under the License.
import datetime
+import uuid
import webob
from cinder.api.openstack.volume.contrib import volume_actions
from cinder.openstack.common.rpc import common as rpc_common
from cinder import test
from cinder.tests.api.openstack import fakes
-from cinder import utils
from cinder import volume
from cinder.volume import api as volume_api
def setUp(self):
super(VolumeActionsTest, self).setUp()
self.stubs.Set(volume.API, 'get', fake_volume_api)
- self.UUID = utils.gen_uuid()
+ self.UUID = uuid.uuid4()
for _method in self._methods:
self.stubs.Set(volume.API, _method, fake_volume_api)
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
# Copyright 2012 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
import datetime
import json
+import uuid
from lxml import etree
import webob
from cinder import context
from cinder import test
from cinder.tests.api.openstack import fakes
-from cinder import utils
from cinder import volume
super(VolumeHostAttributeTest, self).setUp()
self.stubs.Set(volume.API, 'get', fake_volume_get)
self.stubs.Set(volume.API, 'get_all', fake_volume_get_all)
- self.UUID = utils.gen_uuid()
+ self.UUID = uuid.uuid4()
def test_get_volume_allowed(self):
ctx = context.RequestContext('admin', 'fake', True)
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
# Copyright 2012 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
import datetime
import json
+import uuid
from lxml import etree
import webob
from cinder import context
from cinder import test
from cinder.tests.api.openstack import fakes
-from cinder import utils
from cinder import volume
+
PROJECT_ID = '88fd1da4-f464-4a87-9ce5-26f2f40743b9'
super(VolumeTenantAttributeTest, self).setUp()
self.stubs.Set(volume.API, 'get', fake_volume_get)
self.stubs.Set(volume.API, 'get_all', fake_volume_get_all)
- self.UUID = utils.gen_uuid()
+ self.UUID = uuid.uuid4()
def test_get_volume_allowed(self):
ctx = context.RequestContext('admin', 'fake', True)
import copy
import datetime
+import uuid
from cinder import exception
from cinder import flags
import cinder.image.glance
from cinder.openstack.common import log as logging
-from cinder import utils
LOG = logging.getLogger(__name__)
:raises: Duplicate if the image already exist.
"""
- image_id = str(metadata.get('id', utils.gen_uuid()))
+ image_id = str(metadata.get('id', uuid.uuid4()))
metadata['id'] = image_id
if image_id in self.images:
raise exception.Duplicate()
import random
import string
+import uuid
from cinder.openstack.common import log as logging
from cinder import service
from cinder import test # For the flags
from cinder.tests.integrated.api import client
-from cinder import utils
LOG = logging.getLogger(__name__)
return generate_new_element(server_names, 'server')
def get_invalid_image(self):
- return str(utils.gen_uuid())
+ return str(uuid.uuid4())
def _build_minimal_create_server_request(self):
server = {}
import paramiko
import StringIO
import tempfile
+import uuid
import mox
from cinder import exception
from cinder import flags
from cinder.openstack.common import timeutils
-from cinder.openstack.common import uuidutils
from cinder import test
from cinder import utils
self.assertEquals(h1, h2)
-class GenUUIDTestCase(test.TestCase):
- def test_gen_valid_uuid(self):
- self.assertTrue(uuidutils.is_uuid_like(str(utils.gen_uuid())))
-
-
class MonkeyPatchTestCase(test.TestCase):
"""Unit test for utils.monkey_patch()."""
def setUp(self):
class FakeSSHClient(object):
def __init__(self):
- self.id = utils.gen_uuid()
+ self.id = uuid.uuid4()
self.transport = FakeTransport()
def set_missing_host_key_policy(self, policy):
# vim: tabstop=4 shiftwidth=4 softtabstop=4
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
import tempfile
import time
import types
-import uuid
import warnings
from xml.sax import saxutils
return cls() # Ugly PyLint hack
-def gen_uuid():
- return uuid.uuid4()
-
-
def bool_from_str(val):
"""Convert a string representation of a bool into a bool value"""