This new "post-copy failed" reason for the running state will be used on
the destination host when post-copy migration fails while the domain is
already running there.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
examples/c/misc/event-test.c | 3 +++
include/libvirt/libvirt-domain.h | 2 ++
src/conf/domain_conf.c | 1 +
src/libvirt-domain.c | 15 ++++++++++-----
src/qemu/qemu_domain.c | 3 +++
tools/virsh-domain-event.c | 3 ++-
tools/virsh-domain-monitor.c | 1 +
7 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c
index 1165469a65..64652b0153 100644
--- a/examples/c/misc/event-test.c
+++ b/examples/c/misc/event-test.c
@@ -196,6 +196,9 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_RESUMED_POSTCOPY:
return "Post-copy";
+ case VIR_DOMAIN_EVENT_RESUMED_POSTCOPY_FAILED:
+ return "Post-copy Error";
+
case VIR_DOMAIN_EVENT_RESUMED_LAST:
break;
}
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index cf9d9efd51..34b8adc2bf 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -108,6 +108,7 @@ typedef enum {
wakeup event (Since: 0.9.11) */
VIR_DOMAIN_RUNNING_CRASHED = 9, /* resumed from crashed (Since: 1.1.1) */
VIR_DOMAIN_RUNNING_POSTCOPY = 10, /* running in post-copy migration mode
(Since: 1.3.3) */
+ VIR_DOMAIN_RUNNING_POSTCOPY_FAILED = 11, /* running in failed post-copy migration
(Since: 8.4.0) */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_RUNNING_LAST /* (Since: 0.9.10) */
@@ -3801,6 +3802,7 @@ typedef enum {
VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT = 2, /* Resumed from snapshot (Since: 0.9.5)
*/
VIR_DOMAIN_EVENT_RESUMED_POSTCOPY = 3, /* Resumed, but migration is still
running in post-copy mode (Since: 1.3.3)
*/
+ VIR_DOMAIN_EVENT_RESUMED_POSTCOPY_FAILED = 4, /* Running, but migration failed in
post-copy (Since: 8.4.0) */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_RESUMED_LAST /* (Since: 0.9.10) */
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bd2884088c..f8c6b78c92 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1102,6 +1102,7 @@ VIR_ENUM_IMPL(virDomainRunningReason,
"wakeup",
"crashed",
"post-copy",
+ "post-copy failed",
);
VIR_ENUM_IMPL(virDomainBlockedReason,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index d1d62daa71..2e39687e27 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -9753,10 +9753,14 @@ virDomainMigrateGetMaxSpeed(virDomainPtr domain,
* at most once no matter how fast it changes. On the other hand once the
* guest is running on the destination host, the migration can no longer be
* rolled back because none of the hosts has complete state. If this happens,
- * libvirt will leave the domain paused on both hosts with
- * VIR_DOMAIN_PAUSED_POSTCOPY_FAILED reason. It's up to the upper layer to
- * decide what to do in such case. Because of this, libvirt will refuse to
- * cancel post-copy migration via virDomainAbortJob.
+ * libvirt will leave the domain paused on the source host with
+ * VIR_DOMAIN_PAUSED_POSTCOPY_FAILED reason. The domain on the destination host
+ * will remain running, but the reason will change to
+ * VIR_DOMAIN_RUNNING_POSTCOPY_FAILED. Even though the virtual CPUs remain
+ * running, individual tasks in the guest may be blocked waiting for a page that
+ * has not been migrated yet. It's up to the upper layer to decide what to do
+ * in such case. Because of this, libvirt will refuse to cancel post-copy
+ * migration via virDomainAbortJob.
*
* The following domain life cycle events are emitted during post-copy
* migration:
@@ -9770,7 +9774,8 @@ virDomainMigrateGetMaxSpeed(virDomainPtr domain,
* VIR_DOMAIN_EVENT_RESUMED_MIGRATED (on the destination),
* VIR_DOMAIN_EVENT_STOPPED_MIGRATED (on the source) -- migration finished
* successfully and the destination host holds a complete guest state.
- * VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED (on the destination) -- emitted
+ * VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED (on the source),
+ * VIR_DOMAIN_EVENT_RESUMED_POSTCOPY_FAILED (on the destination) -- emitted
* when migration fails in post-copy mode and it's unclear whether any
* of the hosts has a complete guest state.
*
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7974cdb00b..51236b19f2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11105,6 +11105,9 @@ qemuDomainRunningReasonToResumeEvent(virDomainRunningReason
reason)
case VIR_DOMAIN_RUNNING_POSTCOPY:
return VIR_DOMAIN_EVENT_RESUMED_POSTCOPY;
+ case VIR_DOMAIN_RUNNING_POSTCOPY_FAILED:
+ return VIR_DOMAIN_EVENT_RESUMED_POSTCOPY_FAILED;
+
case VIR_DOMAIN_RUNNING_UNKNOWN:
case VIR_DOMAIN_RUNNING_SAVE_CANCELED:
case VIR_DOMAIN_RUNNING_BOOTED:
diff --git a/tools/virsh-domain-event.c b/tools/virsh-domain-event.c
index 6dbb64a655..2d6db5f881 100644
--- a/tools/virsh-domain-event.c
+++ b/tools/virsh-domain-event.c
@@ -93,7 +93,8 @@ VIR_ENUM_IMPL(virshDomainEventResumed,
N_("Unpaused"),
N_("Migrated"),
N_("Snapshot"),
- N_("Post-copy"));
+ N_("Post-copy"),
+ N_("Post-copy Error"));
VIR_ENUM_DECL(virshDomainEventStopped);
VIR_ENUM_IMPL(virshDomainEventStopped,
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 246e8a16c0..dc5fe13e49 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -166,6 +166,7 @@ VIR_ENUM_IMPL(virshDomainRunningReason,
N_("event wakeup"),
N_("crashed"),
N_("post-copy"),
+ N_("post-copy failed"),
);
VIR_ENUM_DECL(virshDomainBlockedReason);
--
2.35.1