Signed-off-by: Wang Chenglong 18509160991@163.com --- providers/qemu/kvm.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index dcab81a..3b220ef 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -23,8 +23,9 @@ check_logfile() write_logfile() { ipxe_script=ipxe_script - curl http://$%7BSCHED_HOST:-172.17.0.1%7D:$%7BSCHED_PORT:-3000%7D/boot.ipxe/mac/$... > $ipxe_script + curl http://$%7BSCHED_HOST:-172.17.0.1%7D:$%7BSCHED_PORT:-3000%7D/boot.ipxe/mac/$... > $ipxe_script cat $ipxe_script >> ${log_file} + cat $ipxe_script }
parse_ipxe_script() @@ -121,12 +122,17 @@ add_disk()
set_nic() { - nic="tap,model=virtio-net-pci,helper=$helper,br=br0,mac=${mac}" +# nic="tap,model=virtio-net-pci,helper=$helper,br=br0,mac=${mac}" + + for i in $(seq 0 $nr_nic) + do + nic[$i]="-nic tap,model=virtio-net-pci,helper=$helper,br=br0,mac=${mac_arr[$i]}" + done }
set_device() { - device="virtio-net-device,netdev=net0,mac=${mac}" + device="virtio-net-device,netdev=net0,mac=${mac[0]}" }
set_netdev() @@ -190,7 +196,7 @@ individual_option() -machine virt-4.0,accel=kvm,gic-version=3 -cpu Kunpeng-920 -bios $bios - -nic $nic + ${nic[@]} ) ;; qemu-kvm) @@ -198,17 +204,17 @@ individual_option() -machine virt-4.0,accel=kvm,gic-version=3 -cpu Kunpeng-920 -bios $bios - -nic $nic + ${nic[@]} ) [ "$(arch)" == "x86_64" ] && arch_option=( -bios $bios - -nic $nic + ${nic[@]} ) ;; qemu-system-x86_64) arch_option=( -bios $bios - -nic $nic + ${nic[@]} ) ;; qemu-system-riscv64)