Skip to contentSkip to conversation

tests/acceptance/migration.py: Wait for both sides

PATCH Applied Dr. David Alan Gilbert (git) 2 participants 3 messages May 28, 2020 – May 31, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/acceptance/migration.py: Wait for both sides

From: "Dr. David Alan Gilbert" <[email protected]>

When the source finishes migration the destination will still be receiving the data sent by the source, so it might not have quite finished yet, so won't quite have reached 'completed'. This lead to occasional asserts in the next few checks.

After the source has finished, check the destination as well. (We can't just switch to checking the destination, because it doesn't give a status until it has started receiving the migration).

---
 tests/acceptance/migration.py | 4 ++++
 1 file changed, 4 insertions(+)
tests/acceptance/migration.py +4 -0
index 0365289cda..792639cb69 100644
@@ -35,6 +35,10 @@ class Migration(Test):
                       timeout=self.timeout,
                       step=0.1,
                       args=(src_vm,))
+        wait.wait_for(self.migration_finished,
+                      timeout=self.timeout,
+                      step=0.1,
+                      args=(dst_vm,))
         self.assertEqual(src_vm.command('query-migrate')['status'], 'completed')
         self.assertEqual(dst_vm.command('query-migrate')['status'], 'completed')
         self.assertEqual(dst_vm.command('query-status')['status'], 'running')
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

When the source finishes migration the destination will still be receiving the data sent by the source, so it might not have quite finished yet, so won't quite have reached 'completed'. This lead to occasional asserts in the next few checks.

After the source has finished, check the destination as well. (We can't just switch to checking the destination, because it doesn't give a status until it has started receiving the migration).

Fixes a7abb53765 ?
Quoted 12 lines
---
 tests/acceptance/migration.py | 4 ++++
 1 file changed, 4 insertions(+)
tests/acceptance/migration.py +0 -0
index 0365289cda..792639cb69 100644

tests/acceptance/migration.py class Migration(Test): · line 39

Quoted 5 lines
tests/acceptance/migration.py +2 -0
@@ -35,6 +35,10 @@ class Migration(Test):
                       timeout=self.timeout,
                       step=0.1,
                       args=(src_vm,))
+        wait.wait_for(self.migration_finished,
+                      timeout=self.timeout,

I'm not sure the Test.timeout is well used (it represents the maximum total time the framework will wait this test can take). Anyway this is incorrectly used before your patch, so I wouldn't bother...

tests/acceptance/migration.py class Migration(Test): · line 41

Quoted 2 lines
tests/acceptance/migration.py +2 -0
+                      step=0.1,
+                      args=(dst_vm,))
Quoted 4 lines
tests/acceptance/migration.py +0 -0
         self.assertEqual(src_vm.command('query-migrate')['status'], 'completed')
         self.assertEqual(dst_vm.command('query-migrate')['status'], 'completed')
         self.assertEqual(dst_vm.command('query-status')['status'], 'running')
#2 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 24 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

When the source finishes migration the destination will still be receiving the data sent by the source, so it might not have quite finished yet, so won't quite have reached 'completed'. This lead to occasional asserts in the next few checks.

After the source has finished, check the destination as well. (We can't just switch to checking the destination, because it doesn't give a status until it has started receiving the migration).

---
 tests/acceptance/migration.py | 4 ++++
 1 file changed, 4 insertions(+)
tests/acceptance/migration.py +0 -0
index 0365289cda..792639cb69 100644

tests/acceptance/migration.py class Migration(Test): · line 44

Quoted 10 lines
tests/acceptance/migration.py +4 -0
@@ -35,6 +35,10 @@ class Migration(Test):
                       timeout=self.timeout,
                       step=0.1,
                       args=(src_vm,))
+        wait.wait_for(self.migration_finished,
+                      timeout=self.timeout,
+                      step=0.1,
+                      args=(dst_vm,))
         self.assertEqual(src_vm.command('query-migrate')['status'], 'completed')
         self.assertEqual(dst_vm.command('query-migrate')['status'], 'completed')
         self.assertEqual(dst_vm.command('query-status')['status'], 'running')

Thanks, applied to my python-next tree:
https://gitlab.com/philmd/qemu/commits/python-next