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:
parent
8233e63e95
commit
6150876898
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import uuid
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
XML_TEMPLATE = """<domain type='kvm'>
|
XML_TEMPLATE = """<domain type='kvm'>
|
||||||
<name>%s</name>
|
<name>%s</name>
|
||||||
<uuid>%s</uuid>
|
<uuid>%s</uuid>
|
||||||
|
@ -69,8 +68,8 @@ def int_to_hex(n):
|
||||||
def gen_libvirt_xml(subnet, begin, end):
|
def gen_libvirt_xml(subnet, begin, end):
|
||||||
for i in range(begin, end):
|
for i in range(begin, end):
|
||||||
name = "%s.%s" % (subnet, i)
|
name = "%s.%s" % (subnet, i)
|
||||||
xml = XML_TEMPLATE % (name, str(uuid.uuid4()), name,
|
xml = XML_TEMPLATE % (name, uuidutils.generate_uuid(), name,
|
||||||
int_to_hex(subnet), int_to_hex(i))
|
int_to_hex(subnet), int_to_hex(i))
|
||||||
print xml
|
print xml
|
||||||
fout = open('/tmp/%s.%s.xml' % (subnet, i), 'w')
|
fout = open('/tmp/%s.%s.xml' % (subnet, i), 'w')
|
||||||
fout.write(xml)
|
fout.write(xml)
|
||||||
|
|
|
@ -26,7 +26,7 @@ import os
|
||||||
import threading
|
import threading
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import uuid
|
from oslo_utils import uuidutils
|
||||||
from wsgiref.simple_server import make_server
|
from wsgiref.simple_server import make_server
|
||||||
|
|
||||||
from routes import Mapper
|
from routes import Mapper
|
||||||
|
@ -264,7 +264,7 @@ class InceptionCloud(_BASE):
|
||||||
power_state = Column(String)
|
power_state = Column(String)
|
||||||
|
|
||||||
def __init__(self):
|
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 = []
|
self.worker_ids = []
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
Loading…
Reference in New Issue