From: Bruno Alvisio <bruno.alvisio@gmail.com>
To: xen-devel@lists.xen.org, wei.liu2@citrix.com, dave@recoil.org,
ian.jackson@eu.citrix.com
Subject: [PATCH RFC v3 RESEND 09/12] Migration with Local Disks Mirroring: New stream phase type for libxc streams
Date: Sat, 23 Dec 2017 14:03:33 +0000 [thread overview]
Message-ID: <1514037816-40864-10-git-send-email-bruno.alvisio@gmail.com> (raw)
In-Reply-To: <1514037816-40864-1-git-send-email-bruno.alvisio@gmail.com>
Adapted libxc restore stream. Defined libxc stream phase types:
0. XC_STREAM_PHASE_DEFAULT: This is the stream phase when no local disks are
being mirrored as part of the domain save or restore (=0)
1. XC_STREAM_PHASE_POST_MIRROR_DISKS: This stream phase transfers the virtual
RAM from source to destination. It happens after disks mirroring is completed.
2. XC_STREAM_PHASE_PRE_MIRROR_DISKS: This stream transfers pfns and parameters
necessary to start the QEMU process in the destination. It happens before the
disks mirroring.
The PRE_MIRROR_DISKS phase stream type skips the stream_complete ops to restore
the domain. The restore is performed by the POST_MIRROR_DISKS phase stream that
is executed later in the restore flow. If no local disks are mirrored the
restore is executed by the DEFAULT phase stream type.
Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
---
tools/libxc/xc_sr_common.h | 1 +
tools/libxc/xc_sr_restore.c | 51 ++++++++++++++++++++++-----------------
tools/libxc/xc_sr_stream_format.h | 5 ++++
3 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index a145a15..8cf393f 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -177,6 +177,7 @@ struct xc_sr_context
xc_interface *xch;
uint32_t domid;
int fd;
+ int stream_phase;
xc_dominfo_t dominfo;
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index 7f74d28..924386c 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -736,7 +736,10 @@ static int restore(struct xc_sr_context *ctx)
struct xc_sr_record rec;
int rc, saved_rc = 0, saved_errno = 0;
- IPRINTF("Restoring domain");
+ if ( ctx->stream_phase != XC_STREAM_PHASE_PRE_MIRROR_DISKS )
+ IPRINTF("Restoring domain");
+ else
+ IPRINTF("Mirroring disks restoring phase");
rc = setup(ctx);
if ( rc )
@@ -799,11 +802,16 @@ static int restore(struct xc_sr_context *ctx)
* With Remus, if we reach here, there must be some error on primary,
* failover from the last checkpoint state.
*/
- rc = ctx->restore.ops.stream_complete(ctx);
- if ( rc )
- goto err;
+ if ( ctx->stream_phase != XC_STREAM_PHASE_PRE_MIRROR_DISKS )
+ {
+ rc = ctx->restore.ops.stream_complete(ctx);
+ if ( rc )
+ goto err;
- IPRINTF("Restore successful");
+ IPRINTF("Restore successful");
+ } else {
+ IPRINTF("Mirroring disks restore phase successful");
+ }
goto done;
err:
@@ -837,6 +845,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
{
.xch = xch,
.fd = io_fd,
+ .stream_phase = stream_phase
};
/* GCC 4.4 (of CentOS 6.x vintage) can' t initialise anonymous unions. */
@@ -890,29 +899,27 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
ctx.restore.p2m_size = nr_pfns;
if ( ctx.dominfo.hvm )
- {
ctx.restore.ops = restore_ops_x86_hvm;
- if ( restore(&ctx) )
- return -1;
- }
else
- {
ctx.restore.ops = restore_ops_x86_pv;
- if ( restore(&ctx) )
- return -1;
- }
- IPRINTF("XenStore: mfn %#"PRIpfn", dom %d, evt %u",
- ctx.restore.xenstore_gfn,
- ctx.restore.xenstore_domid,
- ctx.restore.xenstore_evtchn);
+ if ( restore(&ctx) )
+ return -1;
+
+ if ( stream_phase != XC_STREAM_PHASE_PRE_MIRROR_DISKS )
+ {
+ IPRINTF("XenStore: mfn %#"PRIpfn", dom %d, evt %u",
+ ctx.restore.xenstore_gfn,
+ ctx.restore.xenstore_domid,
+ ctx.restore.xenstore_evtchn);
- IPRINTF("Console: mfn %#"PRIpfn", dom %d, evt %u",
- ctx.restore.console_gfn,
- ctx.restore.console_domid,
- ctx.restore.console_evtchn);
+ IPRINTF("Console: mfn %#"PRIpfn", dom %d, evt %u",
+ ctx.restore.console_gfn,
+ ctx.restore.console_domid,
+ ctx.restore.console_evtchn);
- *console_gfn = ctx.restore.console_gfn;
+ *console_gfn = ctx.restore.console_gfn;
+ }
*store_mfn = ctx.restore.xenstore_gfn;
return 0;
diff --git a/tools/libxc/xc_sr_stream_format.h b/tools/libxc/xc_sr_stream_format.h
index 15ff1c7..c705da4 100644
--- a/tools/libxc/xc_sr_stream_format.h
+++ b/tools/libxc/xc_sr_stream_format.h
@@ -138,6 +138,11 @@ struct xc_sr_rec_hvm_params
struct xc_sr_rec_hvm_params_entry param[0];
};
+/* LIBXC stream phase types */
+#define XC_STREAM_PHASE_DEFAULT 0
+#define XC_STREAM_PHASE_POST_MIRROR_DISKS 1
+#define XC_STREAM_PHASE_PRE_MIRROR_DISKS 2
+
#endif
/*
* Local variables:
--
2.3.2 (Apple Git-55)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2017-12-23 14:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-23 14:03 [PATCH RFC v3 RESEND 00/12] Migration with Local Disks Mirroring Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 01/12] Migration with Local Disks Mirroring: Added support in libxl to handle QMP events Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 02/12] Migration with Local Disks Mirroring: Added QMP commands used for mirroring disks Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 03/12] Migration with Local Disks Mirroring: Refactored migrate_read_fixedmessage Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 04/12] Migration with Local Disks Mirroring: Added a new '-q' flag to xl migrate for disk mirorring Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 05/12] Migration with Local Disks Mirroring: QEMU process is started with '-incoming defer' option Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 06/12] Migration with Local Disks Mirroring: Added 'mirror_disks' field to domain_create_state Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 07/12] Migration with Local Disks Mirroring: Added new libxl_read_stream and callbacks in restore flow Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 08/12] Migration with Local Disks Mirroring: New stream phase type for libxl streams Bruno Alvisio
2017-12-23 14:03 ` Bruno Alvisio [this message]
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 10/12] Migration with Local Disks Mirroring: libxl save flow support Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 11/12] Migration with Local Disks Mirroring: libxl write stream support for stream phase type Bruno Alvisio
2017-12-23 14:03 ` [PATCH RFC v3 RESEND 12/12] Migration with Local Disks Mirroring: Introduce pre_mirror_disks_stream_phase op to xc_sr_save_ops Bruno Alvisio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1514037816-40864-10-git-send-email-bruno.alvisio@gmail.com \
--to=bruno.alvisio@gmail.com \
--cc=dave@recoil.org \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).