From: Kirill Shchetiniuk via Devel Date: Tue, 25 Mar 2025 14:11:58 +0000 (+0100) Subject: ch: virCHProcessEvent() update domain info after reboot X-Git-Tag: v11.3.0-rc1~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ad22460a75f8890483abd7b029c95db98357a092;p=thirdparty%2Flibvirt.git ch: virCHProcessEvent() update domain info after reboot When the domain was rebooted, some of its properties were changed but not updated in the transient domain definition. This led to the inability to connect to the serial console as its path had changed during the reboot but was not updated in the domain definition. Added VIR_CH_EVENT_VM_REBOOTED event handling to update the information in transient domain definition after domain's reboot is completed to maintain it in consistent state. Signed-off-by: Kirill Shchetiniuk Reviewed-by: Michal Privoznik --- diff --git a/src/ch/ch_events.c b/src/ch/ch_events.c index 2dd3e7ecc2..32846ba4e5 100644 --- a/src/ch/ch_events.c +++ b/src/ch/ch_events.c @@ -97,7 +97,6 @@ virCHProcessEvent(virCHMonitor *mon, case VIR_CH_EVENT_VM_BOOTING: case VIR_CH_EVENT_VM_BOOTED: case VIR_CH_EVENT_VM_REBOOTING: - case VIR_CH_EVENT_VM_REBOOTED: case VIR_CH_EVENT_VM_PAUSING: case VIR_CH_EVENT_VM_PAUSED: case VIR_CH_EVENT_VM_RESUMING: @@ -120,6 +119,11 @@ virCHProcessEvent(virCHMonitor *mon, virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_SHUTDOWN); virObjectUnlock(vm); break; + case VIR_CH_EVENT_VM_REBOOTED: + virObjectLock(vm); + virCHProcessUpdateInfo(vm); + virObjectUnlock(vm); + break; case VIR_CH_EVENT_LAST: default: VIR_WARN("%s: Unknown event: %s", vm->def->name, full_event); diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index ad44e8031a..e8d482da97 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -131,7 +131,7 @@ virCHProcessUpdateConsole(virDomainObj *vm, virCHProcessUpdateConsoleDevice(vm, config, "serial"); } -static int +int virCHProcessUpdateInfo(virDomainObj *vm) { g_autoptr(virJSONValue) info = NULL; diff --git a/src/ch/ch_process.h b/src/ch/ch_process.h index 38bfce3b7f..7a6995b7cf 100644 --- a/src/ch/ch_process.h +++ b/src/ch/ch_process.h @@ -36,3 +36,5 @@ int virCHProcessSetupVcpu(virDomainObj *vm, int virCHProcessStartRestore(virCHDriver *driver, virDomainObj *vm, const char *from); + +int virCHProcessUpdateInfo(virDomainObj *vm);