Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Macvtap bridge for cloud hypvervisor

Dom edited this page Feb 23, 2023 · 9 revisions

Following the macvtap setup doc to setup macvtap, CLH report error. Details in: https://github.com/cloud-hypervisor/cloud-hypervisor/discussions/5084

Thanks michael2012z ,he suggests to check a test case:

./scripts/dev_cli.sh tests --integration -- --test-filter test_macvtap_hotplug The script calls docker:

docker run --workdir /cloud-hypervisor --rm --privileged --security-opt seccomp=unconfined --ipc=host --net=bridge --mount type=tmpfs,destination=/tmp --volume /dev:/dev --volume /home/dom/cloud-hypervisor/cloud-hypervisor:/cloud-hypervisor --volume /root/workloads:/root/workloads --env USER=root --env CH_LIBC=gnu cloudhypervisor/dev:20230116-0 ./scripts/run_integration_tests_aarch64.sh --hypervisor kvm --test-filter test_macvtap_hotplug Then I run the following command on Arm64 server:

USER=root CH_LIBC=gnu ./scripts/run_integration_tests_aarch64.sh --hypervisor kvm --test-filter test_macvtap_hotplug 2>&1 | tee tlog The two results were passed.

I add some log in tests/integration.rs .But they were not found in the log file.

I must run cargo test directly:

cargo test common_parallel::test_macvtap_hotplug --target aarch64-unknown-linux-gnu -- --nocapture 2>&1 | tee tlog_cargo

command = sudo ip link delete guestmacvtap1 command = sudo ip link delete hostmacvtap1 command = sudo ip link add link enP9p3s0 name guestmacvtap1 type macvtap mod bridge command = sudo ip link set guestmacvtap1 address 12:34:56:78:90:01 up command = sudo ip link show guestmacvtap1 command = sudo chown $UID.$UID /dev/tap107 command = sudo ip link add link enP9p3s0 name hostmacvtap1 type macvtap mod bridge command = sudo ip address add 192.168.1.1/24 dev hostmacvtap1 command = sudo ip link set dev hostmacvtap1 up ==== Start cloud-hypervisor command-line ====

"target/aarch64-unknown-linux-gnu/debug/cloud-hypervisor" "--cpus" "boot=2" "--memory" "size=512M" "--kernel" "/root/workloads/CLOUDHV_EFI.fd" "--cmdline" "root=/dev/vda1 console=hvc0 rw systemd.journald.forward_to_console=1" "--disk" "path=/tmp/chtLUHf9/osdisk.img" "--disk" "path=/tmp/chtLUHf9/cloudinit" "--api-socket" "/tmp/chtLUHf9/cloud-hypervisor.sock" "-v" "-v" ch-remote /tmp/chtLUHf9/cloud-hypervisor.sock add-net fd=[3,4],mac=12:34:56:78:90:01,num_queues=4 guest:remote_command_w_output,{"id":"_net0","bdf":"0000:00:05.0"} guest:wait_vm_boot guest:ssh_command ip -o link child kill command = sudo ip link del guestmacvtap1 command = sudo ip link del hostmacvtap1 The test case use ch-remote to add macvtap for the VM,I still don't know how to use --net fd=3,mac=$mac 3<>$"$tapdevice" in the shell.

Clone this wiki locally