diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2010-10-28 12:19:43 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2010-10-28 12:19:43 +0100 |
commit | 2526ff6cc98fc971041442e63bfe43bdc8bed9d2 (patch) | |
tree | e3b4af37eb7f696b4cee9b7bebe3225f6aac3ef9 /tools/libxc/xc_domain_restore.c | |
parent | 7134cbcc19fc72720338009ef2e93c96f9ba2963 (diff) | |
download | xen-2526ff6cc98fc971041442e63bfe43bdc8bed9d2.tar.gz xen-2526ff6cc98fc971041442e63bfe43bdc8bed9d2.tar.bz2 xen-2526ff6cc98fc971041442e63bfe43bdc8bed9d2.zip |
libxl: Fix migration of HVM guests
In the default "QemuDeviceModelRecord"-style HVM tail of the migration
protocol the size of the qemu save record is unknown at the receiver
and therefore it must read until EOF. This is not compatible with the
xl migration protocol which contains a post-migration handshake and
therefore cannot close the socket on the sending end.
What is required is an explicit length field for the save record,
which the "RemusDeviceModelState"-style HVM tail includes.
Rather than overload the "RemusDeviceModelState" name for a non-Remus
use case (on off chance that they need to diverge for some reason in
the future) introduce a third style called "DeviceModelRecord0002"
which is identical to current "RemusDeviceModelState"-style.
Hopefully the inclusion of a number here will allow easier extension
in the future without needing to come up with increasingly less
helpful names!
Also propagate errors from xc_domain_save and
libxl__domain_suspend_common to callers.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_domain_restore.c')
-rw-r--r-- | tools/libxc/xc_domain_restore.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c index c9f3916b34..7c64a4929b 100644 --- a/tools/libxc/xc_domain_restore.c +++ b/tools/libxc/xc_domain_restore.c @@ -494,13 +494,18 @@ static int buffer_tail_hvm(xc_interface *xch, struct restore_ctx *ctx, return -1; } - /* The normal live-migration QEMU record has no length information. + /* The legacy live-migration QEMU record has no length information. * Short of reimplementing the QEMU parser, we're forced to just read - * until EOF. Remus gets around this by sending a different signature - * which includes a length prefix */ + * until EOF. + * + * Gets around this by sending a different signatures for the new + * live-migration QEMU record and Remus which includes a length + * prefix + */ if ( !memcmp(qemusig, "QemuDeviceModelRecord", sizeof(qemusig)) ) return compat_buffer_qemu(xch, ctx, fd, buf); - else if ( !memcmp(qemusig, "RemusDeviceModelState", sizeof(qemusig)) ) + else if ( !memcmp(qemusig, "DeviceModelRecord0002", sizeof(qemusig)) || + !memcmp(qemusig, "RemusDeviceModelState", sizeof(qemusig)) ) return buffer_qemu(xch, ctx, fd, buf); qemusig[20] = '\0'; |