Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion chv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ let
# Crane lib with proper Rust toolchain
craneLib' = craneLib.overrideToolchain rustToolchain;

jsonFilter = path: _type: builtins.match ".*json$" path != null;
sourceFilter = path: type: (jsonFilter path type) || (craneLib.filterCargoSources path type);

commonArgs =
let
src = craneLib'.cleanCargoSource cloud-hypervisor-src;
src = lib.cleanSourceWith {
src = cloud-hypervisor-src;
filter = sourceFilter;
name = "source";
};
in
{
inherit src;
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
};
cloud-hypervisor-src = {
# url = "git+file:<path/to/cloud-hypervisor>";
url = "github:cyberus-technology/cloud-hypervisor?ref=gardenlinux";
url = "github:amphi/cloud-hypervisor?ref=migration-rarp";
flake = false;
};
edk2-src = {
Expand Down
31 changes: 30 additions & 1 deletion tests/testscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ def test_live_migration(self):
want to test.
We also hot-attach some devices before migrating, in order to cover
proper migration of those devices.

This test also checks that the destination host sends out RARP packets
to announce its new location to the network.
"""

controllerVM.succeed("virsh define /etc/domain-chv.xml")
Expand All @@ -509,16 +512,42 @@ def test_live_migration(self):
"virsh attach-disk --domain testvm --target vdb --persistent --source /var/lib/libvirt/storage-pools/nfs-share/disk.img",
)

for i in range(2):
# We use tcpdump and tshark to check for the RARP packets.
def start_capture(machine):
machine.succeed(
"systemd-run --unit tcpdump-mig -- bash -lc 'tcpdump -i any -w /tmp/rarp.pcap \"ether proto 0x8035\" 2> /tmp/rarp.log'"
)
machine.wait_until_succeeds("grep -q 'listening on any' /tmp/rarp.log")

def stop_capture_and_count_packets(machine):
machine.succeed("systemctl stop tcpdump-mig")
rarps = (
machine.succeed(
'tshark -r /tmp/rarp.pcap -Y "sll.etype == 0x8035" -T fields -e sll.src.eth'
)
.strip()
.split("\n")
)

# We only check whether we got rarp packets for both NICs, by
# looking at the source MAC addresses.
self.assertEqual(len(set(rarps)), 2)

for _ in range(2):
start_capture(computeVM)
# Explicitly use IP in desturi as this was already a problem in the past
controllerVM.succeed(
"virsh migrate --domain testvm --desturi ch+tcp://192.168.100.2/session --persistent --live --p2p"
)
wait_for_ssh(computeVM)
stop_capture_and_count_packets(computeVM)

start_capture(controllerVM)
computeVM.succeed(
"virsh migrate --domain testvm --desturi ch+tcp://controllerVM/session --persistent --live --p2p"
)
wait_for_ssh(controllerVM)
stop_capture_and_count_packets(controllerVM)

def test_live_migration_with_hotplug(self):
"""
Expand Down