aboutsummaryrefslogtreecommitdiff
path: root/docs/devel/migration.rst
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2018-08-06 13:13:04 +0100
committerJuan Quintela <quintela@redhat.com>2018-08-22 11:40:47 +0200
commit3eb21fe9e5a06e485dbb27838422ef85f4ae7967 (patch)
tree4941ac1b08687b46cffe13e1e5c4865c9503f3a2 /docs/devel/migration.rst
parent6f4923fcad305966b10780601a016ecaf8a91224 (diff)
downloadqemu-3eb21fe9e5a06e485dbb27838422ef85f4ae7967.zip
qemu-3eb21fe9e5a06e485dbb27838422ef85f4ae7967.tar.gz
qemu-3eb21fe9e5a06e485dbb27838422ef85f4ae7967.tar.bz2
docs/migration: Clarify pre_load in subsections
Clarify that the pre_load function in a subsection is only called if the subsection is found; to handle a missing subsection you may set values in the pre_load of the parent vmsd. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'docs/devel/migration.rst')
-rw-r--r--docs/devel/migration.rst15
1 files changed, 9 insertions, 6 deletions
diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst
index 6ed3fce..6875707 100644
--- a/docs/devel/migration.rst
+++ b/docs/devel/migration.rst
@@ -240,10 +240,13 @@ should succeed even with the data missing. To support this the
subsection can be connected to a device property and from there
to a versioned machine type.
-One important note is that the post_load() function is called "after"
-loading all subsections, because a newer subsection could change same
-value that it uses. A flag, and the combination of pre_load and post_load
-can be used to detect whether a subsection was loaded, and to
+The 'pre_load' and 'post_load' functions on subsections are only
+called if the subsection is loaded.
+
+One important note is that the outer post_load() function is called "after"
+loading all subsections, because a newer subsection could change the same
+value that it uses. A flag, and the combination of outer pre_load and
+post_load can be used to detect whether a subsection was loaded, and to
fall back on default behaviour when the subsection isn't present.
Example:
@@ -315,8 +318,8 @@ For example:
the property to false.
c) Add a static bool support_foo function that tests the property.
d) Add a subsection with a .needed set to the support_foo function
- e) (potentially) Add a pre_load that sets up a default value for 'foo'
- to be used if the subsection isn't loaded.
+ e) (potentially) Add an outer pre_load that sets up a default value
+ for 'foo' to be used if the subsection isn't loaded.
Now that subsection will not be generated when using an older
machine type and the migration stream will be accepted by older