Revision 90e234a6 lib/utils/__init__.py
b/lib/utils/__init__.py | ||
---|---|---|
66 | 66 |
from ganeti.utils.process import * # pylint: disable-msg=W0401 |
67 | 67 |
|
68 | 68 |
|
69 |
_RANDOM_UUID_FILE = "/proc/sys/kernel/random/uuid" |
|
70 |
|
|
71 | 69 |
_VALID_SERVICE_NAME_RE = re.compile("^[-_.a-zA-Z0-9]{1,128}$") |
72 | 70 |
|
73 | 71 |
UUID_RE = re.compile('^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-' |
... | ... | |
289 | 287 |
return result.pw_dir |
290 | 288 |
|
291 | 289 |
|
292 |
def NewUUID(): |
|
293 |
"""Returns a random UUID. |
|
294 |
|
|
295 |
@note: This is a Linux-specific method as it uses the /proc |
|
296 |
filesystem. |
|
297 |
@rtype: str |
|
298 |
|
|
299 |
""" |
|
300 |
return ReadFile(_RANDOM_UUID_FILE, size=128).rstrip("\n") |
|
301 |
|
|
302 |
|
|
303 | 290 |
def FirstFree(seq, base=0): |
304 | 291 |
"""Returns the first non-existing integer from seq. |
305 | 292 |
|
Also available in: Unified diff