Re: [Xen-devel] how to recognize in libxl that a domU has qemu-xen attached?

2018-05-17 Thread Olaf Hering
Am Thu, 17 May 2018 16:54:00 +0200
schrieb Olaf Hering :

> Am Thu, 17 May 2018 14:55:10 +0200
> schrieb Juergen Gross :
> > libxl__need_xenpv_qemu() is used to determine whether a pv domain needs
> > a qemu process for at least one backend.   
> Thanks. Too bad, d_config is not available in that context. It is probably 
> known somewhere by the callers. I guess such caller needs to pass a bool down 
> to suspend/resume.

I think we may get around that missing d_config like that, I will test this 
approach:

--- xen-4.10.0-testing.orig/tools/libxl/libxl_dom_suspend.c
+++ xen-4.10.0-testing/tools/libxl/libxl_dom_suspend.c
@@ -377,7 +377,9 @@ static void domain_suspend_common_guest_
 libxl__ev_xswatch_deregister(gc, &dsps->guest_watch);
 libxl__ev_time_deregister(gc, &dsps->guest_timeout);
 
-if (dsps->type == LIBXL_DOMAIN_TYPE_HVM) {
+if (dsps->type == LIBXL_DOMAIN_TYPE_HVM ||
+libxl__device_model_version_running(gc, domid) ==
+LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
 rc = libxl__domain_suspend_device_model(gc, dsps);
 if (rc) {
 LOGD(ERROR, dsps->domid,
@@ -460,7 +462,9 @@ int libxl__domain_resume(libxl__gc *gc,
 goto out;
 }
 
-if (type == LIBXL_DOMAIN_TYPE_HVM) {
+if (type == LIBXL_DOMAIN_TYPE_HVM ||
+libxl__device_model_version_running(gc, domid) ==
+LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
 rc = libxl__domain_resume_device_model(gc, domid);
 if (rc) {
 LOGD(ERROR, domid, "failed to resume device model:%d", rc);

Olaf


pgpP8oF0VS8LS.pgp
Description: Digitale Signatur von OpenPGP
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] how to recognize in libxl that a domU has qemu-xen attached?

2018-05-17 Thread Olaf Hering
Am Thu, 17 May 2018 16:54:00 +0200
schrieb Olaf Hering :

> Thanks. Too bad, d_config is not available in that context. It is probably 
> known somewhere by the callers. I guess such caller needs to pass a bool down 
> to suspend/resume.

It seems nothing inside libxl knows about libxl_domain_config, only callers of 
the public libxl_domain_suspend API do actually create it once. AFAICS only the 
LIBXL_SUSPEND_* 'flags' would allow to pass something down to the relevant 
code. But the resumer may not know about them...

Olaf


pgpYdf8_1Z9hN.pgp
Description: Digitale Signatur von OpenPGP
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] how to recognize in libxl that a domU has qemu-xen attached?

2018-05-17 Thread Olaf Hering
Am Thu, 17 May 2018 14:55:10 +0200
schrieb Juergen Gross :

> libxl__need_xenpv_qemu() is used to determine whether a pv domain needs
> a qemu process for at least one backend. 

Thanks. Too bad, d_config is not available in that context. It is probably 
known somewhere by the callers. I guess such caller needs to pass a bool down 
to suspend/resume.

Olaf


pgpV619VpXj0Y.pgp
Description: Digitale Signatur von OpenPGP
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] how to recognize in libxl that a domU has qemu-xen attached?

2018-05-17 Thread Juergen Gross
On 17/05/18 14:33, Olaf Hering wrote:
> In the other thread about the unsolved migration bugs in qemu-xen it became 
> clear that "xen-save-devices-state" must not only be called for HVM, but for 
> every domU that has qemu-xen attached to it. I wonder how to check for that 
> fact from the migration code. While it can continue to rely on 
> LIBXL_DOMAIN_TYPE_HVM make that call, for  LIBXL_DOMAIN_TYPE_PV it is 
> apparently not that easy. Is libxl__need_xenpv_qemu the API to use for the 
> decision if libxl__qmp_stop/libxl__qmp_save/libxl__qmp_resume have to be 
> called during migration?

libxl__need_xenpv_qemu() is used to determine whether a pv domain needs
a qemu process for at least one backend. To check for the correct qemu
type you need to call libxl__device_model_version_running() and test the
return value being LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN. So you need:

if (libxl__need_xenpv_qemu(gc, d_config) &&
libxl__device_model_version_running(gc, domid) ==
LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN)
libxl__qmp_stop(...);


Juergen

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel