mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
[XEND] Add a convenience function for UUID generation
Signed-off-by: Alastair Tse <atse@xensource.com>
This commit is contained in:
1 parent
02af4f3cd3
commit
1d9888c989
1 file changed
+6
-4
@@ -54,10 +54,6 @@ def getUuidRandom():
|
||||
uuidFactory = getUuidRandom
|
||||
|
||||
|
||||
def create():
|
||||
return uuidFactory()
|
||||
|
||||
|
||||
def toString(u):
|
||||
return "-".join(["%02x" * 4, "%02x" * 2, "%02x" * 2, "%02x" * 2,
|
||||
"%02x" * 6]) % tuple(u)
|
||||
@@ -65,3 +61,9 @@ def toString(u):
|
||||
def fromString(s):
|
||||
s = s.replace('-', '')
|
||||
return [ int(s[i : i + 2], 16) for i in range(0, 32, 2) ]
|
||||
|
||||
def create():
|
||||
return uuidFactory()
|
||||
|
||||
def createString():
|
||||
return toString(create())
|
||||