diff options
Diffstat (limited to 'others/vm3/compute/create.sh')
| -rwxr-xr-x | others/vm3/compute/create.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/others/vm3/compute/create.sh b/others/vm3/compute/create.sh index 1a0411b..3588db4 100755 --- a/others/vm3/compute/create.sh +++ b/others/vm3/compute/create.sh | |||
| @@ -91,10 +91,14 @@ fi | |||
| 91 | # Define the disk options based on OS type | 91 | # Define the disk options based on OS type |
| 92 | if [ "$os" = "debian12" ]; then | 92 | if [ "$os" = "debian12" ]; then |
| 93 | disk_opts="--disk path=${new_vm},format=qcow2" | 93 | disk_opts="--disk path=${new_vm},format=qcow2" |
| 94 | virt-customize -a ${new_vm} --run-command "rm -f /etc/machine-id && systemd-machine-id-setup" | ||
| 94 | else | 95 | else |
| 95 | disk_opts="--disk path=${new_vm},format=qcow2 --disk path=$seed_iso,device=cdrom" | 96 | disk_opts="--disk path=${new_vm},format=qcow2 --disk path=$seed_iso,device=cdrom" |
| 96 | fi | 97 | fi |
| 97 | 98 | ||
| 99 | generate_mac() { | ||
| 100 | printf "52:54:00:%02x:%02x:%02x\n" $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) | ||
| 101 | } | ||
| 98 | 102 | ||
| 99 | # Use the conditional disk options in virt-install | 103 | # Use the conditional disk options in virt-install |
| 100 | sudo virt-install --name $vmname \ | 104 | sudo virt-install --name $vmname \ |
| @@ -105,7 +109,7 @@ sudo virt-install --name $vmname \ | |||
| 105 | --os-variant $os \ | 109 | --os-variant $os \ |
| 106 | --virt-type kvm \ | 110 | --virt-type kvm \ |
| 107 | --graphics none \ | 111 | --graphics none \ |
| 108 | --network bridge=virbr0,model=virtio \ | 112 | --network bridge=virbr0,model=virtio,mac=$(generate_mac) \ |
| 109 | --print-xml > $xml || { sudo rm -rf $new_vm; exit 1; } | 113 | --print-xml > $xml || { sudo rm -rf $new_vm; exit 1; } |
| 110 | # if you want this in a new storage pool, move it to a new storage pool after initialisation | 114 | # if you want this in a new storage pool, move it to a new storage pool after initialisation |
| 111 | 115 | ||
