Use uuid instead of uuidutils

The generate_uuid() functions will be deprecated/removed from uuidutils/
This patch replaces uuidutils.generate_uuid() with str(uuid.uuid4()).

Change-Id: I40e2dbf5e9e04b0109b1185df70e4f4ba93a17c9
Partial-Bug: #1253497
This commit is contained in:
Zhongyue Luo 2014-02-28 13:49:32 +08:00
parent 0760c35223
commit 753f161406
2 changed files with 8 additions and 9 deletions

View File

@ -40,7 +40,6 @@ from manila.db.sqlalchemy.session import get_session
from manila import exception from manila import exception
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.openstack.common import timeutils from manila.openstack.common import timeutils
from manila.openstack.common import uuidutils
CONF = cfg.CONF CONF = cfg.CONF
@ -1433,7 +1432,7 @@ def _share_metadata_get_item(context, share_id, key, session=None):
@require_context @require_context
def security_service_create(context, values): def security_service_create(context, values):
if not values.get('id'): if not values.get('id'):
values['id'] = uuidutils.generate_uuid() values['id'] = str(uuid.uuid4())
security_service_ref = models.SecurityService() security_service_ref = models.SecurityService()
security_service_ref.update(values) security_service_ref.update(values)
@ -1509,7 +1508,7 @@ def _network_get_query(context, session=None):
@require_context @require_context
def share_network_create(context, values): def share_network_create(context, values):
if not values.get('id'): if not values.get('id'):
values['id'] = uuidutils.generate_uuid() values['id'] = str(uuid.uuid4())
network_ref = models.ShareNetwork() network_ref = models.ShareNetwork()
network_ref.update(values) network_ref.update(values)

View File

@ -15,11 +15,11 @@
# #
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
import uuid
from oslo.config import cfg from oslo.config import cfg
from manila.openstack.common import log as logging from manila.openstack.common import log as logging
from manila.openstack.common import uuidutils
CONF = cfg.CONF CONF = cfg.CONF
@ -112,11 +112,11 @@ class API(object):
def get_all_tenant_networks(self, tenant_id): def get_all_tenant_networks(self, tenant_id):
net1 = self.network.copy() net1 = self.network.copy()
net1['tenant_id'] = tenant_id net1['tenant_id'] = tenant_id
net1['id'] = uuidutils.generate_uuid() net1['id'] = str(uuid.uuid4())
net2 = self.network.copy() net2 = self.network.copy()
net2['tenant_id'] = tenant_id net2['tenant_id'] = tenant_id
net2['id'] = uuidutils.generate_uuid() net2['id'] = str(uuid.uuid4())
return [net1, net2] return [net1, net2]
def create_port(self, tenant_id, network_id, subnet_id=None, def create_port(self, tenant_id, network_id, subnet_id=None,
@ -142,7 +142,7 @@ class API(object):
for i in range(2): for i in range(2):
ports.append(self.port.copy()) ports.append(self.port.copy())
for port in ports: for port in ports:
port['id'] = uuidutils.generate_uuid() port['id'] = str(uuid.uuid4())
for key, val in search_opts.items(): for key, val in search_opts.items():
port[key] = val port[key] = val
if 'id' in search_opts: if 'id' in search_opts:
@ -177,8 +177,8 @@ class API(object):
"""Get all networks for client.""" """Get all networks for client."""
net1 = self.network.copy() net1 = self.network.copy()
net2 = self.network.copy() net2 = self.network.copy()
net1['id'] = uuidutils.generate_uuid() net1['id'] = str(uuid.uuid4())
net2['id'] = uuidutils.generate_uuid() net2['id'] = str(uuid.uuid4())
return [net1, net2] return [net1, net2]
def get_network(self, network_uuid): def get_network(self, network_uuid):