Skip to contentSkip to conversation

how to recognize in libxl that a domU has qemu-xen attached?

DISCUSSION Olaf Hering 2 participants 5 messages May 17, 2018

lore
Share & tools
lore
#0 lore raw

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?

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw
Quoted 1 line · Olaf Hering

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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

Am Thu, 17 May 2018 14:55:10 +0200
schrieb Juergen Gross <[email protected]>:

Quoted 2 lines

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

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

Am Thu, 17 May 2018 16:54:00 +0200
schrieb Olaf Hering <[email protected]>:

Quoted 1 line

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

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
In reply to Olaf Hering

Am Thu, 17 May 2018 16:54:00 +0200
schrieb Olaf Hering <[email protected]>:

Quoted 5 lines

Am Thu, 17 May 2018 14:55:10 +0200
schrieb Juergen Gross <[email protected]>:

Quoted 2 lines

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:

tools/libxl/libxl_dom_suspend.c +6 -2
@@ -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

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel