The last meaningful error was being reset during the execution of virCHProcessStop, which led to inconsistent error output in case any error occurred before the stop. To maintain consistent error output and avoid unknown error messages, last meaningful error preservation has been added. Signed-off-by: Kirill Shchetiniuk <kshcheti@xxxxxxxxxx> --- src/ch/ch_process.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 9a85f7869e..9388d5bd83 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -995,11 +995,14 @@ virCHProcessStop(virCHDriver *driver, virCHDomainObjPrivate *priv = vm->privateData; virCHDriverConfig *cfg = virCHDriverGetConfig(driver); virDomainDef *def = vm->def; + virErrorPtr orig_err = NULL; size_t i; VIR_DEBUG("Stopping VM name=%s pid=%d reason=%d", vm->def->name, (int)vm->pid, (int)reason); + virErrorPreserveLast(&orig_err); + if (priv->monitor) { g_clear_pointer(&priv->monitor, virCHMonitorClose); } @@ -1032,6 +1035,8 @@ virCHProcessStop(virCHDriver *driver, virHostdevReAttachDomainDevices(driver->hostdevMgr, CH_DRIVER_NAME, def, hostdev_flags); + + virErrorRestore(&orig_err); return 0; } -- 2.48.1