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

Re: [Xen-devel] [RFC / PATCH] libxl: Prevent qemu closing QMP socket on shutdown before libxl is done with it.



On Thu, 22 Jan 2015, Sander Eikelenboom wrote:
> While this fixes the race and error on shutdown of a HVM guest with 
> pci-passthrough,
> i don't know if this could give problems in other areas (migration ?),
> hence posted as RFC.

I think the patch should be OK. Maybe you could test it with local
migration (migrating a guest to localhost) and tell us if everything is
OK?

If so, I think it should be committed.


> --
> Sander
> 
> 8< -----------
> At present on shutdown when using pci-passthrough with qemu-xen, qemu closes 
> the QMP
> socket before libxl is done with it causing these errors to be logged by 
> libxl:
> 
>     Waiting for domain test (domid 1) to die [pid 11568]
>     Domain 1 has shut down, reason code 0 0x0
>     Action for shutdown reason code 0 is destroy
>     Domain 1 needs to be cleaned up: destroying the domain
>     libxl: error: libxl_qmp.c:443:qmp_next: Socket read error: Connection 
> reset by peer
>     libxl: error: libxl_qmp.c:701:libxl__qmp_initialize: Failed to connect to 
> QMP
>     libxl: error: libxl_qmp.c:686:libxl__qmp_initialize: Connection error: 
> Connection refused
>     libxl: error: libxl_dm.c:1588:kill_device_model: Device Model already 
> exited
>     Done. Exiting now
> 
> Prevent this by using the qemu '-no-shutdown' parameter which is described as 
> doing:
>     "Donât exit QEMU on guest shutdown, but instead only stop the emulation.
>      This allows for instance switching to monitor to commit changes to the 
> disk image."
> 
> So Qemu will stop emulating, but keeps the QMP socket open and waits for 
> libxl to
> kill the qemu process when it is done, preventing the race and resulting in 
> this
> to be logged by libxl:
> 
>     Waiting for domain test (domid 1) to die [pid 10859]
>     Domain 1 has shut down, reason code 0 0x0
>     Action for shutdown reason code 0 is destroy
>     Domain 1 needs to be cleaned up: destroying the domain
>     Done. Exiting now
> 
> Signed-off-by: Sander Eikelenboom <linux@xxxxxxxxxxxxxx>
> ---
>  tools/libxl/libxl_dm.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index fc3f5a7..3152c87 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -435,6 +435,7 @@ static char ** 
> libxl__build_device_model_args_new(libxl__gc *gc,
>                                      "path=%s/qmp-libxl-%d,server,nowait",
>                                      libxl__run_dir_path(), guest_domid));
>  
> +    flexarray_append(dm_args, "-no-shutdown");
>      flexarray_append(dm_args, "-mon");
>      flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
>  
> -- 
> 1.7.10.4
> 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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