use check vm

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2025-05-11 23:41:56 +02:00
commit a49a918a16
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632

View file

@ -35,6 +35,12 @@ function qemu_start_vm {
local subnet_id="$(echo "${subnet_name}" | cut -d\- -f2)"
local mac="$(find_mac "${vpc_name}_br-${subnet_id}" "${ip}")"
check_qemu_exist "${vm_name}"
[ "$?" -eq "0" ] && \
{
print_in_color "${COLOR_ORANGE}" "Would have create ${vm_name}"
} || \
{
print_in_color "${COLOR_GREEN}" "Create tap tap${tap_id}"
add_in_db "vm" "${vm_name}" "${subnet_name}" "${tap_id}"
create_tap "${tap_id}" "br-${subnet_id}" "${vpc_name}"
@ -54,6 +60,7 @@ function qemu_start_vm {
-device "virtio-net-pci,netdev=net0,mac=${mac}" \
-daemonize
}
}
function qemu_stop_vm {
local vm_name="${1}"