nfs-ganesha: Add DBus support for metrics and management

https://github.com/nfs-ganesha/nfs-ganesha/wiki/Dbusinterface

+61 -2
+44
pkgs/by-name/nf/nfs-ganesha/allow-bypassing-dbus-pkg-config-test.patch
··· 1 + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt 2 + index 73276dff6..94027f5cb 100644 3 + --- a/src/CMakeLists.txt 4 + +++ b/src/CMakeLists.txt 5 + @@ -974,21 +974,27 @@ endif(USE_EFENCE) 6 + 7 + gopt_test(USE_DBUS) 8 + if(USE_DBUS) 9 + - find_package(PkgConfig) 10 + - # pkg_check_modules doesn't fatal error on REQUIRED, so handle it ourselves 11 + - pkg_check_modules(DBUS ${USE_DBUS_REQUIRED} dbus-1) 12 + - if(NOT DBUS_FOUND) 13 + - if(USE_DBUS_REQUIRED) 14 + - message(FATAL_ERROR "Cannot find DBUS libs but requested on command line") 15 + - else(USE_DBUS_REQUIRED) 16 + - message(WARNING "Cannot find DBUS libs. Disabling DBUS support") 17 + - set(USE_DBUS OFF) 18 + - endif(USE_DBUS_REQUIRED) 19 + - else(NOT DBUS_FOUND) 20 + + if(DBUS_NO_PKGCONFIG) 21 + set(SYSTEM_LIBRARIES ${DBUS_LIBRARIES} ${SYSTEM_LIBRARIES}) 22 + LIST(APPEND CMAKE_LIBRARY_PATH ${DBUS_LIBRARY_DIRS}) 23 + link_directories (${DBUS_LIBRARY_DIRS}) 24 + - endif(NOT DBUS_FOUND) 25 + + else(DBUS_NO_PKGCONFIG) 26 + + find_package(PkgConfig) 27 + + # pkg_check_modules doesn't fatal error on REQUIRED, so handle it ourselves 28 + + pkg_check_modules(DBUS ${USE_DBUS_REQUIRED} dbus-1) 29 + + if(NOT DBUS_FOUND) 30 + + if(USE_DBUS_REQUIRED) 31 + + message(FATAL_ERROR "Cannot find DBUS libs but requested on command line") 32 + + else(USE_DBUS_REQUIRED) 33 + + message(WARNING "Cannot find DBUS libs. Disabling DBUS support") 34 + + set(USE_DBUS OFF) 35 + + endif(USE_DBUS_REQUIRED) 36 + + else(NOT DBUS_FOUND) 37 + + set(SYSTEM_LIBRARIES ${DBUS_LIBRARIES} ${SYSTEM_LIBRARIES}) 38 + + LIST(APPEND CMAKE_LIBRARY_PATH ${DBUS_LIBRARY_DIRS}) 39 + + link_directories (${DBUS_LIBRARY_DIRS}) 40 + + endif(NOT DBUS_FOUND) 41 + + endif(DBUS_NO_PKGCONFIG) 42 + endif(USE_DBUS) 43 + 44 + if(USE_CB_SIMULATOR AND NOT USE_DBUS)
+17 -2
pkgs/by-name/nf/nfs-ganesha/package.nix
··· 8 8 krb5, 9 9 xfsprogs, 10 10 jemalloc, 11 - dbus, 12 11 libcap, 13 12 ntirpc, 14 13 liburcu, ··· 18 17 acl, 19 18 useCeph ? false, 20 19 ceph, 20 + useDbus ? true, 21 + dbus, 21 22 }: 22 23 23 24 stdenv.mkDerivation rec { ··· 36 37 rev = "V${version}"; 37 38 hash = "sha256-OHGmEzHu8y/TPQ70E2sicaLtNgvlf/bRq8JRs6S1tpY="; 38 39 }; 40 + 41 + patches = lib.optional useDbus ./allow-bypassing-dbus-pkg-config-test.patch; 39 42 40 43 preConfigure = "cd src"; 41 44 ··· 52 55 "-DRADOS_URLS=ON" 53 56 "-DUSE_FSAL_CEPH=ON" 54 57 "-DUSE_FSAL_RGW=ON" 58 + ] 59 + ++ lib.optionals useDbus [ 60 + "-DUSE_DBUS=ON" 61 + "-DDBUS_NO_PKGCONFIG=ON" 62 + "-DDBUS_LIBRARY_DIRS=${dbus.lib}/lib" 63 + "-DDBUS_INCLUDE_DIRS=${dbus.dev}/include/dbus-1.0\\;${dbus.lib}/lib/dbus-1.0/include" 64 + "-DDBUS_LIBRARIES=dbus-1" 55 65 ]; 56 66 57 67 nativeBuildInputs = [ ··· 60 70 bison 61 71 flex 62 72 sphinx 63 - ]; 73 + ] 74 + ++ lib.optional useDbus dbus.dev; 64 75 65 76 buildInputs = [ 66 77 acl ··· 91 102 92 103 postInstall = '' 93 104 install -Dm755 $src/src/tools/mount.9P $tools/bin/mount.9P 105 + '' 106 + + lib.optionalString useDbus '' 107 + # Policy for D-Bus statistics interface 108 + install -Dm644 $src/src/scripts/ganeshactl/org.ganesha.nfsd.conf $out/etc/dbus-1/system.d/org.ganesha.nfsd.conf 94 109 ''; 95 110 96 111 meta = with lib; {