[PATCH 2/3] API: Add VIR_DOMAIN_PAUSED_HYPERVISOR_FAULT enum value

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

 



In certain cases hypervisors on encountering an internal fault pause the
domain to allow gathering useful debugging information. Libvirt for now
would report 'VIR_DOMAIN_PAUSED_UNKNOWN' which isn't entirely helpful.

Add a new paused reason and the corresponding value for the suspended
event, so that hypervisor drivers can report this state properly.

In qemu this will be mapped to the 'internal-error' paused reason.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 examples/c/misc/event-test.c     | 3 +++
 include/libvirt/libvirt-domain.h | 2 ++
 src/conf/domain_conf.c           | 1 +
 src/qemu/qemu_domain.c           | 3 +++
 src/qemu/qemu_monitor.c          | 4 +++-
 tools/virsh-domain-monitor.c     | 1 +
 tools/virsh-domain.c             | 3 ++-
 7 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c
index 76d4f3f6e8..c7d60d4c61 100644
--- a/examples/c/misc/event-test.c
+++ b/examples/c/misc/event-test.c
@@ -187,6 +187,9 @@ eventDetailToString(int event,
             case VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED:
                 return "Post-copy Error";

+            case VIR_DOMAIN_EVENT_SUSPENDED_HYPERVISOR_FAULT:
+                return "Hypervisor fault";
+
             case VIR_DOMAIN_EVENT_SUSPENDED_LAST:
                 break;
             }
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 03c119fe26..f1c0e960f9 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -119,6 +119,7 @@ typedef enum {
     VIR_DOMAIN_PAUSED_STARTING_UP = 11, /* the domain is being started */
     VIR_DOMAIN_PAUSED_POSTCOPY = 12,    /* paused for post-copy migration */
     VIR_DOMAIN_PAUSED_POSTCOPY_FAILED = 13, /* paused after failed post-copy */
+    VIR_DOMAIN_PAUSED_HYPERVISOR_FAULT = 14, /* paused after a hypervisor failure */

 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_PAUSED_LAST
@@ -3108,6 +3109,7 @@ typedef enum {
     VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR = 6, /* suspended after failure during libvirt API call */
     VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY = 7, /* suspended for post-copy migration */
     VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED = 8, /* suspended after failed post-copy */
+    VIR_DOMAIN_EVENT_SUSPENDED_HYPERVISOR_FAULT = 9, /* suspended after a hypervisor fault */

 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_EVENT_SUSPENDED_LAST
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 47756ff0be..f49db930ca 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1082,6 +1082,7 @@ VIR_ENUM_IMPL(virDomainPausedReason,
               "starting up",
               "post-copy",
               "post-copy failed",
+              "hypervisor fault",
 );

 VIR_ENUM_IMPL(virDomainShutdownReason,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ed2a1481d4..dde9ba92c6 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11180,6 +11180,9 @@ qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason)
     case VIR_DOMAIN_PAUSED_POSTCOPY:
         return VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY;

+    case VIR_DOMAIN_PAUSED_HYPERVISOR_FAULT:
+        return VIR_DOMAIN_EVENT_SUSPENDED_HYPERVISOR_FAULT;
+
     case VIR_DOMAIN_PAUSED_UNKNOWN:
     case VIR_DOMAIN_PAUSED_USER:
     case VIR_DOMAIN_PAUSED_SAVE:
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index c43c6f180e..ca6bd79516 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3508,10 +3508,12 @@ qemuMonitorVMStatusToPausedReason(const char *status)

     switch ((qemuMonitorVMStatus) st) {
     case QEMU_MONITOR_VM_STATUS_DEBUG:
-    case QEMU_MONITOR_VM_STATUS_INTERNAL_ERROR:
     case QEMU_MONITOR_VM_STATUS_RESTORE_VM:
         return VIR_DOMAIN_PAUSED_UNKNOWN;

+    case QEMU_MONITOR_VM_STATUS_INTERNAL_ERROR:
+        return VIR_DOMAIN_PAUSED_HYPERVISOR_FAULT;
+
     case QEMU_MONITOR_VM_STATUS_INMIGRATE:
     case QEMU_MONITOR_VM_STATUS_POSTMIGRATE:
     case QEMU_MONITOR_VM_STATUS_FINISH_MIGRATE:
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index c4d7464695..169fd5931b 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -195,6 +195,7 @@ VIR_ENUM_IMPL(virshDomainPausedReason,
               N_("starting up"),
               N_("post-copy"),
               N_("post-copy failed"),
+              N_("hypervisor fault"),
 );

 VIR_ENUM_DECL(virshDomainShutdownReason);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 7db88f700a..05b75edcda 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -12837,7 +12837,8 @@ VIR_ENUM_IMPL(virshDomainEventSuspended,
               N_("Snapshot"),
               N_("API error"),
               N_("Post-copy"),
-              N_("Post-copy Error"));
+              N_("Post-copy Error"),
+              N_("Hypervisor fault"));

 VIR_ENUM_DECL(virshDomainEventResumed);
 VIR_ENUM_IMPL(virshDomainEventResumed,
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux