Skip to contentSkip to conversation

docs/devel/migration: start a debugging section

PATCH In review Marc-André Lureau 3 participants 5 messages Mar 30, 2020 – May 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs/devel/migration: start a debugging section

Explain how to use analyze-migration.py, this may help.

---
 docs/devel/migration.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
docs/devel/migration.rst +20 -0
index e88918f7639..2eb08624fc3 100644
@@ -50,6 +50,26 @@ All these migration protocols use the same infrastructure to
 save/restore state devices.  This infrastructure is shared with the
 savevm/loadvm functionality.
 
+Debugging
+=========
+
+The migration stream can be analyzed thanks to `scripts/analyze_migration.py`.
+
+Example usage:
+
+.. code-block:: shell
+
+  $ qemu-system-x86_64
+   (qemu) migrate "exec:cat > mig"
+  $ ./scripts/analyze_migration.py -f mig
+  {
+    "ram (3)": {
+        "section sizes": {
+            "pc.ram": "0x0000000008000000",
+  ...
+
+See also ``analyze_migration.py -h`` help for more options.
+
 Common infrastructure
 =====================
 
Signature · 1 line
2.26.0.rc2.42.g98cedd0233
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · * Marc-André Lureau ([email protected]) wrote:

Explain how to use analyze-migration.py, this may help.

Yes, it's quite useful for things like this; although things where multiple instances/instance_id's are the problem can be tricikier and some tracing can help.

Quoted 38 lines
---
 docs/devel/migration.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
docs/devel/migration.rst +20 -0
index e88918f7639..2eb08624fc3 100644
@@ -50,6 +50,26 @@ All these migration protocols use the same infrastructure to
 save/restore state devices.  This infrastructure is shared with the
 savevm/loadvm functionality.
 
+Debugging
+=========
+
+The migration stream can be analyzed thanks to `scripts/analyze_migration.py`.
+
+Example usage:
+
+.. code-block:: shell
+
+  $ qemu-system-x86_64
+   (qemu) migrate "exec:cat > mig"
+  $ ./scripts/analyze_migration.py -f mig
+  {
+    "ram (3)": {
+        "section sizes": {
+            "pc.ram": "0x0000000008000000",
+  ...
+
+See also ``analyze_migration.py -h`` help for more options.
+
 Common infrastructure
 =====================
 
Signature · 1 line
2.26.0.rc2.42.g98cedd0233

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Reviewed-by on v1 1/1
#2 lore raw
In reply to Marc-André Lureau
Quoted 24 lines · Marc-André Lureau

Explain how to use analyze-migration.py, this may help.

---
 docs/devel/migration.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
docs/devel/migration.rst +9 -0
index e88918f7639..2eb08624fc3 100644
@@ -50,6 +50,26 @@ All these migration protocols use the same infrastructure to
 save/restore state devices.  This infrastructure is shared with the
 savevm/loadvm functionality.
 
+Debugging
+=========
+
+The migration stream can be analyzed thanks to `scripts/analyze_migration.py`.
+
+Example usage:
+
+.. code-block:: shell
+

docs/devel/migration.rst All these migration protocols use the same infrastructure to · line 71

Quoted 10 lines
docs/devel/migration.rst +10 -0
+  $ qemu-system-x86_64
+   (qemu) migrate "exec:cat > mig"
+  $ ./scripts/analyze_migration.py -f mig
+  {
+    "ram (3)": {
+        "section sizes": {
+            "pc.ram": "0x0000000008000000",
+  ...
+
+See also ``analyze_migration.py -h`` help for more options.

Side note: who else loves the fact that we have both spellings of analyse - 'z' and 's' in the scripts directory. We ought to pick one :-)

Another side note - could analyze_migration be used as the basis for doing compatibility testing of migration support between QEMU versions ?

eg, we can have a pair of files "foo.argv" and "foo.migration" containing the QEMU argv to run, and the corresponding output expected from "analyze_migration.py" (perhaps we certain bits like precise register values scrubbed). On each release commit a new pairs to git for new machine types, with various interesting argv, and then we can validate that all future versions of QEMU produce the same output & thus remain migration compatible ? This feels like this kind of approach could have caught the regression today with the duplicated serial device migration output sections.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw
Quoted 38 lines · * Daniel P. Berrangé ([email protected]) wrote:
Quoted 24 lines · Marc-André Lureau

Explain how to use analyze-migration.py, this may help.

---
 docs/devel/migration.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
docs/devel/migration.rst +9 -0
index e88918f7639..2eb08624fc3 100644
@@ -50,6 +50,26 @@ All these migration protocols use the same infrastructure to
 save/restore state devices.  This infrastructure is shared with the
 savevm/loadvm functionality.
 
+Debugging
+=========
+
+The migration stream can be analyzed thanks to `scripts/analyze_migration.py`.
+
+Example usage:
+
+.. code-block:: shell
+

docs/devel/migration.rst All these migration protocols use the same infrastructure to · line 71

Quoted 10 lines
docs/devel/migration.rst +10 -0
+  $ qemu-system-x86_64
+   (qemu) migrate "exec:cat > mig"
+  $ ./scripts/analyze_migration.py -f mig
+  {
+    "ram (3)": {
+        "section sizes": {
+            "pc.ram": "0x0000000008000000",
+  ...
+
+See also ``analyze_migration.py -h`` help for more options.
Quoted 3 lines

Side note: who else loves the fact that we have both spellings of analyse - 'z' and 's' in the scripts directory. We ought to pick one :-)

Yes I hit that.

Quoted 3 lines

Another side note - could analyze_migration be used as the basis for doing compatibility testing of migration support between QEMU versions ?

I use scripts/vmstate-static-checker.py for this.

Quoted 9 lines

eg, we can have a pair of files "foo.argv" and "foo.migration" containing the QEMU argv to run, and the corresponding output expected from "analyze_migration.py" (perhaps we certain bits like precise register values scrubbed). On each release commit a new pairs to git for new machine types, with various interesting argv, and then we can validate that all future versions of QEMU produce the same output & thus remain migration compatible ? This feels like this kind of approach could have caught the regression today with the duplicated serial device migration output sections.

It could; although it can be a bit more subtle - the analysis is done on a separate XML structure that only mostly reflects the data structure in the file. For example, in the case we were fighting today we inserted an extra block level as far as the XML sees it, but that doesn't change the onwire format.

Dave

Quoted 6 lines

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#4 lore raw
In reply to Marc-André Lureau
Quoted 3 lines · * Marc-André Lureau ([email protected]) wrote:

Explain how to use analyze-migration.py, this may help.

Queued

Quoted 39 lines
---
 docs/devel/migration.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
docs/devel/migration.rst +20 -0
index e88918f7639..2eb08624fc3 100644
@@ -50,6 +50,26 @@ All these migration protocols use the same infrastructure to
 save/restore state devices.  This infrastructure is shared with the
 savevm/loadvm functionality.
 
+Debugging
+=========
+
+The migration stream can be analyzed thanks to `scripts/analyze_migration.py`.
+
+Example usage:
+
+.. code-block:: shell
+
+  $ qemu-system-x86_64
+   (qemu) migrate "exec:cat > mig"
+  $ ./scripts/analyze_migration.py -f mig
+  {
+    "ram (3)": {
+        "section sizes": {
+            "pc.ram": "0x0000000008000000",
+  ...
+
+See also ``analyze_migration.py -h`` help for more options.
+
 Common infrastructure
 =====================
 
Signature · 1 line
2.26.0.rc2.42.g98cedd0233

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK