From b35f1092d6eda9de1db217c540124729f719646cc613e755f25659a03907aefe Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Fri, 15 Apr 2016 09:37:54 +0000 Subject: [PATCH] - bnc#972756 - Can't migrate HVM guest from SLES12SP1 Xen host to SLES12SP2 Alpha 1 host using xl migrate libxl.migrate-legacy-stream-read.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=419 --- libxl.migrate-legacy-stream-read.patch | 101 +++++++++++++++++++++++++ xen.changes | 7 ++ xen.spec | 2 + 3 files changed, 110 insertions(+) create mode 100644 libxl.migrate-legacy-stream-read.patch diff --git a/libxl.migrate-legacy-stream-read.patch b/libxl.migrate-legacy-stream-read.patch new file mode 100644 index 0000000..d47e41e --- /dev/null +++ b/libxl.migrate-legacy-stream-read.patch @@ -0,0 +1,101 @@ +tools/libxl: Fix legacy migration following COLO backchannel breakage + +c/s f5d947bf1b "tools/libxl: add back channel support to read stream" +made a bogus adjustment to libxl__stream_read_start(), including +removing the comment hinting at what was going on, which breaks +conversion of a legacy migration stream. + +Symptoms look like: + + root@anonymi:~ # xl migrate domU host + migration target: Ready to receive domain. + Saving to migration stream new xl format (info 0x1/0x0/2677) + xc: error: error polling suspend notification channel: -1: Internal error + Loading new save file (new xl fmt info 0x1/0x0/2677) + Savefile contains xl domain config in JSON format + Parsing config from + libxl: error: libxl_stream_read.c:327:stream_header_done: Invalid ident: expected 0x4c6962786c466d74, got 0x01f00f0000000000 + libxl: error: libxl_utils.c:430:libxl_read_exactly: file/stream truncated reading ipc msg header from domain 1 save/restore helper stdout pipe + +The adjustment is not required for backchannel support (as there is no +interaction between back channels and legacy conversion), and caused +stream->fd to be latched in the datacopier before legacy conversion +substitutes it for the fd which is the output of the conversion script. + +This causes libxl to consume data from the legacy stream rather than the +v2 stream, and for the conversion script to encounter an error as the +legacy stream appears to skip ahead. + +Undo the adjustments to libxl__stream_read_start(), and introduce a +better description of what is going on. Introduce some extra assertions +to try and catch similar breakage in the future. + +Reported-by: Olaf Hering +Signed-off-by: Andrew Cooper +--- +CC: Ian Jackson +CC: Wei Liu +CC: Olaf Hering +CC: Yang Hongyang +CC: Wen Congyang +CC: Changlong Xie +--- + tools/libxl/libxl_stream_read.c | 33 ++++++++++++++++++++++++--------- + 1 file changed, 24 insertions(+), 9 deletions(-) + +diff --git a/tools/libxl/libxl_stream_read.c b/tools/libxl/libxl_stream_read.c +index 9659051..89c2f21 100644 +--- a/tools/libxl/libxl_stream_read.c ++++ b/tools/libxl/libxl_stream_read.c +@@ -234,16 +234,16 @@ void libxl__stream_read_start(libxl__egc *egc, + stream->running = true; + stream->phase = SRS_PHASE_NORMAL; + +- dc->ao = stream->ao; +- dc->copywhat = "restore v2 stream"; +- dc->readfd = stream->fd; +- dc->writefd = -1; +- +- if (stream->back_channel) +- return; +- + if (stream->legacy) { +- /* Convert the legacy stream. */ ++ /* ++ * Convert the legacy stream. ++ * ++ * This results in a fork()/exec() of conversion helper script. It is ++ * passed the exiting stream->fd as an input, and returns the ++ * transformed stream via a new pipe. The fd of this new pipe then ++ * replaces stream->fd, to make the rest of the stream read code ++ * agnostic to whether legacy conversion is happening or not. ++ */ + libxl__conversion_helper_state *chs = &stream->chs; + + chs->legacy_fd = stream->fd; +@@ -258,10 +258,25 @@ void libxl__stream_read_start(libxl__egc *egc, + goto err; + } + ++ /* There should be no interaction of COLO backchannels and legacy ++ * stream conversion. */ ++ assert(!stream->back_channel); ++ ++ /* Confirm *dc is still zeroed out, while we shuffle stream->fd. */ ++ assert(dc->ao == NULL); + assert(stream->chs.v2_carefd); + stream->fd = libxl__carefd_fd(stream->chs.v2_carefd); + stream->dcs->libxc_fd = stream->fd; + } ++ /* stream->fd is now a v2 stream. */ ++ ++ dc->ao = stream->ao; ++ dc->copywhat = "restore v2 stream"; ++ dc->readfd = stream->fd; ++ dc->writefd = -1; ++ ++ if (stream->back_channel) ++ return; + + /* Start reading the stream header. */ + rc = setup_read(stream, "stream header", diff --git a/xen.changes b/xen.changes index 21e787b..ea76fe4 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Apr 15 09:22:31 UTC 2016 - ohering@suse.de + +- bnc#972756 - Can't migrate HVM guest from SLES12SP1 Xen host + to SLES12SP2 Alpha 1 host using xl migrate + libxl.migrate-legacy-stream-read.patch + ------------------------------------------------------------------- Fri Apr 1 20:14:38 UTC 2016 - jfehlig@suse.com diff --git a/xen.spec b/xen.spec index 571c77c..ddd18a7 100644 --- a/xen.spec +++ b/xen.spec @@ -198,6 +198,7 @@ Source57: xen-utils-0.1.tar.bz2 # For xen-libs Source99: baselibs.conf # Upstream patches +Patch0: libxl.migrate-legacy-stream-read.patch Patch164: xsa164.patch # Upstream qemu-traditional patches Patch250: VNC-Support-for-ExtendedKeyEvent-client-message.patch @@ -514,6 +515,7 @@ Authors: %prep %setup -q -n %xen_build_dir -a 1 -a 2 -a 5 -a 6 -a 57 # Upstream patches +%patch0 -p1 %patch164 -p1 # Upstream qemu patches %patch250 -p1