Generate libvirt config files

This commit is contained in:
Pim van Pelt
2023-11-19 18:19:59 +00:00
parent 4ca17edf61
commit b14e7674ad
17 changed files with 3800 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import pprint
import logging
import ipaddress
import re
import hashlib
try:
import argparse
@ -156,8 +157,14 @@ def create_node(lab, node_id, node_type):
offset = total_nodes
total_nodes += nc
node_hostname = "%s%d-%d" % (node_type, lab["id"], node_id)
hex_digest = hashlib.md5(node_hostname.encode('utf-8')).hexdigest()
node_uuid = hex_digest[0:8] + '-'+ hex_digest[8:12] + '-' + hex_digest[12:16] + '-' + hex_digest[16:20] + '-' + hex_digest[20:]
ret = {
"hostname": "%s%d-%d" % (node_type, lab["id"], node_id),
"uuid": node_uuid,
"type": node_type,
"hostname": node_hostname,
"id": node_id,
"mgmt": {
"ipv4": "%s/%s"