nfs-ganesha: Add DBus support for metrics and management

https://github.com/nfs-ganesha/nfs-ganesha/wiki/Dbusinterface
This commit is contained in:
Davíð Steinn Geirsson
2025-09-01 17:05:11 +00:00
parent e088d0b8a7
commit eff9c8c99e
2 changed files with 61 additions and 2 deletions
@@ -0,0 +1,44 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 73276dff6..94027f5cb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -974,21 +974,27 @@ endif(USE_EFENCE)
gopt_test(USE_DBUS)
if(USE_DBUS)
- find_package(PkgConfig)
- # pkg_check_modules doesn't fatal error on REQUIRED, so handle it ourselves
- pkg_check_modules(DBUS ${USE_DBUS_REQUIRED} dbus-1)
- if(NOT DBUS_FOUND)
- if(USE_DBUS_REQUIRED)
- message(FATAL_ERROR "Cannot find DBUS libs but requested on command line")
- else(USE_DBUS_REQUIRED)
- message(WARNING "Cannot find DBUS libs. Disabling DBUS support")
- set(USE_DBUS OFF)
- endif(USE_DBUS_REQUIRED)
- else(NOT DBUS_FOUND)
+ if(DBUS_NO_PKGCONFIG)
set(SYSTEM_LIBRARIES ${DBUS_LIBRARIES} ${SYSTEM_LIBRARIES})
LIST(APPEND CMAKE_LIBRARY_PATH ${DBUS_LIBRARY_DIRS})
link_directories (${DBUS_LIBRARY_DIRS})
- endif(NOT DBUS_FOUND)
+ else(DBUS_NO_PKGCONFIG)
+ find_package(PkgConfig)
+ # pkg_check_modules doesn't fatal error on REQUIRED, so handle it ourselves
+ pkg_check_modules(DBUS ${USE_DBUS_REQUIRED} dbus-1)
+ if(NOT DBUS_FOUND)
+ if(USE_DBUS_REQUIRED)
+ message(FATAL_ERROR "Cannot find DBUS libs but requested on command line")
+ else(USE_DBUS_REQUIRED)
+ message(WARNING "Cannot find DBUS libs. Disabling DBUS support")
+ set(USE_DBUS OFF)
+ endif(USE_DBUS_REQUIRED)
+ else(NOT DBUS_FOUND)
+ set(SYSTEM_LIBRARIES ${DBUS_LIBRARIES} ${SYSTEM_LIBRARIES})
+ LIST(APPEND CMAKE_LIBRARY_PATH ${DBUS_LIBRARY_DIRS})
+ link_directories (${DBUS_LIBRARY_DIRS})
+ endif(NOT DBUS_FOUND)
+ endif(DBUS_NO_PKGCONFIG)
endif(USE_DBUS)
if(USE_CB_SIMULATOR AND NOT USE_DBUS)
+17 -2
View File
@@ -8,7 +8,6 @@
krb5,
xfsprogs,
jemalloc,
dbus,
libcap,
ntirpc,
liburcu,
@@ -18,6 +17,8 @@
acl,
useCeph ? false,
ceph,
useDbus ? true,
dbus,
}:
stdenv.mkDerivation rec {
@@ -37,6 +38,8 @@ stdenv.mkDerivation rec {
hash = "sha256-OHGmEzHu8y/TPQ70E2sicaLtNgvlf/bRq8JRs6S1tpY=";
};
patches = lib.optional useDbus ./allow-bypassing-dbus-pkg-config-test.patch;
preConfigure = "cd src";
cmakeFlags = [
@@ -52,6 +55,13 @@ stdenv.mkDerivation rec {
"-DRADOS_URLS=ON"
"-DUSE_FSAL_CEPH=ON"
"-DUSE_FSAL_RGW=ON"
]
++ lib.optionals useDbus [
"-DUSE_DBUS=ON"
"-DDBUS_NO_PKGCONFIG=ON"
"-DDBUS_LIBRARY_DIRS=${dbus.lib}/lib"
"-DDBUS_INCLUDE_DIRS=${dbus.dev}/include/dbus-1.0\\;${dbus.lib}/lib/dbus-1.0/include"
"-DDBUS_LIBRARIES=dbus-1"
];
nativeBuildInputs = [
@@ -60,7 +70,8 @@ stdenv.mkDerivation rec {
bison
flex
sphinx
];
]
++ lib.optional useDbus dbus.dev;
buildInputs = [
acl
@@ -91,6 +102,10 @@ stdenv.mkDerivation rec {
postInstall = ''
install -Dm755 $src/src/tools/mount.9P $tools/bin/mount.9P
''
+ lib.optionalString useDbus ''
# Policy for D-Bus statistics interface
install -Dm644 $src/src/scripts/ganeshactl/org.ganesha.nfsd.conf $out/etc/dbus-1/system.d/org.ganesha.nfsd.conf
'';
meta = with lib; {