Skip to content

Commit

Permalink
fix(test): do not pass network config to CPU template helper
Browse files Browse the repository at this point in the history
CPU template helper tool uses a microVM configuration we pass to it to
launch a VM and get it's CPU config. Our integration test that drives
that needs to configure the microVM with a network interface so that it
can SSH into it and run commands. However, when we pass to helper tool
a configuration that includes networking, we run into a race-condition
with creating/configuring a TAP device.

This commit passes a microVM configuration without a network interface
to the helper tool to avoid the race.

Signed-off-by: Babis Chalios <bchalios@amazon.es>
  • Loading branch information
bchalios authored and roypat committed Dec 1, 2023
1 parent e49a8dc commit 6704797
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,21 @@ def test_cpu_config_dump_vs_actual(
microvm = microvm_factory.build(guest_kernel, rootfs)
microvm.spawn()
microvm.basic_config()
microvm.add_net_iface()
vm_config_path = save_vm_config(microvm, tmp_path)

# Dump CPU config with the helper tool.
cpu_config_path = tmp_path / "cpu_config.json"
cpu_template_helper.template_dump(vm_config_path, cpu_config_path)
dump_cpu_config = build_cpu_config_dict(cpu_config_path)

# Add the network interface after we dump the CPU config via
# the CPU template helper tool. The tool creates a microVM with
# the config we pass it. When we pass it network configuration, we
# run in some sort of race condition with TAP device creation.
# CPU template helper tool doesn't need the network device configuration
# so, add it to `microvm` after we have dumped the CPU config.
microvm.add_net_iface()

# Retrieve actual CPU config from guest
microvm.start()
actual_cpu_config = {
Expand Down

0 comments on commit 6704797

Please sign in to comment.