[PATCH v2] domain_logcontext: Don't assume remote driver is always available

Michal Privoznik via Devel posted 1 patch 2 weeks, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/b24079787f1cacdb80f52cc3ac368aac38413aca.1768487880.git.mprivozn@redhat.com
src/hypervisor/meson.build | 7 ++++++-
src/libvirt_logging.syms   | 7 +++++++
src/libvirt_private.syms   | 7 -------
3 files changed, 13 insertions(+), 8 deletions(-)
[PATCH v2] domain_logcontext: Don't assume remote driver is always available
Posted by Michal Privoznik via Devel 2 weeks, 3 days ago
From: Michal Privoznik <mprivozn@redhat.com>

Some functions inside of domain_logcontext.c call virLogManager
APIs. But that one is available only when remote driver is
enabled. Therefore, make domain_logcontext.c conditional, just
like log_manager.c is: if config.has('WITH_REMOTE').

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/842
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

v2 of:

https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/7HSM5JB5C7GLBJWXH5A2N2NNAGWXRQFC/

diff to v1:
- Instead of #ifdef-ing virLogManager APIs, just make the whole
  domain_logcontext.c compiled conditionally.

 src/hypervisor/meson.build | 7 ++++++-
 src/libvirt_logging.syms   | 7 +++++++
 src/libvirt_private.syms   | 7 -------
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/hypervisor/meson.build b/src/hypervisor/meson.build
index c32703af88..91eaefbebc 100644
--- a/src/hypervisor/meson.build
+++ b/src/hypervisor/meson.build
@@ -2,11 +2,16 @@ hypervisor_sources = [
   'domain_cgroup.c',
   'domain_driver.c',
   'domain_interface.c',
-  'domain_logcontext.c',
   'virclosecallbacks.c',
   'virhostdev.c',
 ]
 
+if conf.has('WITH_REMOTE')
+  hypervisor_sources += [
+    'domain_logcontext.c'
+  ]
+endif
+
 stateful_driver_source_files += files(hypervisor_sources)
 
 hypervisor_lib = static_library(
diff --git a/src/libvirt_logging.syms b/src/libvirt_logging.syms
index e2a1a7109f..5e867703cb 100644
--- a/src/libvirt_logging.syms
+++ b/src/libvirt_logging.syms
@@ -3,6 +3,13 @@
 #
 
 
+# hypervisor/domain_logcontext.h
+domainLogContextGetWriteFD;
+domainLogContextMarkPosition;
+domainLogContextNew;
+domainLogContextReadFiltered;
+domainLogContextWrite;
+
 # logging/log_manager.h
 virLogManagerDomainAppendMessage;
 virLogManagerDomainGetLogFilePosition;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4e57e4a8f6..51f4d6db24 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1695,13 +1695,6 @@ virDomainInterfaceStopDevice;
 virDomainInterfaceStopDevices;
 virDomainInterfaceVportRemove;
 
-# hypervisor/domain_logcontext.h
-domainLogContextGetWriteFD;
-domainLogContextMarkPosition;
-domainLogContextNew;
-domainLogContextReadFiltered;
-domainLogContextWrite;
-
 # hypervisor/virclosecallbacks.h
 virCloseCallbacksDomainAdd;
 virCloseCallbacksDomainAlloc;
-- 
2.52.0
Re: [PATCH v2] domain_logcontext: Don't assume remote driver is always available
Posted by Daniel P. Berrangé via Devel 2 weeks, 3 days ago
On Thu, Jan 15, 2026 at 03:39:11PM +0100, Michal Privoznik via Devel wrote:
> From: Michal Privoznik <mprivozn@redhat.com>
> 
> Some functions inside of domain_logcontext.c call virLogManager
> APIs. But that one is available only when remote driver is
> enabled. Therefore, make domain_logcontext.c conditional, just
> like log_manager.c is: if config.has('WITH_REMOTE').
> 
> Resolves: https://gitlab.com/libvirt/libvirt/-/issues/842
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
> 
> v2 of:
> 
> https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/7HSM5JB5C7GLBJWXH5A2N2NNAGWXRQFC/
> 
> diff to v1:
> - Instead of #ifdef-ing virLogManager APIs, just make the whole
>   domain_logcontext.c compiled conditionally.
> 
>  src/hypervisor/meson.build | 7 ++++++-
>  src/libvirt_logging.syms   | 7 +++++++
>  src/libvirt_private.syms   | 7 -------
>  3 files changed, 13 insertions(+), 8 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|