[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V3 2/7] COLO-Proxy: Setup userspace colo-proxy on primary side



On Fri, Feb 17, 2017 at 10:18:24AM +0800, Zhang Chen wrote:
> In this patch we close kernel COLO-Proxy on primary side.
> 
> Signed-off-by: Zhang Chen <zhangchen.fnst@xxxxxxxxxxxxxx>
> ---
>  tools/libxl/libxl_colo_proxy.c | 27 +++++++++++++++++++++++++++
>  tools/libxl/libxl_colo_save.c  |  9 +++++++--
>  2 files changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/libxl/libxl_colo_proxy.c b/tools/libxl/libxl_colo_proxy.c
> index 0983f42..dd902fc 100644
> --- a/tools/libxl/libxl_colo_proxy.c
> +++ b/tools/libxl/libxl_colo_proxy.c
> @@ -152,6 +152,10 @@ int colo_proxy_setup(libxl__colo_proxy_state *cps)
>  
>      STATE_AO_GC(cps->ao);
>  
> +    /* If enable userspace proxy mode, we don't need setup kernel proxy */
> +    if (cps->is_userspace_proxy)
> +        return 0;
> +
>      skfd = socket(PF_NETLINK, SOCK_RAW, NETLINK_COLO);
>      if (skfd < 0) {
>          LOGD(ERROR, ao->domid, "can not create a netlink socket: %s", 
> strerror(errno));
> @@ -222,6 +226,13 @@ out:
>  
>  void colo_proxy_teardown(libxl__colo_proxy_state *cps)
>  {
> +    /*
> +     * If enable userspace proxy mode,
> +     * we don't need teardown kernel proxy
> +     */
> +    if (cps->is_userspace_proxy)
> +        return;
> +
>      if (cps->sock_fd >= 0) {
>          close(cps->sock_fd);
>          cps->sock_fd = -1;
> @@ -232,6 +243,13 @@ void colo_proxy_teardown(libxl__colo_proxy_state *cps)
>  
>  void colo_proxy_preresume(libxl__colo_proxy_state *cps)
>  {
> +    /*
> +     * If enable userspace proxy mode,
> +     * we don't need preresume kernel proxy
> +     */
> +    if (cps->is_userspace_proxy)
> +        return;
> +
>      colo_proxy_send(cps, NULL, 0, COLO_CHECKPOINT);
>      /* TODO: need to handle if the call fails... */
>  }
> @@ -262,6 +280,15 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,
>  
>      STATE_AO_GC(cps->ao);
>  
> +    /*
> +     * enable userspace proxy mode, tmp sleep.
> +     * then we will add qemu API support this func.
> +     */
> +    if (cps->is_userspace_proxy) {
> +        sleep(timeout_us / 1000000);

usleep is better.

But in general I don't think sleeping in libxl is a good idea.
What is the reason that you need to sleep here?

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.