Added Debian Trixie as new Debian stable guest. Fixed host only things on scripts

This commit is contained in:
2025-08-27 16:13:45 +02:00
parent aaa3fd5b32
commit febd3b76d3
4 changed files with 17 additions and 13 deletions

View File

@ -63,6 +63,8 @@ VM_NETWORK_HOSTONLY="host-only"
VM_USERNAME="user" VM_USERNAME="user"
``` ```
You can create a VM with isolated network but an extra interface with NAT network if added, because when guest is initialized, it get updated and some packages are installed (dependend on linux-user-metadata). You can delete NAT interface after VM guest is initialized.
### AppArmor exception (if needed) ### AppArmor exception (if needed)
If AppArmor is blocking libvirtd, disable the profile temporarily: If AppArmor is blocking libvirtd, disable the profile temporarily:

View File

@ -231,7 +231,7 @@ vm_list()
vm_net_get_mac() vm_net_get_mac()
{ {
local VM=$1 local VM=$1
MAC_VM=$(virsh domiflist "$VM" | awk '{ print $5 }' | tail -2 | head -1) MAC_VM=$(virsh domiflist "${VM}" | grep "${VM_NETWORK_NAT}"| awk '{ print $5 }' | tail -2 | head -1)
echo $MAC_VM echo $MAC_VM
} }
## Get VM ip (only on NAT) ## Get VM ip (only on NAT)
@ -295,9 +295,7 @@ vm_net_bridge_set_ip()
vm_net_set_network_type() vm_net_set_network_type()
{ {
if [[ "${VM_NETWORK_TYPE}" == "isolated" ]]; then if [[ "${VM_NETWORK_TYPE}" == "bridge" ]]; then
LIBVIRT_NET_OPTION="network=${VM_NETWORK_HOST_ONLY},model=${LIBVIRT_NET_MODEL}"
elif [[ "${VM_NETWORK_TYPE}" == "bridge" ]]; then
LIBVIRT_NET_OPTION="model=virtio,bridge=${VM_BRIDGE_INT}" LIBVIRT_NET_OPTION="model=virtio,bridge=${VM_BRIDGE_INT}"
fi fi
} }
@ -523,6 +521,10 @@ vm_guest_install()
VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --os-variant=${VM_OS_VARIANT}" VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --os-variant=${VM_OS_VARIANT}"
VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --disk ${VM_BASE_DIR}/images/${VM_HOSTNAME}.img,device=disk,bus=virtio" VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --disk ${VM_BASE_DIR}/images/${VM_HOSTNAME}.img,device=disk,bus=virtio"
VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --network ${LIBVIRT_NET_OPTION}" VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --network ${LIBVIRT_NET_OPTION}"
if [[ "${VM_NETWORK_TYPE}" == "isolated" ]]; then
LIBVIRT_NET_OPTION="network=${VM_NETWORK_HOSTONLY},model=${LIBVIRT_NET_MODEL}"
VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --network ${LIBVIRT_NET_OPTION}"
fi
VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --autostart" VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --autostart"
VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --import --noautoconsole" VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --import --noautoconsole"
VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --cloud-init user-data=${VM_BASE_DIR}/init/${VM_HOSTNAME}-user-data,meta-data=$VM_BASE_DIR/init/${VM_HOSTNAME}-meta-data" VM_INSTALL_OPTS="${VM_INSTALL_OPTS} --cloud-init user-data=${VM_BASE_DIR}/init/${VM_HOSTNAME}-user-data,meta-data=$VM_BASE_DIR/init/${VM_HOSTNAME}-meta-data"

View File

@ -2,12 +2,12 @@
"os_variants": [ "os_variants": [
{ {
"id": 1, "id": 1,
"name": "Debian 12", "name": "Debian Stable",
"variant": "debian13", "variant": "debian13",
"os_type": "GNULinux", "os_type": "GNULinux",
"url": "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2", "url": "http://cloud.debian.org/images/cloud/trixie/latest/debian-13-generic-amd64.qcow2",
"origin_image_name": "debian-12-generic-amd64.qcow2", "origin_image_name": "debian-13-generic-amd64.qcow2",
"md5sum": "https://cdimage.debian.org/images/cloud/bookworm/latest/SHA512SUMS", "md5sum": "http://cloud.debian.org/images/cloud/trixie/latest/SHA512SUMS",
"boot_type": "bios" "boot_type": "bios"
}, },
{ {

View File

@ -60,8 +60,8 @@ case "${ACTION}" in
# Parse options for create command # Parse options for create command
VERBOSE=false VERBOSE=false
NAME_SET=false NAME_SET=false
source env_scripts/common.sh
while getopts ":hn:b:H:r:c:s:v" opt; do while getopts ":hn:b:Hr:c:s:v" opt; do
case "${opt}" in case "${opt}" in
h) h)
usage usage
@ -72,10 +72,10 @@ case "${ACTION}" in
;; ;;
b) b)
VM_BRIDGE_INT="${OPTARG}" VM_BRIDGE_INT="${OPTARG}"
VM_NETWORK_TYPE_DEFAULT="bridge" VM_NETWORK_TYPE="bridge"
;; ;;
H) H)
VM_NETWORK_TYPE_DEFAULT="isolated" VM_NETWORK_TYPE="isolated"
;; ;;
r) r)
VM_MEM_SIZE="${OPTARG}" VM_MEM_SIZE="${OPTARG}"
@ -105,7 +105,7 @@ case "${ACTION}" in
echo "Error: The -n option is required for create action." >&2 echo "Error: The -n option is required for create action." >&2
usage usage
fi fi
source env_scripts/common.sh
detect_distro detect_distro
#Check network type #Check network type
vm_net_set_network_type vm_net_set_network_type