use check vm
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
7a52ee8af2
commit
a49a918a16
1 changed files with 24 additions and 17 deletions
|
|
@ -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}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue