diff --git a/CONFIG b/CONFIG index 29c558b37..eba5a8b61 100644 --- a/CONFIG +++ b/CONFIG @@ -204,3 +204,6 @@ CONFIG_HAVE_LIBBSD=n # Path to IPSEC_MB used by DPDK CONFIG_IPSEC_MB_DIR= + +# Generate Storage Management Agent's protobuf interface +CONFIG_SMA=n diff --git a/configure b/configure index 0ca5c9c4c..93393baaf 100755 --- a/configure +++ b/configure @@ -106,6 +106,8 @@ function usage() { echo " Path to clang_rt.fuzzer_no_main library required." echo " Requires setting CC and CXX to clang." echo " (Typically /usr/lib/llvm-VER/lib/clang/VER/lib/linux/libclang_rt.fuzzer_no_main-ARCH.a)" + echo " --with-sma Generate Storage Management Agent's protobuf interface" + echo " --without-sma No path required." echo "" echo "Environment variables:" echo "" @@ -623,6 +625,12 @@ for i in "$@"; do CONFIG[FUZZER]=n CONFIG[FUZZER_LIB]= ;; + --with-sma) + CONFIG[SMA]=y + ;; + --without-sma) + CONFIG[SMA]=n + ;; --) break ;; @@ -1109,6 +1117,14 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then cd $rootdir fi +if [[ "${CONFIG[SMA]}" = "y" ]]; then + if ! python3 -c 'import grpc; import grpc_tools' 2> /dev/null; then + echo "--with-sma requires grpcio and grpcio-tools python packages." + echo "Please install then re-run this script." + exit 1 + fi +fi + # For ARM Neoverse-N1 platform, debug build needs gcc version newer than 8.4 if [[ "${CONFIG[DEBUG]}" = "y" && $arch = aarch64* && "$CC_TYPE" = "gcc" ]]; then GCC_VERSION=$($CC -dumpfullversion) diff --git a/python/Makefile b/python/Makefile index 9f99d5fd6..08990047e 100644 --- a/python/Makefile +++ b/python/Makefile @@ -40,8 +40,7 @@ $(1)/%_pb2.py $(1)/%_pb2_grpc.py: $(1)/%.proto --grpc_python_out=$(1) --proto_path=$(1) $$^ endef -# Check for the required modules here until there's a configure option for SMA -ifeq ($(shell python3 -c 'import grpc; import grpc_tools' && echo 0),0) +ifeq ($(CONFIG_SMA),y) protodirs = spdk/sma/proto protodefs = $(foreach protodir,$(protodirs),$(wildcard $(protodir)/*.proto)) protopy = $(foreach proto,$(basename $(protodefs)),$(addprefix $(proto),_pb2.py _pb2_grpc.py)) diff --git a/scripts/pkgdep/arch.sh b/scripts/pkgdep/arch.sh index 46d435159..252302e2b 100755 --- a/scripts/pkgdep/arch.sh +++ b/scripts/pkgdep/arch.sh @@ -9,6 +9,8 @@ pip install configshell_fb pip install pyelftools pip install ijson pip install python-magic +pip install grpcio +pip install grpcio-tools # Additional dependencies for DPDK pacman -Sy --needed --noconfirm numactl nasm # Additional dependencies for ISA-L used in compression diff --git a/scripts/pkgdep/debian.sh b/scripts/pkgdep/debian.sh index 7c7ba8ccf..62550194c 100755 --- a/scripts/pkgdep/debian.sh +++ b/scripts/pkgdep/debian.sh @@ -15,6 +15,8 @@ fi pip3 install pyelftools pip3 install ijson pip3 install python-magic +pip3 install grpcio +pip3 install grpcio-tools # Additional dependencies for SPDK CLI - not available on older Ubuntus apt-get install -y python3-configshell-fb python3-pexpect || echo \ "Note: Some SPDK CLI dependencies could not be installed." diff --git a/scripts/pkgdep/rhel.sh b/scripts/pkgdep/rhel.sh index 2a5c76c47..dbd2ac8e9 100755 --- a/scripts/pkgdep/rhel.sh +++ b/scripts/pkgdep/rhel.sh @@ -103,6 +103,8 @@ pip3 install meson pip3 install pyelftools pip3 install ijson pip3 install python-magic +pip3 install grpcio +pip3 install grpcio-tools # Additional dependencies for SPDK CLI - not available in rhel and centos if ! echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7'; then