Replaced 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: Ibbd98723359d50992e5fbb18e2532ee7f48f265d
This commit is contained in:
kavithahr 2017-06-27 18:03:31 +05:30 committed by kavitha h r
parent 8233e63e95
commit d9d282a2fd
2 changed files with 5 additions and 6 deletions

View File

@ -2,8 +2,7 @@
import sys
import os
import uuid
from oslo_utils import uuidutils
XML_TEMPLATE = """<domain type='kvm'>
<name>%s</name>
<uuid>%s</uuid>
@ -69,8 +68,8 @@ def int_to_hex(n):
def gen_libvirt_xml(subnet, begin, end):
for i in range(begin, end):
name = "%s.%s" % (subnet, i)
xml = XML_TEMPLATE % (name, str(uuid.uuid4()), name,
int_to_hex(subnet), int_to_hex(i))
xml = XML_TEMPLATE % (name, uuidutils.generate_uuid(), name,
int_to_hex(subnet), int_to_hex(i))
print xml
fout = open('/tmp/%s.%s.xml' % (subnet, i), 'w')
fout.write(xml)

View File

@ -26,7 +26,7 @@ import os
import threading
import sys
import traceback
import uuid
from oslo_utils import utils
from wsgiref.simple_server import make_server
from routes import Mapper
@ -264,7 +264,7 @@ class InceptionCloud(_BASE):
power_state = Column(String)
def __init__(self):
self.id = uuid.uuid4() # Generate our own IC id
self.id = uuidutils.generate_uuid() # Generate our own IC id
self.worker_ids = []
def __repr__(self):