]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch: virCHProcessEvent() update domain info after reboot
authorKirill Shchetiniuk via Devel <devel@lists.libvirt.org>
Tue, 25 Mar 2025 14:11:58 +0000 (15:11 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Apr 2025 15:35:28 +0000 (17:35 +0200)
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 <kshcheti@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/ch/ch_events.c
src/ch/ch_process.c
src/ch/ch_process.h

index 2dd3e7ecc207c034f6e551e32d6fc190f344c8e4..32846ba4e5dfe3d2f6b465161e4a074e680fbb94 100644 (file)
@@ -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);
index ad44e8031a87e2ba6def1befbf3aef9f70f9bdf1..e8d482da978e86970ef5f1dacc544ebc7cadd7b9 100644 (file)
@@ -131,7 +131,7 @@ virCHProcessUpdateConsole(virDomainObj *vm,
         virCHProcessUpdateConsoleDevice(vm, config, "serial");
 }
 
-static int
+int
 virCHProcessUpdateInfo(virDomainObj *vm)
 {
     g_autoptr(virJSONValue) info = NULL;
index 38bfce3b7f35933d259b6e5467b6662aada3225c..7a6995b7cf0a73bd18b7e4543056ae4b71df3fd3 100644 (file)
@@ -36,3 +36,5 @@ int virCHProcessSetupVcpu(virDomainObj *vm,
 int virCHProcessStartRestore(virCHDriver *driver,
                          virDomainObj *vm,
                          const char *from);
+
+int virCHProcessUpdateInfo(virDomainObj *vm);