From nobody Tue Jan 21 04:22:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1737134008805298.879990270005; Fri, 17 Jan 2025 09:13:28 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 27B641AFC; Fri, 17 Jan 2025 12:13:28 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4D8B31B43; Fri, 17 Jan 2025 12:11:24 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4F31718E6; Fri, 17 Jan 2025 12:11:16 -0500 (EST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lists.libvirt.org (Postfix) with ESMTP id B076A18E8 for ; Fri, 17 Jan 2025 12:11:15 -0500 (EST) Received: from paekkaladevi-dev-u22.gi4irqh5pfqublruu4yyku2wof.phxx.internal.cloudapp.net (unknown [20.125.125.171]) by linux.microsoft.com (Postfix) with ESMTPSA id 9001A20BEBFC; Fri, 17 Jan 2025 09:11:10 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9001A20BEBFC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1737133870; bh=QNtQO43MDSp7DX/sT6E3S1JkIEBy2eBYhhxUdR5Y4qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SAEB/JBcyjwdO9uaWSd0BepQQ3NdJB2giCeimLWxuQEt0QTUxR+LUiRlX71FGl01j IdTb7hnO4C8g9YMmXZ8oan4xLhcZEcuhcwgoppsljK79jSzM/FUIaEbhPEsXRhIDGG qztPuJ03qAxC4Jki/z7J1CqXJTpPMuI+bsJyqilU= From: Purna Pavan Chandra Aekkaladevi To: devel@lists.libvirt.org Subject: [PATCH v5 1/5] ch: pass --event-monitor option to cloud-hypervisor Date: Fri, 17 Jan 2025 17:11:05 +0000 Message-Id: <20250117171109.639464-2-paekkaladevi@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> References: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: Z62E7665RXPKPE24JNC2CWKWG5F7RQ3X X-Message-ID-Hash: Z62E7665RXPKPE24JNC2CWKWG5F7RQ3X X-MailFrom: paekkaladevi@linux.microsoft.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: liuwe@microsoft.com, paekkaladevi@microsoft.com, jnadimpalli@microsoft.com, prasad.krishnan@microsoft.com, prapal@linux.microsoft.com, Purna Pavan Chandra Aekkaladevi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1737134009708019000 Content-Type: text/plain; charset="utf-8" The `--event-monitor` option in cloud-hypervisor outputs events to a specified file. This file can then be used to monitor VM lifecycle, other vmm events and trigger appropriate actions. Signed-off-by: Purna Pavan Chandra Aekkaladevi Co-authored-by: Vineeth Pillai --- src/ch/ch_monitor.c | 20 ++++++++++++++++---- src/ch/ch_monitor.h | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index d3f969e01a..a72ee40aa1 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -541,7 +541,6 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cf= g, int logfile) { g_autoptr(virCHMonitor) mon =3D NULL; g_autoptr(virCommand) cmd =3D NULL; - const char *socketdir =3D cfg->stateDir; int socket_fd =3D 0; =20 if (virCHMonitorInitialize() < 0) @@ -557,11 +556,13 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *= cfg, int logfile) } =20 /* prepare to launch Cloud-Hypervisor socket */ - mon->socketpath =3D g_strdup_printf("%s/%s-socket", socketdir, vm->def= ->name); - if (g_mkdir_with_parents(socketdir, 0777) < 0) { + mon->socketpath =3D g_strdup_printf("%s/%s-socket", cfg->stateDir, vm-= >def->name); + mon->eventmonitorpath =3D g_strdup_printf("%s/%s-event-monitor", + cfg->stateDir, vm->def->name); + if (g_mkdir_with_parents(cfg->stateDir, 0777) < 0) { virReportSystemError(errno, _("Cannot create socket directory '%1$s'"), - socketdir); + cfg->stateDir); return NULL; } =20 @@ -589,6 +590,9 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cf= g, int logfile) virCommandAddArgFormat(cmd, "fd=3D%d", socket_fd); virCommandPassFD(cmd, socket_fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); =20 + virCommandAddArg(cmd, "--event-monitor"); + virCommandAddArgFormat(cmd, "path=3D%s", mon->eventmonitorpath); + /* launch Cloud-Hypervisor socket */ if (virCommandRunAsync(cmd, &mon->pid) < 0) return NULL; @@ -634,6 +638,14 @@ void virCHMonitorClose(virCHMonitor *mon) g_clear_pointer(&mon->socketpath, g_free); } =20 + if (mon->eventmonitorpath) { + if (virFileRemove(mon->eventmonitorpath, -1, -1) < 0) { + VIR_WARN("Unable to remove CH event monitor file '%s'", + mon->eventmonitorpath); + } + g_clear_pointer(&mon->eventmonitorpath, g_free); + } + virObjectUnref(mon); } =20 diff --git a/src/ch/ch_monitor.h b/src/ch/ch_monitor.h index ca23301723..67dc54f9f4 100644 --- a/src/ch/ch_monitor.h +++ b/src/ch/ch_monitor.h @@ -96,6 +96,8 @@ struct _virCHMonitor { =20 char *socketpath; =20 + char *eventmonitorpath; + pid_t pid; =20 virDomainObj *vm; --=20 2.34.1 From nobody Tue Jan 21 04:22:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1737133945062370.41460407163606; Fri, 17 Jan 2025 09:12:25 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 60C9919AC; Fri, 17 Jan 2025 12:12:24 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 986541B1B; Fri, 17 Jan 2025 12:11:18 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C844118E8; Fri, 17 Jan 2025 12:11:13 -0500 (EST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lists.libvirt.org (Postfix) with ESMTP id B525418E8 for ; Fri, 17 Jan 2025 12:11:12 -0500 (EST) Received: from paekkaladevi-dev-u22.gi4irqh5pfqublruu4yyku2wof.phxx.internal.cloudapp.net (unknown [20.125.125.171]) by linux.microsoft.com (Postfix) with ESMTPSA id 0BE3420591B8; Fri, 17 Jan 2025 09:11:11 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0BE3420591B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1737133871; bh=fnmoCPKpVeLNEObp1PsjItWoy5mesZFSjUKeXqsGhz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFB/VWacYuS1s+6aSLO56HfCuj/pg5JJ5oELWQLMn4usgS5LvUFt/V1YPBmswza5f 3sZ/GzY38IZ6FPbOVX3E1aqb4hPFoIqK05Kdr8VIPFmn9wba+ncJ2bIighQznYO4zG OpMdfm3eBEcbPcAekmMwy3D7CRjUErCOEaGSgCug= From: Purna Pavan Chandra Aekkaladevi To: devel@lists.libvirt.org Subject: [PATCH v5 2/5] ch: start a new thread for handling ch events Date: Fri, 17 Jan 2025 17:11:06 +0000 Message-Id: <20250117171109.639464-3-paekkaladevi@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> References: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VZFB6BF2P5VJ7C6OS3TDL3Z6OOUX3WCO X-Message-ID-Hash: VZFB6BF2P5VJ7C6OS3TDL3Z6OOUX3WCO X-MailFrom: paekkaladevi@linux.microsoft.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: liuwe@microsoft.com, paekkaladevi@microsoft.com, jnadimpalli@microsoft.com, prasad.krishnan@microsoft.com, prapal@linux.microsoft.com, Purna Pavan Chandra Aekkaladevi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1737133947420019000 Content-Type: text/plain; charset="utf-8" Use a FIFO(named pipe) for --event-monitor option in CH. Introduce a new thread, `virCHEventHandlerLoop`, to continuously monitor and handle events from cloud-hypervisor. Signed-off-by: Purna Pavan Chandra Aekkaladevi Co-authored-by: Vineeth Pillai --- src/ch/ch_events.c | 78 +++++++++++++++++++++++++++++++++++++++++++++ src/ch/ch_events.h | 26 +++++++++++++++ src/ch/ch_monitor.c | 60 +++++++++++++++++++++++++++++++--- src/ch/ch_monitor.h | 4 +++ src/ch/meson.build | 2 ++ 5 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 src/ch/ch_events.c create mode 100644 src/ch/ch_events.h diff --git a/src/ch/ch_events.c b/src/ch/ch_events.c new file mode 100644 index 0000000000..b6bbce2db0 --- /dev/null +++ b/src/ch/ch_events.c @@ -0,0 +1,78 @@ +/* + * Copyright Microsoft Corp. 2024 + * + * ch_events.c: Handle Cloud-Hypervisor events + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include + +#include "ch_domain.h" +#include "ch_events.h" +#include "ch_process.h" +#include "virfile.h" +#include "virlog.h" + +VIR_LOG_INIT("ch.ch_events"); + + +static void virCHEventHandlerLoop(void *data) +{ + virCHMonitor *mon =3D data; + virDomainObj *vm =3D NULL; + + /* Obtain a vm reference */ + vm =3D virObjectRef(mon->vm); + + VIR_DEBUG("%s: Event handler loop thread starting", vm->def->name); + + while (g_atomic_int_get(&mon->event_handler_stop) =3D=3D 0) { + VIR_DEBUG("%s: Reading events from event monitor file", vm->def->n= ame); + /* Read and process events here */ + } + + virObjectUnref(vm); + VIR_DEBUG("%s: Event handler loop thread exiting", vm->def->name); + return; +} + +int virCHStartEventHandler(virCHMonitor *mon) +{ + g_autofree char *name =3D NULL; + name =3D g_strdup_printf("ch-evt-%d", mon->pid); + + virObjectRef(mon); + if (virThreadCreateFull(&mon->event_handler_thread, + false, + virCHEventHandlerLoop, + name, + false, + mon) < 0) { + virObjectUnref(mon); + return -1; + } + virObjectUnref(mon); + + g_atomic_int_set(&mon->event_handler_stop, 0); + return 0; +} + +void virCHStopEventHandler(virCHMonitor *mon) +{ + g_atomic_int_set(&mon->event_handler_stop, 1); +} diff --git a/src/ch/ch_events.h b/src/ch/ch_events.h new file mode 100644 index 0000000000..4c8a48231d --- /dev/null +++ b/src/ch/ch_events.h @@ -0,0 +1,26 @@ +/* + * Copyright Microsoft Corp. 2024 + * + * ch_events.h: header file for handling Cloud-Hypervisor events + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#pragma once + +#include "ch_monitor.h" + +int virCHStartEventHandler(virCHMonitor *mon); +void virCHStopEventHandler(virCHMonitor *mon); diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index a72ee40aa1..bedcde2dde 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -20,12 +20,14 @@ =20 #include =20 +#include #include #include #include =20 #include "datatypes.h" #include "ch_conf.h" +#include "ch_events.h" #include "ch_interface.h" #include "ch_monitor.h" #include "domain_interface.h" @@ -542,6 +544,7 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cf= g, int logfile) g_autoptr(virCHMonitor) mon =3D NULL; g_autoptr(virCommand) cmd =3D NULL; int socket_fd =3D 0; + int event_monitor_fd; =20 if (virCHMonitorInitialize() < 0) return NULL; @@ -549,6 +552,9 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cf= g, int logfile) if (!(mon =3D virObjectLockableNew(virCHMonitorClass))) return NULL; =20 + /* avoid VIR_FORCE_CLOSE()-ing garbage fd value in virCHMonitorClose */ + mon->eventmonitorfd =3D -1; + if (!vm->def) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("VM is not defined")); @@ -557,8 +563,6 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cf= g, int logfile) =20 /* prepare to launch Cloud-Hypervisor socket */ mon->socketpath =3D g_strdup_printf("%s/%s-socket", cfg->stateDir, vm-= >def->name); - mon->eventmonitorpath =3D g_strdup_printf("%s/%s-event-monitor", - cfg->stateDir, vm->def->name); if (g_mkdir_with_parents(cfg->stateDir, 0777) < 0) { virReportSystemError(errno, _("Cannot create socket directory '%1$s'"), @@ -573,6 +577,27 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *c= fg, int logfile) return NULL; } =20 + /* Event monitor file to listen for VM state changes */ + mon->eventmonitorpath =3D g_strdup_printf("%s/%s-event-monitor-fifo", + cfg->stateDir, vm->def->name); + if (virFileExists(mon->eventmonitorpath)) { + VIR_WARN("Monitor file (%s) already exists, trying to delete!", + mon->eventmonitorpath); + if (virFileRemove(mon->eventmonitorpath, -1, -1) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to remove the file: %1$s"), + mon->eventmonitorpath); + return NULL; + } + } + + if (mkfifo(mon->eventmonitorpath, S_IWUSR | S_IRUSR) < 0 && + errno !=3D EEXIST) { + virReportSystemError(errno, "%s", + _("Cannot create monitor FIFO")); + return NULL; + } + cmd =3D virCommandNew(vm->def->emulator); virCommandSetOutputFD(cmd, &logfile); virCommandSetErrorFD(cmd, &logfile); @@ -597,12 +622,35 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *= cfg, int logfile) if (virCommandRunAsync(cmd, &mon->pid) < 0) return NULL; =20 - /* get a curl handle */ - mon->handle =3D curl_easy_init(); + /* open the reader end of fifo before start Event Handler */ + while ((event_monitor_fd =3D open(mon->eventmonitorpath, O_RDONLY)) < = 0) { + if (errno =3D=3D EINTR) { + /* 100 milli seconds */ + g_usleep(100000); + continue; + } + /* Any other error should be a BUG(kernel/libc/libvirtd) + * (ENOMEM can happen on exceeding per-user limits) + */ + VIR_ERROR(_("%1$s: Failed to open the event monitor FIFO(%2$s) rea= d end!"), + vm->def->name, mon->eventmonitorpath); + /* CH process(Writer) is blocked at this point as EventHandler(Rea= der) + * fails to open the FIFO. + */ + return NULL; + } + mon->eventmonitorfd =3D event_monitor_fd; + VIR_DEBUG("%s: Opened the event monitor FIFO(%s)", vm->def->name, mon-= >eventmonitorpath); =20 /* now has its own reference */ mon->vm =3D virObjectRef(vm); =20 + if (virCHStartEventHandler(mon) < 0) + return NULL; + + /* get a curl handle */ + mon->handle =3D curl_easy_init(); + return g_steal_pointer(&mon); } =20 @@ -638,6 +686,10 @@ void virCHMonitorClose(virCHMonitor *mon) g_clear_pointer(&mon->socketpath, g_free); } =20 + virCHStopEventHandler(mon); + if (mon->eventmonitorfd >=3D 0) { + VIR_FORCE_CLOSE(mon->eventmonitorfd); + } if (mon->eventmonitorpath) { if (virFileRemove(mon->eventmonitorpath, -1, -1) < 0) { VIR_WARN("Unable to remove CH event monitor file '%s'", diff --git a/src/ch/ch_monitor.h b/src/ch/ch_monitor.h index 67dc54f9f4..b9092f22b8 100644 --- a/src/ch/ch_monitor.h +++ b/src/ch/ch_monitor.h @@ -97,6 +97,10 @@ struct _virCHMonitor { char *socketpath; =20 char *eventmonitorpath; + int eventmonitorfd; + + virThread event_handler_thread; + int event_handler_stop; =20 pid_t pid; =20 diff --git a/src/ch/meson.build b/src/ch/meson.build index ca1291c158..0b4a5aeb49 100644 --- a/src/ch/meson.build +++ b/src/ch/meson.build @@ -7,6 +7,8 @@ ch_driver_sources =3D [ 'ch_domain.h', 'ch_driver.c', 'ch_driver.h', + 'ch_events.c', + 'ch_events.h', 'ch_interface.c', 'ch_interface.h', 'ch_monitor.c', --=20 2.34.1 From nobody Tue Jan 21 04:22:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1737133905257922.8926516059573; Fri, 17 Jan 2025 09:11:45 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9B5711B60; Fri, 17 Jan 2025 12:11:44 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7801F1913; Fri, 17 Jan 2025 12:11:16 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A88EF190C; Fri, 17 Jan 2025 12:11:13 -0500 (EST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lists.libvirt.org (Postfix) with ESMTP id DCA8D18E6 for ; Fri, 17 Jan 2025 12:11:12 -0500 (EST) Received: from paekkaladevi-dev-u22.gi4irqh5pfqublruu4yyku2wof.phxx.internal.cloudapp.net (unknown [20.125.125.171]) by linux.microsoft.com (Postfix) with ESMTPSA id 7C25B20591BB; Fri, 17 Jan 2025 09:11:11 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7C25B20591BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1737133871; bh=lazX7MXUeUrnkR66Vtz3nEnFVNhO8x4MJiRTOZcFDSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Et0pDAUTbZmuVWUK6NItgHRfebeKngnO1m/1clMokXSHzFEuB35PhmEeHSoAo689i sI8tLWxSutVV/rNY0UNLd1TcYbyxKgXNOJVRXSCH/UGEwazKabQiVFmM1MDTwGZSAE rUiKlCqrvAgWl0RPt4m5Zm2S20nHB2X7tlvOligo= From: Purna Pavan Chandra Aekkaladevi To: devel@lists.libvirt.org Subject: [PATCH v5 3/5] ch: events: Read and parse cloud-hypervisor events Date: Fri, 17 Jan 2025 17:11:07 +0000 Message-Id: <20250117171109.639464-4-paekkaladevi@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> References: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JVVPBODVSEZG4EY5SWV5I6TDYAFEYVWM X-Message-ID-Hash: JVVPBODVSEZG4EY5SWV5I6TDYAFEYVWM X-MailFrom: paekkaladevi@linux.microsoft.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: liuwe@microsoft.com, paekkaladevi@microsoft.com, jnadimpalli@microsoft.com, prasad.krishnan@microsoft.com, prapal@linux.microsoft.com, Purna Pavan Chandra Aekkaladevi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1737133906952019000 Content-Type: text/plain; charset="utf-8" Implement `chReadProcessEvents` and `chProcessEvents` to read events from event monitor FIFO file and parse them accordingly. Signed-off-by: Purna Pavan Chandra Aekkaladevi Co-authored-by: Vineeth Pillai --- po/POTFILES | 1 + src/ch/ch_events.c | 141 +++++++++++++++++++++++++++++++++++++++++++- src/ch/ch_events.h | 2 + src/ch/ch_monitor.h | 6 ++ 4 files changed, 147 insertions(+), 3 deletions(-) diff --git a/po/POTFILES b/po/POTFILES index 484b34c3df..d4b3de781b 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -22,6 +22,7 @@ src/bhyve/bhyve_process.c src/ch/ch_conf.c src/ch/ch_domain.c src/ch/ch_driver.c +src/ch/ch_events.c src/ch/ch_hostdev.c src/ch/ch_interface.c src/ch/ch_monitor.c diff --git a/src/ch/ch_events.c b/src/ch/ch_events.c index b6bbce2db0..c5c703ded7 100644 --- a/src/ch/ch_events.c +++ b/src/ch/ch_events.c @@ -20,8 +20,6 @@ =20 #include =20 -#include - #include "ch_domain.h" #include "ch_events.h" #include "ch_process.h" @@ -31,6 +29,137 @@ VIR_LOG_INIT("ch.ch_events"); =20 =20 +/** + * virCHProcessEvents: + * @mon: the CH monitor object + * + * Parse the events from the event buffer and process them + * Example event: + * { + * "timestamp": { + * "secs": 0, + * "nanos": 29228206 + * }, + * "source": "vm", + * "event": "booted", + * "properties": null + * } + * + * Returns: 0 on success, -1 on failure + */ +static int virCHProcessEvents(virCHMonitor *mon) +{ + virDomainObj *vm =3D mon->vm; + char *buf =3D mon->event_buffer.buffer; + ssize_t sz =3D mon->event_buffer.buf_fill_sz; + virJSONValue *obj =3D NULL; + int blocks =3D 0; + size_t i =3D 0; + char *json_start; + ssize_t start_index =3D -1; + ssize_t end_index =3D -1; + char tmp; + + while (i < sz) { + if (buf[i] =3D=3D '{') { + blocks++; + if (blocks =3D=3D 1) + start_index =3D i; + } else if (buf[i] =3D=3D '}' && blocks > 0) { + blocks--; + if (blocks =3D=3D 0) { + /* valid json document */ + end_index =3D i; + + /* temporarily null terminate the JSON doc */ + tmp =3D buf[end_index + 1]; + buf[end_index + 1] =3D '\0'; + json_start =3D buf + start_index; + + if ((obj =3D virJSONValueFromString(json_start))) { + /* Process the event string (obj) here */ + virJSONValueFree(obj); + } else { + VIR_ERROR(_("%1$s: Invalid JSON event doc: %2$s"), + vm->def->name, json_start); + return -1; + } + + /* replace the original character */ + buf[end_index + 1] =3D tmp; + start_index =3D -1; + } + } + + i++; + } + + if (start_index =3D=3D -1) { + /* We have processed all the JSON docs in the buffer */ + mon->event_buffer.buf_fill_sz =3D 0; + } else if (start_index > 0) { + /* We have an incomplete JSON doc at the end of the buffer + * Move it to the start of the buffer + */ + mon->event_buffer.buf_fill_sz =3D sz - start_index; + memmove(buf, buf+start_index, mon->event_buffer.buf_fill_sz); + } + + return 0; +} + +static int virCHReadProcessEvents(virCHMonitor *mon) +{ + /* Event json string must always terminate with null char. + * So, reserve one byte for '\0' at the end. + */ + size_t max_sz =3D CH_EVENT_BUFFER_SZ - 1; + char *buf =3D mon->event_buffer.buffer; + virDomainObj *vm =3D mon->vm; + bool incomplete =3D false; + size_t sz =3D 0; + int event_monitor_fd =3D mon->eventmonitorfd; + + memset(buf, 0, max_sz); + do { + ssize_t ret; + + ret =3D read(event_monitor_fd, buf + sz, max_sz - sz); + if (ret =3D=3D 0 || (ret < 0 && errno =3D=3D EINTR)) { + g_usleep(G_USEC_PER_SEC); + continue; + } else if (ret < 0) { + /* We should never reach here. read(2) says possible errors + * are EINTR, EAGAIN, EBADF, EFAULT, EINVAL, EIO, EISDIR + * We handle EINTR gracefully. There is some serious issue + * if we encounter any of the other errors(either in our code + * or in the system). + */ + VIR_ERROR(_("%1$s: Failed to read ch events!: %2$s"), + vm->def->name, g_strerror(errno)); + return -1; + } + + sz +=3D ret; + mon->event_buffer.buf_fill_sz =3D sz; + + if (virCHProcessEvents(mon) < 0) { + VIR_ERROR(_("%1$s: Failed to parse and process events"), + vm->def->name); + return -1; + } + + if (mon->event_buffer.buf_fill_sz !=3D 0) + incomplete =3D true; + else + incomplete =3D false; + sz =3D mon->event_buffer.buf_fill_sz; + + } while (virDomainObjIsActive(vm) && (sz < max_sz) && incomplete); + + return 0; +} + static void virCHEventHandlerLoop(void *data) { virCHMonitor *mon =3D data; @@ -41,11 +170,17 @@ static void virCHEventHandlerLoop(void *data) =20 VIR_DEBUG("%s: Event handler loop thread starting", vm->def->name); =20 + mon->event_buffer.buffer =3D g_malloc_n(sizeof(char), CH_EVENT_BUFFER_= SZ); + mon->event_buffer.buf_fill_sz =3D 0; + while (g_atomic_int_get(&mon->event_handler_stop) =3D=3D 0) { VIR_DEBUG("%s: Reading events from event monitor file", vm->def->n= ame); - /* Read and process events here */ + if (virCHReadProcessEvents(mon) < 0) { + virCHStopEventHandler(mon); + } } =20 + g_clear_pointer(&mon->event_buffer.buffer, g_free); virObjectUnref(vm); VIR_DEBUG("%s: Event handler loop thread exiting", vm->def->name); return; diff --git a/src/ch/ch_events.h b/src/ch/ch_events.h index 4c8a48231d..2e9cdf03bb 100644 --- a/src/ch/ch_events.h +++ b/src/ch/ch_events.h @@ -22,5 +22,7 @@ =20 #include "ch_monitor.h" =20 +#define CH_EVENT_BUFFER_SZ PIPE_BUF + int virCHStartEventHandler(virCHMonitor *mon); void virCHStopEventHandler(virCHMonitor *mon); diff --git a/src/ch/ch_monitor.h b/src/ch/ch_monitor.h index b9092f22b8..185de0dbfd 100644 --- a/src/ch/ch_monitor.h +++ b/src/ch/ch_monitor.h @@ -101,6 +101,12 @@ struct _virCHMonitor { =20 virThread event_handler_thread; int event_handler_stop; + struct { + /* Buffer to hold the data read from pipe */ + char *buffer; + /* Size of the data read from pipe into buffer */ + size_t buf_fill_sz; + } event_buffer; =20 pid_t pid; =20 --=20 2.34.1 From nobody Tue Jan 21 04:22:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1737134030142688.236886362677; Fri, 17 Jan 2025 09:13:50 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 897EA1A91; Fri, 17 Jan 2025 12:13:49 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 369861A6C; Fri, 17 Jan 2025 12:11:37 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4D82E1B50; Fri, 17 Jan 2025 12:11:32 -0500 (EST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lists.libvirt.org (Postfix) with ESMTP id 6B62818FF for ; Fri, 17 Jan 2025 12:11:16 -0500 (EST) Received: from paekkaladevi-dev-u22.gi4irqh5pfqublruu4yyku2wof.phxx.internal.cloudapp.net (unknown [20.125.125.171]) by linux.microsoft.com (Postfix) with ESMTPSA id EC55620591BC; Fri, 17 Jan 2025 09:11:11 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EC55620591BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1737133872; bh=z/kQvaSa8QON6Xiow3v5PMzvNZAXP7pdE/MOKmx0vX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F/w/B/NzcO0GFVtFJEbD8S6xalLMLfpSky4gDsUr/UIP6okE9z1DNUMhtlMwf867b s/6Dd+kKWoBTEhLUaPL8xoTy3VJ9GtfHIFH4p4565PmmgA7HRj4TvQ46Myc7a7wmFq eY9hx+p4T+u9T0NmKMmU1U/sbYurOengxdnBgfQ8= From: Purna Pavan Chandra Aekkaladevi To: devel@lists.libvirt.org Subject: [PATCH v5 4/5] ch: events: facilitate lifecycle events handling Date: Fri, 17 Jan 2025 17:11:08 +0000 Message-Id: <20250117171109.639464-5-paekkaladevi@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> References: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4XMP2YNMVAU3YAD2LIOBFL4DYNXF432N X-Message-ID-Hash: 4XMP2YNMVAU3YAD2LIOBFL4DYNXF432N X-MailFrom: paekkaladevi@linux.microsoft.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: liuwe@microsoft.com, paekkaladevi@microsoft.com, jnadimpalli@microsoft.com, prasad.krishnan@microsoft.com, prapal@linux.microsoft.com, Purna Pavan Chandra Aekkaladevi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1737134031882019000 Content-Type: text/plain; charset="utf-8" Implement `virCHProcessEvent` that maps event string to corresponding event type and take appropriate actions. As part of this, handle the shutdown event by correctly updating the domain state. This change also facilitates the handling of other VM lifecycle events, such as booting, rebooting, pause, resume, etc. Signed-off-by: Purna Pavan Chandra Aekkaladevi --- src/ch/ch_events.c | 101 ++++++++++++++++++++++++++++++++++++++++++++- src/ch/ch_events.h | 26 ++++++++++++ 2 files changed, 126 insertions(+), 1 deletion(-) diff --git a/src/ch/ch_events.c b/src/ch/ch_events.c index c5c703ded7..685ddeaa31 100644 --- a/src/ch/ch_events.c +++ b/src/ch/ch_events.c @@ -28,6 +28,101 @@ =20 VIR_LOG_INIT("ch.ch_events"); =20 +VIR_ENUM_IMPL(virCHEvent, + VIR_CH_EVENT_LAST, + "vmm:starting", + "vmm:shutdown", + "vm:booting", + "vm:booted", + "vm:rebooting", + "vm:rebooted", + "vm:shutdown", + "vm:deleted", + "vm:pausing", + "vm:paused", + "vm:resuming", + "vm:resumed", + "vm:snapshotting", + "vm:snapshotted", + "vm:restoring", + "vm:restored", +); + +static int virCHEventStopProcess(virDomainObj *vm, + virDomainShutoffReason reason) +{ + virCHDriver *driver =3D ((virCHDomainObjPrivate *)vm->privateData)->d= river; + + virObjectLock(vm); + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY)) + return -1; + virCHProcessStop(driver, vm, reason); + virDomainObjEndJob(vm); + virObjectUnlock(vm); + + return 0; +} + +static int virCHProcessEvent(virCHMonitor *mon, + virJSONValue *eventJSON) +{ + const char *event; + const char *source; + virCHEvent ev; + g_autofree char *timestamp =3D NULL; + g_autofree char *full_event =3D NULL; + virDomainObj *vm =3D mon->vm; + int ret =3D 0; + + if (virJSONValueObjectHasKey(eventJSON, "source") =3D=3D 0) { + VIR_WARN("%s: Invalid JSON from monitor, no source key", vm->def->= name); + return -1; + } + if (virJSONValueObjectHasKey(eventJSON, "event") =3D=3D 0) { + VIR_WARN("%s: Invalid JSON from monitor, no event key", vm->def->n= ame); + return -1; + } + source =3D virJSONValueObjectGetString(eventJSON, "source"); + event =3D virJSONValueObjectGetString(eventJSON, "event"); + full_event =3D g_strdup_printf("%s:%s", source, event); + ev =3D virCHEventTypeFromString(full_event); + VIR_DEBUG("%s: Source: %s, Event: %s, ev: %d", vm->def->name, source, = event, ev); + + switch (ev) { + case VIR_CH_EVENT_VMM_STARTING: + 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: + case VIR_CH_EVENT_VM_RESUMED: + case VIR_CH_EVENT_VM_SNAPSHOTTING: + case VIR_CH_EVENT_VM_SNAPSHOTTED: + case VIR_CH_EVENT_VM_RESTORING: + case VIR_CH_EVENT_VM_RESTORED: + case VIR_CH_EVENT_VM_DELETED: + break; + case VIR_CH_EVENT_VMM_SHUTDOWN: + if (virCHEventStopProcess(vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN)) { + VIR_WARN("Failed to mark the VM(%s) as SHUTDOWN!", + vm->def->name); + ret =3D -1; + } + break; + case VIR_CH_EVENT_VM_SHUTDOWN: + virObjectLock(vm); + virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOF= F_SHUTDOWN); + virObjectUnlock(vm); + break; + case VIR_CH_EVENT_LAST: + default: + VIR_WARN("%s: Unknown event: %s", vm->def->name, full_event); + } + + return ret; +} =20 /** * virCHProcessEvents: @@ -77,7 +172,11 @@ static int virCHProcessEvents(virCHMonitor *mon) json_start =3D buf + start_index; =20 if ((obj =3D virJSONValueFromString(json_start))) { - /* Process the event string (obj) here */ + if (virCHProcessEvent(mon, obj) < 0) { + VIR_ERROR(_("%1$s: Failed to process JSON event do= c: %2$s"), + vm->def->name, json_start); + return -1; + } virJSONValueFree(obj); } else { VIR_ERROR(_("%1$s: Invalid JSON event doc: %2$s"), diff --git a/src/ch/ch_events.h b/src/ch/ch_events.h index 2e9cdf03bb..3b360628f7 100644 --- a/src/ch/ch_events.h +++ b/src/ch/ch_events.h @@ -24,5 +24,31 @@ =20 #define CH_EVENT_BUFFER_SZ PIPE_BUF =20 +typedef enum { + /* source: vmm */ + VIR_CH_EVENT_VMM_STARTING =3D 0, + VIR_CH_EVENT_VMM_SHUTDOWN, + + /* source: vm */ + VIR_CH_EVENT_VM_BOOTING, + VIR_CH_EVENT_VM_BOOTED, + VIR_CH_EVENT_VM_REBOOTING, + VIR_CH_EVENT_VM_REBOOTED, + VIR_CH_EVENT_VM_SHUTDOWN, + VIR_CH_EVENT_VM_DELETED, + VIR_CH_EVENT_VM_PAUSING, + VIR_CH_EVENT_VM_PAUSED, + VIR_CH_EVENT_VM_RESUMING, + VIR_CH_EVENT_VM_RESUMED, + VIR_CH_EVENT_VM_SNAPSHOTTING, + VIR_CH_EVENT_VM_SNAPSHOTTED, + VIR_CH_EVENT_VM_RESTORING, + VIR_CH_EVENT_VM_RESTORED, + + VIR_CH_EVENT_LAST +} virCHEvent; + +VIR_ENUM_DECL(virCHEvent); + int virCHStartEventHandler(virCHMonitor *mon); void virCHStopEventHandler(virCHMonitor *mon); --=20 2.34.1 From nobody Tue Jan 21 04:22:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1737133969073296.1608628797959; Fri, 17 Jan 2025 09:12:49 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7A56B1A8B; Fri, 17 Jan 2025 12:12:48 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 05E251B30; Fri, 17 Jan 2025 12:11:20 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 897701904; Fri, 17 Jan 2025 12:11:14 -0500 (EST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lists.libvirt.org (Postfix) with ESMTP id 0D70918E6 for ; Fri, 17 Jan 2025 12:11:14 -0500 (EST) Received: from paekkaladevi-dev-u22.gi4irqh5pfqublruu4yyku2wof.phxx.internal.cloudapp.net (unknown [20.125.125.171]) by linux.microsoft.com (Postfix) with ESMTPSA id 6772E20591BD; Fri, 17 Jan 2025 09:11:12 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6772E20591BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1737133872; bh=ODdpVRZ4ts0+j6BRpdCPccRrcsbcLAuWY2N7Tuxeb/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l6/U82qousjrOyo87tcGwKxFVaUhXeu+8T7++eTsaNxOj4egEeCCr+HBJ3D6lhVFb puvK/5hYFMTu/AYJa6/CzGG76ZMpUMIG44Y2FUDwVJ2AF+ZfxIiT6qUaO2Du9Czzjx 5VdnBmUMNPORX91TXAnYEId1A9S3Mmr9w915ppfA= From: Purna Pavan Chandra Aekkaladevi To: devel@lists.libvirt.org Subject: [PATCH v5 5/5] NEWS: Mention event handling support in ch driver Date: Fri, 17 Jan 2025 17:11:09 +0000 Message-Id: <20250117171109.639464-6-paekkaladevi@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> References: <20250117171109.639464-1-paekkaladevi@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZKDAQ55D4UDBBC3RKP3ORMFJ7TXS3TDC X-Message-ID-Hash: ZKDAQ55D4UDBBC3RKP3ORMFJ7TXS3TDC X-MailFrom: paekkaladevi@linux.microsoft.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: liuwe@microsoft.com, paekkaladevi@microsoft.com, jnadimpalli@microsoft.com, prasad.krishnan@microsoft.com, prapal@linux.microsoft.com, Purna Pavan Chandra Aekkaladevi X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1737133971249019000 Content-Type: text/plain; charset="utf-8" Signed-off-by: Purna Pavan Chandra Signed-off-by: Purna Pavan Chandra Aekkaladevi --- NEWS.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index de8317be7b..c26dc3adb1 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -17,6 +17,13 @@ v11.1.0 (unreleased) =20 * **New features** =20 + * ch: Support handling events from cloud-hypervisor + + The ch driver now supports handling events from the cloud-hypervisor. + Events include VM lifecyle operations such as shutdown, pause, resume, + etc. Libvirt will now read these events and take actions such as + updating domain state, etc. + * **Improvements** =20 * **Bug fixes** --=20 2.34.1