Skip to contentSkip to conversation

arch-run: Support multiple migrations

RFC PATCH New Nicholas Piggin 1 participant 1 message Jul 24, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 arch-run: Support multiple migrations

It could be nice to migrate more than once in a test case. This patch supports multiple migrations by flipping dest file/socket variables to source after the migration is complete, ready to start again. Test cases may now switch to calling migrate() one or more times as needed.

Only problem here is that the migration command now polls for the "EXIT: STATUS" output line to see if the test is finished or wants another migration, and x86 doesn't seem to output that line. It does print something, but only if !no_test_device, so this will break x86. I'm not sure why the exit status isn't printed in that case. Any ideas?

Thanks,
Nick

---
 lib/migrate.c         |  8 +++---
 lib/migrate.h         |  1 +
 scripts/arch-run.bash | 59 +++++++++++++++++++++++++++++++++++--------
 3 files changed, 53 insertions(+), 15 deletions(-)
lib/migrate.c +4 -4
index 527e63ae..b7721659 100644
@@ -8,8 +8,10 @@
 #include <libcflat.h>
 #include "migrate.h"
 
-/* static for now since we only support migrating exactly once per test. */
-static void migrate(void)
+/*
+ * Initiate migration and wait for it to complete.
+ */
+void migrate(void)
 {
 	puts("Now migrate the VM, then press a key to continue...\n");
 	(void)getchar();
@@ -19,8 +21,6 @@ static void migrate(void)
 /*
  * Initiate migration and wait for it to complete.
  * If this function is called more than once, it is a no-op.
- * Since migrate_cmd can only migrate exactly once this function can
- * simplify the control flow, especially when skipping tests.
  */
 void migrate_once(void)
 {
lib/migrate.h +1 -0
index 3c94e6af..2af06a72 100644
@@ -6,4 +6,5 @@
  * Author: Nico Boehr <[email protected]>
  */
 
+void migrate(void);
 void migrate_once(void);
scripts/arch-run.bash +48 -11

88 lines not on this page · raw message

Signature · 1 line
2.40.1