[PATCH v5 0/5] ch: handle events from cloud-hypervisor

Purna Pavan Chandra Aekkaladevi posted 5 patches 1 year ago
Failed in applying to current master (apply log)
NEWS.rst            |   7 +
po/POTFILES         |   1 +
src/ch/ch_events.c  | 312 ++++++++++++++++++++++++++++++++++++++++++++
src/ch/ch_events.h  |  54 ++++++++
src/ch/ch_monitor.c |  76 ++++++++++-
src/ch/ch_monitor.h |  12 ++
src/ch/meson.build  |   2 +
7 files changed, 458 insertions(+), 6 deletions(-)
create mode 100644 src/ch/ch_events.c
create mode 100644 src/ch/ch_events.h
[PATCH v5 0/5] ch: handle events from cloud-hypervisor
Posted by Purna Pavan Chandra Aekkaladevi 1 year ago
changes from v4->v5:
* Incase of invalid events, exit VirCHEventHandler
* Open eventmonitor fifo (Reader end) in virCHMonitorNew itself.
  This way, we can clean exit incase open fails for some reason.

changes from v3->v4:
* Don't abort; instead kill the VM and exit
* use g_clear_pointer along with g_free
* Fix possible memory leak

changes from v2->v3:
* Remove patch 'utils: Implement virFileIsNamedPipe' as it is no more needed.
* Remove the eventmonitorpath only if it exists
* Added domain name as a prefix to logs from ch_events.c. This will make
  debugging easier.
* Simplified event parsing logic by reserving a byte for null char.

changes from v1->v2:

* Rebase on latest master
* Use /* */ for comments
* Remove fifo file if already exists
* Address other comments from Praveen Paladugu

cloud-hypervisor raises various events, including VM lifecylce operations
such as boot, shutdown, pause, resume, etc. Libvirt will now read these
events and take the necessary actions, such as correctly updating the
domain state. A FIFO file is passed to `--event-monitor` option of
cloud-hypervisor. Libvirt creates a new thread that acts as the reader
of the fifo file and continuously monitors for new events. Currently,
shutdown events are handled by updating the domain state appropriately.

Purna Pavan Chandra Aekkaladevi (5):
  ch: pass --event-monitor option to cloud-hypervisor
  ch: start a new thread for handling ch events
  ch: events: Read and parse cloud-hypervisor events
  ch: events: facilitate lifecycle events handling
  NEWS: Mention event handling support in ch driver

 NEWS.rst            |   7 +
 po/POTFILES         |   1 +
 src/ch/ch_events.c  | 312 ++++++++++++++++++++++++++++++++++++++++++++
 src/ch/ch_events.h  |  54 ++++++++
 src/ch/ch_monitor.c |  76 ++++++++++-
 src/ch/ch_monitor.h |  12 ++
 src/ch/meson.build  |   2 +
 7 files changed, 458 insertions(+), 6 deletions(-)
 create mode 100644 src/ch/ch_events.c
 create mode 100644 src/ch/ch_events.h

-- 
2.34.1
Re: [PATCH v5 0/5] ch: handle events from cloud-hypervisor
Posted by Praveen K Paladugu 1 year ago
LGTM!

Praveen

On 1/17/2025 11:11 AM, Purna Pavan Chandra Aekkaladevi wrote:
> changes from v4->v5:
> * Incase of invalid events, exit VirCHEventHandler
> * Open eventmonitor fifo (Reader end) in virCHMonitorNew itself.
>    This way, we can clean exit incase open fails for some reason.
> 
> changes from v3->v4:
> * Don't abort; instead kill the VM and exit
> * use g_clear_pointer along with g_free
> * Fix possible memory leak
> 
> changes from v2->v3:
> * Remove patch 'utils: Implement virFileIsNamedPipe' as it is no more needed.
> * Remove the eventmonitorpath only if it exists
> * Added domain name as a prefix to logs from ch_events.c. This will make
>    debugging easier.
> * Simplified event parsing logic by reserving a byte for null char.
> 
> changes from v1->v2:
> 
> * Rebase on latest master
> * Use /* */ for comments
> * Remove fifo file if already exists
> * Address other comments from Praveen Paladugu
> 
> cloud-hypervisor raises various events, including VM lifecylce operations
> such as boot, shutdown, pause, resume, etc. Libvirt will now read these
> events and take the necessary actions, such as correctly updating the
> domain state. A FIFO file is passed to `--event-monitor` option of
> cloud-hypervisor. Libvirt creates a new thread that acts as the reader
> of the fifo file and continuously monitors for new events. Currently,
> shutdown events are handled by updating the domain state appropriately.
> 
> Purna Pavan Chandra Aekkaladevi (5):
>    ch: pass --event-monitor option to cloud-hypervisor
>    ch: start a new thread for handling ch events
>    ch: events: Read and parse cloud-hypervisor events
>    ch: events: facilitate lifecycle events handling
>    NEWS: Mention event handling support in ch driver
> 
>   NEWS.rst            |   7 +
>   po/POTFILES         |   1 +
>   src/ch/ch_events.c  | 312 ++++++++++++++++++++++++++++++++++++++++++++
>   src/ch/ch_events.h  |  54 ++++++++
>   src/ch/ch_monitor.c |  76 ++++++++++-
>   src/ch/ch_monitor.h |  12 ++
>   src/ch/meson.build  |   2 +
>   7 files changed, 458 insertions(+), 6 deletions(-)
>   create mode 100644 src/ch/ch_events.c
>   create mode 100644 src/ch/ch_events.h
> 

-- 
Regards,
Praveen K Paladugu
Re: [PATCH v5 0/5] ch: handle events from cloud-hypervisor
Posted by Michal Prívozník 1 year ago
On 1/17/25 18:11, Purna Pavan Chandra Aekkaladevi wrote:
> changes from v4->v5:
> * Incase of invalid events, exit VirCHEventHandler
> * Open eventmonitor fifo (Reader end) in virCHMonitorNew itself.
>   This way, we can clean exit incase open fails for some reason.
> 
> changes from v3->v4:
> * Don't abort; instead kill the VM and exit
> * use g_clear_pointer along with g_free
> * Fix possible memory leak
> 
> changes from v2->v3:
> * Remove patch 'utils: Implement virFileIsNamedPipe' as it is no more needed.
> * Remove the eventmonitorpath only if it exists
> * Added domain name as a prefix to logs from ch_events.c. This will make
>   debugging easier.
> * Simplified event parsing logic by reserving a byte for null char.
> 
> changes from v1->v2:
> 
> * Rebase on latest master
> * Use /* */ for comments
> * Remove fifo file if already exists
> * Address other comments from Praveen Paladugu
> 
> cloud-hypervisor raises various events, including VM lifecylce operations
> such as boot, shutdown, pause, resume, etc. Libvirt will now read these
> events and take the necessary actions, such as correctly updating the
> domain state. A FIFO file is passed to `--event-monitor` option of
> cloud-hypervisor. Libvirt creates a new thread that acts as the reader
> of the fifo file and continuously monitors for new events. Currently,
> shutdown events are handled by updating the domain state appropriately.
> 
> Purna Pavan Chandra Aekkaladevi (5):
>   ch: pass --event-monitor option to cloud-hypervisor
>   ch: start a new thread for handling ch events
>   ch: events: Read and parse cloud-hypervisor events
>   ch: events: facilitate lifecycle events handling
>   NEWS: Mention event handling support in ch driver
> 
>  NEWS.rst            |   7 +
>  po/POTFILES         |   1 +
>  src/ch/ch_events.c  | 312 ++++++++++++++++++++++++++++++++++++++++++++
>  src/ch/ch_events.h  |  54 ++++++++
>  src/ch/ch_monitor.c |  76 ++++++++++-
>  src/ch/ch_monitor.h |  12 ++
>  src/ch/meson.build  |   2 +
>  7 files changed, 458 insertions(+), 6 deletions(-)
>  create mode 100644 src/ch/ch_events.c
>  create mode 100644 src/ch/ch_events.h
> 

Fixed small formatting issues and merged. Kudos for not forgetting NEWS.rst!

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal