Refactor duplicate XML/UUID logic into shared module#88
Merged
dupremathieu merged 3 commits intoseapath:mainfrom Mar 13, 2026
Merged
Refactor duplicate XML/UUID logic into shared module#88dupremathieu merged 3 commits intoseapath:mainfrom
dupremathieu merged 3 commits intoseapath:mainfrom
Conversation
Prevent creating VMs with duplicate UUIDs by checking existing UUIDs before defining a new VM. In standalone mode, checks local libvirt domains; in cluster mode, reads XML metadata from RBD system disks to detect collisions across all nodes. Add explicit errors when a UUID conflict is detected. Add TestListAllUuids (2 tests), and TestUuidCollision (1 test) classes. Update TestCreateXml to cover predefined UUID preservation, empty UUID, and missing UUID cases. Strip the hardcoded UUID from the test XML helper to avoid collisions with existing VMs on the cluster, and add _read_test_xml_with_uuid() for tests that specifically need the predefined UUID. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Mathieu Dupré <mathieu.dupre@savoirfairelinux.com>
Extract prepare_xml_base() and check_uuid_conflict() from both vm_manager_cluster.py and vm_manager_libvirt.py into a new xml_utils.py module to eliminate code duplication. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Mathieu Dupré <mathieu.dupre@savoirfairelinux.com>
653ccfe to
46ce8e3
Compare
eroussy
requested changes
Mar 13, 2026
- Add assert that generated UUIDs differ from the predefined one - Remove redundant UUID stripping in cluster test (already done by _read_test_xml) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Mathieu Dupré <mathieu.dupre@savoirfairelinux.com>
8fefe80 to
838d1eb
Compare
|
eroussy
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



vm_manager_cluster.pyandvm_manager_libvirt.pyinto a newvm_manager/xml_utils.pymoduleprepare_xml_base()andcheck_uuid_conflict()functions, reducing code duplication by ~50 lines