Hello community,

here is the log from the commit of package libvirt for openSUSE:Factory checked 
in at 2018-11-13 16:22:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libvirt (Old)
 and      /work/SRC/openSUSE:Factory/.libvirt.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libvirt"

Tue Nov 13 16:22:56 2018 rev:268 rq:647057 version:4.9.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/libvirt/libvirt.changes  2018-11-06 
14:02:41.987584963 +0100
+++ /work/SRC/openSUSE:Factory/.libvirt.new/libvirt.changes     2018-11-13 
16:23:09.786914539 +0100
@@ -1,0 +2,9 @@
+Tue Nov  6 18:33:26 UTC 2018 - James Fehlig <[email protected]>
+
+- libxl: add support for soft reset
+  14d03b27-libxl-rm-redundant-virObjectEventStateQueue.patch,
+  82452a5d-libxl-rm-goto-libxlDomainShutdownThread.patch,
+  da4b0fd9-libxl-support-soft-reset.patch
+  bsc#1081516
+
+-------------------------------------------------------------------

New:
----
  14d03b27-libxl-rm-redundant-virObjectEventStateQueue.patch
  82452a5d-libxl-rm-goto-libxlDomainShutdownThread.patch
  da4b0fd9-libxl-support-soft-reset.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libvirt.spec ++++++
--- /var/tmp/diff_new_pack.TiYCaf/_old  2018-11-13 16:23:11.182912102 +0100
+++ /var/tmp/diff_new_pack.TiYCaf/_new  2018-11-13 16:23:11.182912102 +0100
@@ -339,6 +339,9 @@
 Source99:       baselibs.conf
 Source100:      %{name}-rpmlintrc
 # Upstream patches
+Patch0:         14d03b27-libxl-rm-redundant-virObjectEventStateQueue.patch
+Patch1:         82452a5d-libxl-rm-goto-libxlDomainShutdownThread.patch
+Patch2:         da4b0fd9-libxl-support-soft-reset.patch
 # Patches pending upstream review
 Patch100:       libxl-dom-reset.patch
 Patch101:       network-don-t-use-dhcp-authoritative-on-static-netwo.patch
@@ -901,6 +904,9 @@
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
 %patch100 -p1
 %patch101 -p1
 %patch150 -p1

++++++ 14d03b27-libxl-rm-redundant-virObjectEventStateQueue.patch ++++++
commit 14d03b27bf8f8a13da27a297e23e2b1b80688459
Author: Jim Fehlig <[email protected]>
Date:   Wed Oct 31 10:41:28 2018 -0600

    libxl: remove redundant calls to virObjectEventStateQueue
    
    In libxlDomainShutdownThread, virObjectEventStateQueue is needlessly
    called in the destroy and restart labels. The cleanup label aready
    queues whatever event was created based on libxl_shutdown_reason.
    There is no need to handle destroy and restart differently.
    
    Signed-off-by: Jim Fehlig <[email protected]>
    ACKed-by: Michal Privoznik <[email protected]>

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 0032b9dd11..9ed6ee8fb3 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -538,8 +538,6 @@ libxlDomainShutdownThread(void *opaque)
     }
 
  destroy:
-    virObjectEventStateQueue(driver->domainEventState, dom_event);
-    dom_event = NULL;
     libxlDomainDestroyInternal(driver, vm);
     libxlDomainCleanup(driver, vm);
     if (!vm->persistent)
@@ -548,8 +546,6 @@ libxlDomainShutdownThread(void *opaque)
     goto endjob;
 
  restart:
-    virObjectEventStateQueue(driver->domainEventState, dom_event);
-    dom_event = NULL;
     libxlDomainDestroyInternal(driver, vm);
     libxlDomainCleanup(driver, vm);
     if (libxlDomainStartNew(driver, vm, false) < 0) {
++++++ 82452a5d-libxl-rm-goto-libxlDomainShutdownThread.patch ++++++
commit 82452a5d7f55c7698459728a3ee071402f43bb4d
Author: Jim Fehlig <[email protected]>
Date:   Wed Oct 31 10:54:14 2018 -0600

    libxl: Remove some goto labels in libxlDomainShutdownThread
    
    There are too many goto labels in libxlDomainShutdownThread. Convert the
    'destroy' and 'restart' labels to helper functions, leaving only the
    commonly used pattern of 'endjob' and 'cleanup' labels.
    
    Signed-off-by: Jim Fehlig <[email protected]>
    ACKed-by: Michal Privoznik <[email protected]>

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 9ed6ee8fb3..4cdaee0e51 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -430,6 +430,30 @@ virDomainDefParserConfig libxlDomainDefParserConfig = {
 };
 
 
+static void
+libxlDomainShutdownHandleDestroy(libxlDriverPrivatePtr driver,
+                                 virDomainObjPtr vm)
+{
+    libxlDomainDestroyInternal(driver, vm);
+    libxlDomainCleanup(driver, vm);
+    if (!vm->persistent)
+        virDomainObjListRemove(driver->domains, vm);
+}
+
+
+static void
+libxlDomainShutdownHandleRestart(libxlDriverPrivatePtr driver,
+                                 virDomainObjPtr vm)
+{
+    libxlDomainDestroyInternal(driver, vm);
+    libxlDomainCleanup(driver, vm);
+    if (libxlDomainStartNew(driver, vm, false) < 0) {
+        VIR_ERROR(_("Failed to restart VM '%s': %s"),
+                  vm->def->name, virGetLastErrorMessage());
+    }
+}
+
+
 struct libxlShutdownThreadInfo
 {
     libxlDriverPrivatePtr driver;
@@ -468,10 +492,12 @@ libxlDomainShutdownThread(void *opaque)
                                            VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
         switch ((virDomainLifecycleAction) vm->def->onPoweroff) {
         case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY:
-            goto destroy;
+            libxlDomainShutdownHandleDestroy(driver, vm);
+            goto endjob;
         case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
         case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME:
-            goto restart;
+            libxlDomainShutdownHandleRestart(driver, vm);
+            goto endjob;
         case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE:
         case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY:
         case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART:
@@ -487,19 +513,23 @@ libxlDomainShutdownThread(void *opaque)
                                            VIR_DOMAIN_EVENT_STOPPED_CRASHED);
         switch ((virDomainLifecycleAction) vm->def->onCrash) {
         case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY:
-            goto destroy;
+            libxlDomainShutdownHandleDestroy(driver, vm);
+            goto endjob;
         case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
         case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME:
-            goto restart;
+            libxlDomainShutdownHandleRestart(driver, vm);
+            goto endjob;
         case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE:
         case VIR_DOMAIN_LIFECYCLE_ACTION_LAST:
             goto endjob;
         case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY:
             libxlDomainAutoCoreDump(driver, vm);
-            goto destroy;
+            libxlDomainShutdownHandleDestroy(driver, vm);
+            goto endjob;
         case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART:
             libxlDomainAutoCoreDump(driver, vm);
-            goto restart;
+            libxlDomainShutdownHandleRestart(driver, vm);
+            goto endjob;
         }
     } else if (xl_reason == LIBXL_SHUTDOWN_REASON_REBOOT) {
         virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF,
@@ -510,10 +540,12 @@ libxlDomainShutdownThread(void *opaque)
                                            VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
         switch ((virDomainLifecycleAction) vm->def->onReboot) {
         case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY:
-            goto destroy;
+            libxlDomainShutdownHandleDestroy(driver, vm);
+            goto endjob;
         case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
         case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME:
-            goto restart;
+            libxlDomainShutdownHandleRestart(driver, vm);
+            goto endjob;
         case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE:
         case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY:
         case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART:
@@ -531,26 +563,8 @@ libxlDomainShutdownThread(void *opaque)
          * Similar to the xl implementation, ignore SUSPEND.  Any actions 
needed
          * after calling libxl_domain_suspend() are handled by it's callers.
          */
-        goto endjob;
     } else {
         VIR_INFO("Unhandled shutdown_reason %d", xl_reason);
-        goto endjob;
-    }
-
- destroy:
-    libxlDomainDestroyInternal(driver, vm);
-    libxlDomainCleanup(driver, vm);
-    if (!vm->persistent)
-        virDomainObjListRemove(driver->domains, vm);
-
-    goto endjob;
-
- restart:
-    libxlDomainDestroyInternal(driver, vm);
-    libxlDomainCleanup(driver, vm);
-    if (libxlDomainStartNew(driver, vm, false) < 0) {
-        VIR_ERROR(_("Failed to restart VM '%s': %s"),
-                  vm->def->name, virGetLastErrorMessage());
     }
 
  endjob:
++++++ da4b0fd9-libxl-support-soft-reset.patch ++++++
commit da4b0fd9d3cdd117427e7e1981e8639bc859e844
Author: Jim Fehlig <[email protected]>
Date:   Wed Oct 31 11:03:37 2018 -0600

    libxl: add support for soft reset
    
    The pvops Linux kernel implements machine_ops.crash_shutdown as
    
    static void xen_hvm_crash_shutdown(struct pt_regs *regs)
    {
            native_machine_crash_shutdown(regs);
            xen_reboot(SHUTDOWN_soft_reset);
    }
    
    but currently the libxl driver does not handle the soft reset
    shutdown event. As a result, the guest domain never proceeds
    past xen_reboot(), making it impossible for HVM domains to save
    a crash dump using kexec.
    
    This patch adds support for handling the soft reset event by
    calling libxl_domain_soft_reset() and re-enabling domain death
    events, which is similar to the xl tool handling of soft reset
    shutdown event.
    
    Signed-off-by: Jim Fehlig <[email protected]>
    ACKed-by: Michal Privoznik <[email protected]>

Index: libvirt-4.9.0/src/libxl/libxl_domain.c
===================================================================
--- libvirt-4.9.0.orig/src/libxl/libxl_domain.c
+++ libvirt-4.9.0/src/libxl/libxl_domain.c
@@ -471,8 +471,10 @@ libxlDomainShutdownThread(void *opaque)
     virObjectEventPtr dom_event = NULL;
     libxl_shutdown_reason xl_reason = ev->u.domain_shutdown.shutdown_reason;
     libxlDriverConfigPtr cfg;
+    libxl_domain_config d_config;
 
     cfg = libxlDriverConfigGet(driver);
+    libxl_domain_config_init(&d_config);
 
     vm = virDomainObjListFindByID(driver->domains, ev->domid);
     if (!vm) {
@@ -563,6 +565,34 @@ libxlDomainShutdownThread(void *opaque)
          * Similar to the xl implementation, ignore SUSPEND.  Any actions 
needed
          * after calling libxl_domain_suspend() are handled by it's callers.
          */
+#ifdef LIBXL_HAVE_SOFT_RESET
+    } else if (xl_reason == LIBXL_SHUTDOWN_REASON_SOFT_RESET) {
+        libxlDomainObjPrivatePtr priv = vm->privateData;
+
+        if (libxl_retrieve_domain_configuration(cfg->ctx, vm->def->id,
+                                                &d_config) != 0) {
+            VIR_ERROR(_("Failed to retrieve config for VM '%s'. "
+                        "Unable to perform soft reset. Destroying VM"),
+                      vm->def->name);
+            libxlDomainShutdownHandleDestroy(driver, vm);
+            goto endjob;
+        }
+
+        if (priv->deathW) {
+            libxl_evdisable_domain_death(cfg->ctx, priv->deathW);
+            priv->deathW = NULL;
+        }
+
+        if (libxl_domain_soft_reset(cfg->ctx, &d_config, vm->def->id,
+                                    NULL, NULL) != 0) {
+            VIR_ERROR(_("Failed to soft reset VM '%s'. Destroying VM"),
+                      vm->def->name);
+            libxlDomainShutdownHandleDestroy(driver, vm);
+            goto endjob;
+        }
+        libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->deathW);
+        libxl_domain_unpause(cfg->ctx, vm->def->id);
+#endif
     } else {
         VIR_INFO("Unhandled shutdown_reason %d", xl_reason);
     }
@@ -575,6 +605,7 @@ libxlDomainShutdownThread(void *opaque)
     virObjectEventStateQueue(driver->domainEventState, dom_event);
     libxl_event_free(cfg->ctx, ev);
     VIR_FREE(shutdown_info);
+    libxl_domain_config_dispose(&d_config);
     virObjectUnref(cfg);
 }
 


Reply via email to