]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add event and state details for post-copy
authorJiri Denemark <jdenemar@redhat.com>
Tue, 5 Jan 2016 11:08:37 +0000 (12:08 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 21 Mar 2016 14:15:46 +0000 (15:15 +0100)
VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY and VIR_DOMAIN_PAUSED_POSTCOPY are
used on the source host once migration enters post-copy mode (which
means the domain gets paused on the source. After the destination host
takes over the execution of the domain, its virtual CPUs are resumed and
the domain enters VIR_DOMAIN_RUNNING_POSTCOPY state and
VIR_DOMAIN_EVENT_RESUMED_POSTCOPY event is emitted.

In case migration fails during post-copy mode and none of the hosts have
complete state of the domain, both domains will remain paused with
VIR_DOMAIN_PAUSED_POSTCOPY_FAILED reason and an upper layer may decide
what to do.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
examples/object-events/event-test.c
include/libvirt/libvirt-domain.h
src/conf/domain_conf.c
tools/virsh-domain-monitor.c
tools/virsh-domain.c

index afac1007b17b82a4ed7b0850ea590db9cc33925b..1e3256f01dfae2cfcdcc46144eb1344a118dc77d 100644 (file)
@@ -161,6 +161,12 @@ static const char *eventDetailToString(int event, int detail) {
             case VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR:
                 ret = "API error";
                 break;
+            case VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY:
+                ret = "Post-copy";
+                break;
+            case VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED:
+                ret = "Post-copy Error";
+                break;
             }
             break;
         case VIR_DOMAIN_EVENT_RESUMED:
@@ -174,6 +180,9 @@ static const char *eventDetailToString(int event, int detail) {
             case VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT:
                 ret = "Snapshot";
                 break;
+            case VIR_DOMAIN_EVENT_RESUMED_POSTCOPY:
+                ret = "Post-copy";
+                break;
             }
             break;
         case VIR_DOMAIN_EVENT_STOPPED:
index 4ac29cd7881609c6c50140124d5bcb010d15c52a..f97a808143f2d08d20162724b09d43a5f89d8333 100644 (file)
@@ -90,6 +90,7 @@ typedef enum {
     VIR_DOMAIN_RUNNING_WAKEUP = 8,          /* returned from pmsuspended due to
                                                wakeup event */
     VIR_DOMAIN_RUNNING_CRASHED = 9,         /* resumed from crashed */
+    VIR_DOMAIN_RUNNING_POSTCOPY = 10,       /* running in post-copy migration mode */
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_RUNNING_LAST
@@ -117,6 +118,8 @@ typedef enum {
     VIR_DOMAIN_PAUSED_SNAPSHOT = 9,      /* paused while creating a snapshot */
     VIR_DOMAIN_PAUSED_CRASHED = 10,     /* paused due to a guest crash */
     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 */
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_PAUSED_LAST
@@ -2407,6 +2410,8 @@ typedef enum {
     VIR_DOMAIN_EVENT_SUSPENDED_RESTORED = 4,  /* Restored from paused state file */
     VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT = 5, /* Restored from paused snapshot */
     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 */
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_EVENT_SUSPENDED_LAST
@@ -2422,6 +2427,8 @@ typedef enum {
     VIR_DOMAIN_EVENT_RESUMED_UNPAUSED = 0,   /* Normal resume due to admin unpause */
     VIR_DOMAIN_EVENT_RESUMED_MIGRATED = 1,   /* Resumed for completion of migration */
     VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT = 2, /* Resumed from snapshot */
+    VIR_DOMAIN_EVENT_RESUMED_POSTCOPY = 3,   /* Resumed, but migration is still
+                                                running in post-copy mode */
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_EVENT_RESUMED_LAST
index 361e79ef508ee68c6498c9035db138b71c2f12e6..43b2f1f005868064e3c315b77cadcea950b95e01 100644 (file)
@@ -675,7 +675,8 @@ VIR_ENUM_IMPL(virDomainRunningReason, VIR_DOMAIN_RUNNING_LAST,
               "migration canceled",
               "save canceled",
               "wakeup",
-              "crashed")
+              "crashed",
+              "post-copy")
 
 VIR_ENUM_IMPL(virDomainBlockedReason, VIR_DOMAIN_BLOCKED_LAST,
               "unknown")
@@ -692,7 +693,9 @@ VIR_ENUM_IMPL(virDomainPausedReason, VIR_DOMAIN_PAUSED_LAST,
               "shutdown",
               "snapshot",
               "panicked",
-              "starting up")
+              "starting up",
+              "post-copy",
+              "post-copy failed")
 
 VIR_ENUM_IMPL(virDomainShutdownReason, VIR_DOMAIN_SHUTDOWN_LAST,
               "unknown",
index 7dcbc5cc4eb04ba59f355ea125f80d91dda93227..47a999581403a83eb6d3a7274d2d3dd9c687dca6 100644 (file)
@@ -182,7 +182,8 @@ VIR_ENUM_IMPL(virshDomainRunningReason,
               N_("migration canceled"),
               N_("save canceled"),
               N_("event wakeup"),
-              N_("crashed"))
+              N_("crashed"),
+              N_("post-copy"))
 
 VIR_ENUM_DECL(virshDomainBlockedReason)
 VIR_ENUM_IMPL(virshDomainBlockedReason,
@@ -203,7 +204,9 @@ VIR_ENUM_IMPL(virshDomainPausedReason,
               N_("shutting down"),
               N_("creating snapshot"),
               N_("crashed"),
-              N_("starting up"))
+              N_("starting up"),
+              N_("post-copy"),
+              N_("post-copy failed"))
 
 VIR_ENUM_DECL(virshDomainShutdownReason)
 VIR_ENUM_IMPL(virshDomainShutdownReason,
index 854823ebca9eed42369fe25247f38e135bbd0f52..bbf41b8c879956d813285da63a56d38f56ffb9f8 100644 (file)
@@ -11449,14 +11449,17 @@ VIR_ENUM_IMPL(virshDomainEventSuspended,
               N_("Watchdog"),
               N_("Restored"),
               N_("Snapshot"),
-              N_("API error"))
+              N_("API error"),
+              N_("Post-copy"),
+              N_("Post-copy Error"))
 
 VIR_ENUM_DECL(virshDomainEventResumed)
 VIR_ENUM_IMPL(virshDomainEventResumed,
               VIR_DOMAIN_EVENT_RESUMED_LAST,
               N_("Unpaused"),
               N_("Migrated"),
-              N_("Snapshot"))
+              N_("Snapshot"),
+              N_("Post-copy"))
 
 VIR_ENUM_DECL(virshDomainEventStopped)
 VIR_ENUM_IMPL(virshDomainEventStopped,