Skip to content

Commit b2bd476

Browse files
committed
tests: add test that reboots a guest during live migration
1 parent b4aed85 commit b2bd476

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/testscript.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,13 +1445,42 @@ def test_live_migration_tls(self):
14451445

14461446
assert wait_for_ssh(dst)
14471447

1448+
def test_guest_reboot_during_live_migration(self):
1449+
"""
1450+
Test that a guest induced reboot during live migration keeps the VM
1451+
running. The exact semantics need to be sorted out, but at least
1452+
CHV and libvirt should handle this situation gracefully.
1453+
XXX: the exact semantics of this scenario are TBD
1454+
"""
1455+
1456+
controllerVM.succeed("virsh define /etc/domain-chv.xml")
1457+
controllerVM.succeed("virsh start testvm")
1458+
1459+
assert wait_for_ssh(controllerVM)
1460+
1461+
status, _ = ssh(controllerVM, "screen -dmS stress stress -m 4 --vm-bytes 400M")
1462+
assert status == 0
1463+
1464+
# breakpoint()
1465+
status, _ = ssh(controllerVM, "screen -dmS nohup sh -c 'sleep 10 && reboot'")
1466+
assert status == 0
1467+
1468+
controllerVM.fail(
1469+
"virsh migrate --domain testvm --desturi ch+tcp://computeVM/session --persistent --live --p2p"
1470+
)
1471+
1472+
computeVM.fail("virsh list | grep testvm")
1473+
controllerVM.succeed("virsh list | grep testvm")
1474+
1475+
14481476

14491477
def suite():
14501478
# Test cases in alphabetical order
14511479
testcases = [
14521480
LibvirtTests.test_disk_is_locked,
14531481
LibvirtTests.test_disk_resize_qcow2,
14541482
LibvirtTests.test_disk_resize_raw,
1483+
LibvirtTests.test_guest_reboot_during_live_migration,
14551484
LibvirtTests.test_hotplug,
14561485
LibvirtTests.test_hugepages,
14571486
LibvirtTests.test_hugepages_prefault,

0 commit comments

Comments
 (0)