[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC v3 09/12] Migration with Local Disks Mirroring: New stream phase type for libxc streams
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@xxxxxxxxx> --- 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@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |