In case a domain is in failed post-copy migration but paused for a
different reason, report VIR_DOMAIN_PAUSED_POSTCOPY_FAILED instead to
make it more visible.
---
Notes:
This commit is intentionally missing
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
because I can find reasons for both pushing and not pushing this change.
It is pretty ugly and masks the real reason behind the paused state. On
the other hand, reporting the real reason means users would not really
know post-copy migration failed unless they saw the corresponding event.
src/conf/domain_conf.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f83586c549..6097ea3ffc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27865,8 +27865,15 @@ virDomainObjCopyPersistentDef(virDomainObj *dom,
virDomainState
virDomainObjGetState(virDomainObj *dom, int *reason)
{
- if (reason)
- *reason = dom->state.reason;
+ if (reason) {
+ if (dom->state.state == VIR_DOMAIN_PAUSED &&
+ dom->job && dom->job->asyncPaused &&
+ (dom->job->asyncJob == VIR_ASYNC_JOB_MIGRATION_IN ||
+ dom->job->asyncJob == VIR_ASYNC_JOB_MIGRATION_OUT))
+ *reason = VIR_DOMAIN_PAUSED_POSTCOPY_FAILED;
+ else
+ *reason = dom->state.reason;
+ }
return dom->state.state;
}
--
2.39.0