[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v11 26/27] setup and control colo proxy on secondary side
From: Wen Congyang <wency@xxxxxxxxxxxxxx> Signed-off-by: Yang Hongyang <hongyang.yang@xxxxxxxxxxxx> Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx> Signed-off-by: Changlong Xie <xiecl.fnst@xxxxxxxxxxxxxx> --- tools/libxl/libxl_colo_restore.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_restore.c index 8b343c0..52e44a2 100644 --- a/tools/libxl/libxl_colo_restore.c +++ b/tools/libxl/libxl_colo_restore.c @@ -37,9 +37,11 @@ struct libxl__colo_restore_checkpoint_state { int); }; +extern const libxl__checkpoint_device_instance_ops colo_restore_device_nic; extern const libxl__checkpoint_device_instance_ops colo_restore_device_qdisk; static const libxl__checkpoint_device_instance_ops *colo_restore_ops[] = { + &colo_restore_device_nic, &colo_restore_device_qdisk, NULL, }; @@ -139,8 +141,14 @@ static int init_device_subkind(libxl__checkpoint_devices_state *cds) int rc; STATE_AO_GC(cds->ao); + rc = init_subkind_colo_nic(cds); + if (rc) goto out; + rc = init_subkind_qdisk(cds); - if (rc) goto out; + if (rc) { + cleanup_subkind_colo_nic(cds); + goto out; + } rc = 0; out: @@ -152,6 +160,7 @@ static void cleanup_device_subkind(libxl__checkpoint_devices_state *cds) /* cleanup device subkind-specific state in the libxl ctx */ STATE_AO_GC(cds->ao); + cleanup_subkind_colo_nic(cds); cleanup_subkind_qdisk(cds); } @@ -341,6 +350,8 @@ static void colo_restore_teardown_devices_done(libxl__egc *egc, if (crcs->teardown_devices) cleanup_device_subkind(cds); + colo_proxy_teardown(&crs->cps); + rc = crcs->saved_rc; if (!rc) { crcs->callback = do_failover_done; @@ -592,6 +603,8 @@ static void colo_restore_preresume_cb(libxl__egc *egc, } } + colo_proxy_preresume(&crs->cps); + colo_restore_resume_vm(egc, crcs); return; @@ -628,6 +641,8 @@ static void colo_resume_vm_done(libxl__egc *egc, crcs->status = LIBXL_COLO_RESUMED; + colo_proxy_postresume(&crs->cps); + /* avoid calling stream->completion_callback() more than once */ if (crs->saved_cb) { dcs->callback = crs->saved_cb; @@ -749,13 +764,20 @@ static void colo_setup_checkpoint_devices(libxl__egc *egc, STATE_AO_GC(crs->ao); - /* TODO: nic support */ - cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VBD); + cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) | + (1 << LIBXL__DEVICE_KIND_VBD); cds->callback = colo_restore_setup_cds_done; cds->ao = ao; cds->domid = crs->domid; cds->ops = colo_restore_ops; + crs->cps.ao = ao; + if (colo_proxy_setup(&crs->cps)) { + LOG(ERROR, "COLO: failed to setup colo proxy for guest with domid %u", + cds->domid); + goto out; + } + if (init_device_subkind(cds)) goto out; -- 1.9.3 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |