[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC Patch v2 11/16] xc_restore: implement for colo
All restore callbacks have been implemented. Use this callback for colo in xc_restore. Add a new arguement to tell xc_restore if it should use colo mode or not. Signed-off-by: Ye Wei <wei.ye1987@xxxxxxxxx> Signed-off-by: Jiang Yunhong <yunhong.jiang@xxxxxxxxx> Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx> --- tools/xcutils/xc_restore.c | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) diff --git a/tools/xcutils/xc_restore.c b/tools/xcutils/xc_restore.c index 35d725c..659c159 100644 --- a/tools/xcutils/xc_restore.c +++ b/tools/xcutils/xc_restore.c @@ -14,6 +14,7 @@ #include <xenctrl.h> #include <xenguest.h> +#include <xc_save_restore_colo.h> int main(int argc, char **argv) @@ -26,10 +27,12 @@ main(int argc, char **argv) unsigned long store_mfn, console_mfn; xentoollog_level lvl; xentoollog_logger *l; + struct restore_callbacks callback, *callback_p; + int colo = 0; - if ( (argc != 8) && (argc != 9) ) + if ( (argc != 8) && (argc != 9) && (argc != 10) ) errx(1, "usage: %s iofd domid store_evtchn " - "console_evtchn hvm pae apic [superpages]", argv[0]); + "console_evtchn hvm pae apic [superpages [colo]]", argv[0]); lvl = XTL_DETAIL; lflags = XTL_STDIOSTREAM_SHOW_PID | XTL_STDIOSTREAM_HIDE_PROGRESS; @@ -46,20 +49,39 @@ main(int argc, char **argv) pae = atoi(argv[6]); apic = atoi(argv[7]); if ( argc == 9 ) - superpages = atoi(argv[8]); + superpages = atoi(argv[8]); else - superpages = !!hvm; + superpages = !!hvm; + + if ( argc == 10 ) + colo = atoi(argv[9]); + + if ( colo ) + { + callback.init = colo_init; + callback.free = colo_free; + callback.get_page = colo_get_page; + callback.flush_memory = colo_flush_memory; + callback.update_p2m = colo_update_p2m_table; + callback.finish_restotre = colo_finish_restore; + callback.data = NULL; + callback_p = &callback; + } + else + { + callback_p = NULL; + } ret = xc_domain_restore(xch, io_fd, domid, store_evtchn, &store_mfn, 0, console_evtchn, &console_mfn, 0, hvm, pae, superpages, - 0, NULL, NULL); + 0, NULL, callback_p); if ( ret == 0 ) { - printf("store-mfn %li\n", store_mfn); + printf("store-mfn %li\n", store_mfn); if ( !hvm ) printf("console-mfn %li\n", console_mfn); - fflush(stdout); + fflush(stdout); } xc_interface_close(xch); -- 1.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |