Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[antlir2_vm] dump eth0 traffic when running in test mode
Summary: This diff provides a mechanism to dump eth0 traffic when running an antlir VM. Essentially, this adds a new option to `antlir2_vm run` called `--eth0-output-file`. When it is set, qemu will be configured to dump the traffic of `net0` interface to that file. By default, nothing is dumped. To plug this into the testing framework, when `antlir2_vm` test is called, it creates the blob artifacts that will be uploaded to TPX and passes the resulting file to `antlir2_vm run` via `--eth0-output-file`. Test Plan: ``` $ buck2 run fbcode//antlir/antlir2/antlir2_vm:antlir2_vm -- run -h Buck UI: https://www.internalfb.com/buck2/64d2ce42-afe3-42cf-9970-76387fcbb5a8 Network: Up: 0B Down: 0B Jobs completed: 6. Time elapsed: 0.0s. BUILD SUCCEEDED Run the VM. Must be executed inside container Usage: antlir2_vm run [OPTIONS] --machine-spec <MACHINE_SPEC> [COMMAND]... Arguments: [COMMAND]... Execute command through ssh inside VM Options: --machine-spec <MACHINE_SPEC> Json-encoded file for VM machine configuration --expect-failure Expects the VM to timeout or terminate early --postmortem The command should be run after VM termination. Console log will be available at env $CONSOLE_OUTPUT --timeout-secs <TIMEOUT_SECS> Timeout in seconds before VM will be terminated. None disables the timeout, which should only be used for interactive shells for development --console-output-file <CONSOLE_OUTPUT_FILE> Redirect console output to file. By default it's suppressed --output-dirs <OUTPUT_DIRS> Output directories that need to be available inside VM --command-envs <COMMAND_ENVS> Environment variables for the command --first-boot-command <FIRST_BOOT_COMMAND> Command requires first boot --eth0-output-file <ETH0_OUTPUT_FILE> Dump network traffic on eth0 to output to file. By default it is not dumped --console Drop into console prompt. This also enables console output on screen, unless `--console-output-file` is specified --container Drop into container shell outside VM -h, --help Print help ``` and ran: ``` buck2 test $(kerctl vmtest-config -e everstore:GICWmAACj33BEzsFAElJ4glD5YhXbuYfAAAf) fbcode//kernel/vmtest/uname_test:uname_test-6.9-local ``` https://www.internalfb.com/intern/testinfra/testconsole/testrun/6755399674977058/ leads to https://www.internalfb.com/intern/testinfra/diagnostics/6755399674977058.562950104331417.1727383743/ which has an "Artifacts" section with eth0.pcap Reviewed By: wujj123456 Differential Revision: D63487026 fbshipit-source-id: f6e63d2202a08d7b324364f7b492818de3224230
- Loading branch information