1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 16:36:06 +00:00

refactor(vrtManager): new VM UUIDs come from uuid.uuid4()

randomUUID() built a version 4 UUID from 16 random bytes by hand; the clone and create jobs now take str(uuid4()) from the standard library, and the function and its format test go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-08 12:24:47 +03:00
parent f97708a7b7
commit d2383be914
4 changed files with 5 additions and 21 deletions

View file

@ -4,7 +4,6 @@ import unittest
from vrtManager.util import (
get_xml_path,
randomPasswd,
randomUUID,
validate_macaddr,
vol_dev_type,
vol_driver_type,
@ -13,14 +12,6 @@ from vrtManager.util import (
class TestVrtManagerUtil(unittest.TestCase):
def test_random_uuid_format(self):
uuid_str = randomUUID()
# UUIDv4 format check
pattern = r"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
self.assertRegex(uuid_str, pattern)
# Ensure successive UUIDs are distinct
self.assertNotEqual(uuid_str, randomUUID())
def test_validate_macaddr(self):
self.assertIsNone(validate_macaddr(None))
self.assertIsNone(validate_macaddr("52:54:10:aa:bb:cc"))