summaryrefslogtreecommitdiff
path: root/others
diff options
context:
space:
mode:
authorhc <hc@email.ch>2025-01-02 15:08:49 +0800
committerhc <hc@email.ch>2025-01-02 15:08:49 +0800
commitff7f42e5b89d6c1cf664ae866f29f790132a7da7 (patch)
tree0d91329e8735f92797505da521f108413b862b59 /others
parentc33f0979f0312e7a6d43645aa0a5d5b1481751f5 (diff)
debianuuid
Diffstat (limited to 'others')
-rwxr-xr-xothers/vm3/compute/create.sh6
-rw-r--r--others/vm3/default.xml13
2 files changed, 18 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
92if [ "$os" = "debian12" ]; then 92if [ "$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"
94else 95else
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"
96fi 97fi
97 98
99generate_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
100sudo virt-install --name $vmname \ 104sudo 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
diff --git a/others/vm3/default.xml b/others/vm3/default.xml
new file mode 100644
index 0000000..bf71f7c
--- /dev/null
+++ b/others/vm3/default.xml
@@ -0,0 +1,13 @@
1<network>
2 <name>default</name>
3 <uuid>3d6341fb-fad2-49c1-b54a-41d2027f56cc</uuid>
4 <forward mode='nat'/>
5 <bridge name='virbr0' stp='on' delay='0'/>
6 <mac address='52:54:00:73:4c:22'/>
7 <ip address='192.168.124.1' netmask='255.255.255.0'>
8 <dhcp>
9 <range start='192.168.124.2' end='192.168.124.254'/>
10 <option opt='61' value='ignore'/>
11 </dhcp>
12 </ip>
13</network>