Revision 24818e8f
b/lib/config.py | ||
---|---|---|
133 | 133 |
existing.update(exceptions) |
134 | 134 |
retries = 64 |
135 | 135 |
while retries > 0: |
136 |
unique_id = utils.GetUUID()
|
|
136 |
unique_id = utils.NewUUID()
|
|
137 | 137 |
if unique_id not in existing and unique_id is not None: |
138 | 138 |
break |
139 | 139 |
else: |
b/lib/utils.py | ||
---|---|---|
847 | 847 |
return result.pw_dir |
848 | 848 |
|
849 | 849 |
|
850 |
def GetUUID():
|
|
850 |
def NewUUID():
|
|
851 | 851 |
"""Returns a random UUID. |
852 | 852 |
|
853 | 853 |
""" |
b/qa/qa_cluster.py | ||
---|---|---|
164 | 164 |
"""gnt-cluster copyfile""" |
165 | 165 |
master = qa_config.GetMasterNode() |
166 | 166 |
|
167 |
uniqueid = utils.GetUUID()
|
|
167 |
uniqueid = utils.NewUUID()
|
|
168 | 168 |
|
169 | 169 |
# Create temporary file |
170 | 170 |
f = tempfile.NamedTemporaryFile() |
... | ... | |
188 | 188 |
"""gnt-cluster command""" |
189 | 189 |
master = qa_config.GetMasterNode() |
190 | 190 |
|
191 |
uniqueid = utils.GetUUID()
|
|
192 |
rfile = "/tmp/gnt%s" % utils.GetUUID()
|
|
191 |
uniqueid = utils.NewUUID()
|
|
192 |
rfile = "/tmp/gnt%s" % utils.NewUUID()
|
|
193 | 193 |
rcmd = utils.ShellQuoteArgs(['echo', '-n', uniqueid]) |
194 | 194 |
cmd = utils.ShellQuoteArgs(['gnt-cluster', 'command', |
195 | 195 |
"%s >%s" % (rcmd, rfile)]) |
b/test/ganeti.utils_unittest.py | ||
---|---|---|
541 | 541 |
self._test(files, expected) |
542 | 542 |
|
543 | 543 |
|
544 |
class TestGetUUID(unittest.TestCase):
|
|
545 |
"""Test case for GetUUID"""
|
|
544 |
class TestNewUUID(unittest.TestCase):
|
|
545 |
"""Test case for NewUUID"""
|
|
546 | 546 |
|
547 | 547 |
_re_uuid = re.compile('^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-' |
548 | 548 |
'[a-f0-9]{4}-[a-f0-9]{12}$') |
549 | 549 |
|
550 | 550 |
def runTest(self): |
551 |
self.failUnless(self._re_uuid.match(utils.GetUUID()))
|
|
551 |
self.failUnless(self._re_uuid.match(utils.NewUUID()))
|
|
552 | 552 |
|
553 | 553 |
|
554 | 554 |
if __name__ == '__main__': |
Also available in: Unified diff