openebs / mayastor

Dynamically provision Stateful Persistent Replicated Cluster-wide Fabric Volumes & Filesystems for Kubernetes that is provisioned from an optimized NVME SPDK backend data storage stack.
Apache License 2.0
755 stars 109 forks source link

How to setup a development environment? #1158

Closed MaisenbacherD closed 2 years ago

MaisenbacherD commented 2 years ago

Describe the bug Hello :) I am trying to setup a Mayastor development environment where I am able to run the test suite with cargo test -- --test-threads 1.

To do so I am following the instructions of https://github.com/openebs/mayastor/blob/develop/doc/build.md and later on https://github.com/openebs/mayastor/blob/develop/doc/test.md

However, the nix develop step fails when using the nix-shell with this error message:

error: attribute 'mayastor' in selection path 'mayastor' not found

When trying to use the docker nix-shell with docker run --name mayastor-nix-prefetch -it -v $(pwd):/scratch:rw --privileged --workdir /scratch nixos/nix nix-shell --run "exit 0" I am getting the following error:

An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /root/.cache/pre-commit/pre-commit.log

To Reproduce Installing Nix as recommended on https://nixos.org/download.html :

sh <(curl -L https://nixos.org/nix/install) --daemon

Following the build instructions:

git clone https://github.com/openebs/mayastor.git
cd mayastor
#checked out on the develop branch as this is the default branch
git submodule update --init --recursive
nix-shell -I nixpkgs=channel:nixpkgs-unstable -p nixUnstable --command "nix --experimental-features 'nix-command flakes' develop -f . mayastor"

After that I tried to get the nix-shell in a docker container:

docker run --name mayastor-nix-prefetch -it -v $(pwd):/scratch:rw --privileged --workdir /scratch nixos/nix nix-shell --run "exit 0"

Expected behavior I am expecting to be dropped into a nix-shell where the prerequisites are installed, such that I am able to execute cargo build.

Screenshots Output of nix-shell -I nixpkgs=channel:nixpkgs-unstable -p nixUnstable --command "nix --experimental-features 'nix-command flakes' develop -f . mayastor":

these 81 paths will be fetched (75.96 MiB download, 339.36 MiB unpacked):
  /nix/store/01bkry44wndk7m5d1bi3gyfmc3izs9lz-bash-interactive-5.1-p16-dev
  /nix/store/0k3mxbfivw9vxfkj8ir9lr1bncx5vm70-ed-1.18
  /nix/store/11r68cic7w87rk9prfm9wq53fxdwnmyq-busybox-static-x86_64-unknown-linux-musl-1.35.0
  /nix/store/1apjzarlbpcgrd0cgv3m3211nkhb3549-expand-response-params
  /nix/store/1x698alsd5iwx373x1f7313y0971qc24-aws-c-compression-0.2.14
  /nix/store/28w1n1an6wgdnfb8dw9bk3ppmlvmw196-linux-headers-5.18
  /nix/store/2aj5gchjipzd8y2bnl91038ypf599gxg-bash-interactive-5.1-p16-doc
  /nix/store/2j1x6fj0lc9ykixnnfv1ykfmsf58iqwg-nix-2.9.1-dev
  /nix/store/3f124aji5xay9z4jz5b8jk6gggsb1rr1-aws-c-cal-0.5.17
  /nix/store/3hjcxhm76ikw4dm4i9kzyc5q6i7jlara-nix-2.9.1-man
  /nix/store/3j18grljsyy4nxc078g00sy4cx6cf16g-bash-5.1-p16
  /nix/store/4271vxflcnxwkdiscrg4g5kc9gw930k0-openssl-1.1.1p
  /nix/store/46xckgidqmai1wadl4ny6k2p0hlzffcn-s2n-tls-1.3.12
  /nix/store/4a296l1jh89zabvgm1k7s26p5gypj59h-curl-7.83.1
  /nix/store/58npxfip0nlr13iy9q76nij2hx3cn4y8-libarchive-3.6.1-lib
  /nix/store/58s5gw0pzp3wii82ii158cygpd7yvv06-attr-2.5.1
  /nix/store/5fly14l1fc49v395rn2jcp8aq6ndcb5v-binutils-wrapper-2.38
  /nix/store/5l6i59rzlkal96wbps76jzvdg1mqpx68-libcpuid-0.5.1
  /nix/store/5nmpxygcis4d967xjl5szj5j76kj383r-gnused-4.8
  /nix/store/660nklr0ln4j93pzd7xifbppjvw0lgxs-libsodium-1.0.18
  /nix/store/6dpldw6wq7dh8zgp7x4q20xpiqlsp6aj-stdenv-linux
  /nix/store/6px978hhc7qg1wadxz6haylhardnkh09-libssh2-1.10.0
  /nix/store/7m3n3kymwfgmbadw1248wxkrh01dc0ri-gawk-5.1.1
  /nix/store/7sldj4bdj49yd8sipp791dhdadr1shcg-aws-checksums-0.1.12
  /nix/store/9g6xbz9la8mnhiy8h0hbnizsp1qihy1p-bash-interactive-5.1-p16-man
  /nix/store/9l3n2hmjjkxi6d8r605a627l0j7xfsbk-aws-sdk-cpp-1.9.238
  /nix/store/b9kvfk3fmwhzc7qrsji0847wph5kvvj2-gzip-1.12
  /nix/store/bmi0qijmsz9yv9qk1pfxhxqw9xijs9bh-aws-c-auth-0.6.13
  /nix/store/bym6162f9mf4qqsr7k9d73526ar176x4-gcc-11.3.0-lib
  /nix/store/c23h9kzmh5fpa1drp9sclvynkxj57f4v-readline-8.1p2
  /nix/store/cw47fg138c8w895pv581bg37hc7vc499-boehm-gc-8.0.6-dev
  /nix/store/d7d0ccp06rblhwk9sqnqn4lynijbjgv6-gcc-wrapper-11.3.0
  /nix/store/f0rrfmf8kh5bsiql5bbq7m4h3xgihpnx-binutils-2.38
  /nix/store/fdkwyjpbvvzybxdch6ldwa6j2d8w0ing-diffutils-3.8
  /nix/store/flkp4isbb43f8fj8cvbgffjcqbg25yp8-aws-c-event-stream-0.2.7
  /nix/store/fsxbvxgyycq9qh5bzkij573mj75hq7wp-libidn2-2.3.2
  /nix/store/gi4zwjfcyqqwzzj6d76a1adfdzlrscjc-libunistring-1.0
  /nix/store/gpqs5lx7h7cfm583ha4505d1fr59w37a-sqlite-3.39.0
  /nix/store/gzwqsr213k1dxl4qp984da892r28vqjp-nghttp2-1.47.0-lib
  /nix/store/h9wkbx9y8b54naavx5rrp9lj15pzgjis-gnutar-1.34
  /nix/store/hbfmxc331mma5p6ss5rfxn9fyqx77fn0-bash-interactive-5.1-p16-info
  /nix/store/hcdak2r7n3g850iw1hmhiasi0nzchdw8-zlib-1.2.12
  /nix/store/ib7q40m9vbkvqmq6lbmcwvmzxqnfmzs7-coreutils-stage4-9.1
  /nix/store/jx12jrb2cys8l332ncql62vw0psx1p06-aws-c-sdkutils-0.1.2
  /nix/store/k2yca94qwpbj0jfi3a7z731fz7pq89wl-keyutils-1.6.3-lib
  /nix/store/k56d9sk88pvrqhvwpa6msdf8gpwnimf6-glibc-2.34-210
  /nix/store/kdqqv5n7cjmpfh2silfj0dqkaay0b4nl-aws-crt-cpp-0.17.28
  /nix/store/kfd6xvkdnnc7wm40nlj2gnyf97lg15qh-bzip2-1.0.6.0.2-bin
  /nix/store/kg2idfx53fivpxwdk7f7mm6ii7r874ah-gmp-with-cxx-stage4-6.2.1
  /nix/store/kqbccy5vkrnbx0jb2klzx1sl4cjxpvzh-bash-interactive-5.1-p16
  /nix/store/lsl7mwsi2ag0170gkfhgppfz1bxha696-nix-2.9.1
  /nix/store/m5r6yjqmd3aaaww8fhd5z5j2x7sylrxz-findutils-4.9.0
  /nix/store/mpndqcz1nrvhh14wnsh4c7y8mvl4qw5h-libkrb5-1.19.3
  /nix/store/mpr204cb82h9yxaazi3c37vxhrbmxh5z-libseccomp-2.5.4-lib
  /nix/store/nbd3wrj0mb1575af9sknf0j4n8g0frdx-lowdown-1.0.0-lib
  /nix/store/nn9abzlxp5k32jqg2q40ijqfsbajhcax-patchelf-0.14.5
  /nix/store/p4c8gvw7hvfs3lvlnd62av8j3hpwhqgp-editline-1.17.1
  /nix/store/p4jc4vkwbdpk3vf05031m6yi26nk1jqb-aws-c-http-0.6.15
  /nix/store/p6vws9zzv997asjmrnyc33v9xiw5pjyr-xz-5.2.5
  /nix/store/p9nmjgz8kzx87qjxka7g29j6qya752np-ncurses-6.3-p20220507
  /nix/store/q99pwx3v4fvmw1jlmzzm5jalj6fvxny3-curl-7.83.1
  /nix/store/qh3ggnnzs34i3xmcvxbf3zr1504mmlbw-zstd-1.5.2
  /nix/store/rb23g7673465ls5v2wc2pjqc03r5r35i-gnugrep-3.7
  /nix/store/rb2yfmzdciahc6czkh7s4gaj8m56zkbr-glibc-2.34-210-bin
  /nix/store/rmb637pa6q2lpyzbab8kr53rxlik0zs3-patch-2.7.6
  /nix/store/rpvx7gqcgjjkxp95qcxgahrgx821c2xs-file-5.42
  /nix/store/rv00ipdjnvwynk5hbbc9n07hpjpvx159-gnumake-4.3
  /nix/store/s1cqinwipi2p655npg857kczd6212sr6-xz-5.2.5-bin
  /nix/store/s6y3kfz4xxkrnb7jyfk665by50wa9ia9-boehm-gc-8.0.6
  /nix/store/s6zj4w1fw3mi94pmgc50agnirhpc2lw4-libxml2-2.9.14
  /nix/store/v014j9fmgn14jb7clkqy0a6n61nxapdw-bzip2-1.0.6.0.2
  /nix/store/w9qpd9ipa6d6fjg9jihp72hxrjl7k9qh-aws-c-mqtt-0.7.10
  /nix/store/wv8x5ymk9hs63xm0z0ckdm88bl5w0hpc-aws-c-io-0.11.0
  /nix/store/x35d72904sc58is4j4lsgzh3jkbidig4-glibc-2.34-210-dev
  /nix/store/x5iydpv3i2bs52z20z6s09zfijj0m6q4-aws-c-s3-0.1.39
  /nix/store/x773khw8rdwwa1pjaw2gdxmghmw08n34-pcre-8.45
  /nix/store/xkdxlm25dci850y47mi94pibxgdvxm8j-aws-c-common-0.7.0
  /nix/store/yvmxz0n04anxalkcfmirm9idikkhplpa-brotli-1.0.9-lib
  /nix/store/zryzjby4ilsis1r09a1qsg9pp6mpfph0-nlohmann_json-3.10.5
  /nix/store/zs6hnk47hcrrcrd885d66xmhlvp05jxm-gcc-11.3.0
  /nix/store/zz1p3qzrk71n46yijc99s1jpnhyra36h-acl-2.3.1
copying path '/nix/store/2aj5gchjipzd8y2bnl91038ypf599gxg-bash-interactive-5.1-p16-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/hbfmxc331mma5p6ss5rfxn9fyqx77fn0-bash-interactive-5.1-p16-info' from 'https://cache.nixos.org'...
copying path '/nix/store/9g6xbz9la8mnhiy8h0hbnizsp1qihy1p-bash-interactive-5.1-p16-man' from 'https://cache.nixos.org'...
copying path '/nix/store/11r68cic7w87rk9prfm9wq53fxdwnmyq-busybox-static-x86_64-unknown-linux-musl-1.35.0' from 'https://cache.nixos.org'...
copying path '/nix/store/gi4zwjfcyqqwzzj6d76a1adfdzlrscjc-libunistring-1.0' from 'https://cache.nixos.org'...
copying path '/nix/store/28w1n1an6wgdnfb8dw9bk3ppmlvmw196-linux-headers-5.18' from 'https://cache.nixos.org'...
copying path '/nix/store/fsxbvxgyycq9qh5bzkij573mj75hq7wp-libidn2-2.3.2' from 'https://cache.nixos.org'...
copying path '/nix/store/3hjcxhm76ikw4dm4i9kzyc5q6i7jlara-nix-2.9.1-man' from 'https://cache.nixos.org'...
copying path '/nix/store/k56d9sk88pvrqhvwpa6msdf8gpwnimf6-glibc-2.34-210' from 'https://cache.nixos.org'...
copying path '/nix/store/zryzjby4ilsis1r09a1qsg9pp6mpfph0-nlohmann_json-3.10.5' from 'https://cache.nixos.org'...
copying path '/nix/store/58s5gw0pzp3wii82ii158cygpd7yvv06-attr-2.5.1' from 'https://cache.nixos.org'...
copying path '/nix/store/xkdxlm25dci850y47mi94pibxgdvxm8j-aws-c-common-0.7.0' from 'https://cache.nixos.org'...
copying path '/nix/store/zz1p3qzrk71n46yijc99s1jpnhyra36h-acl-2.3.1' from 'https://cache.nixos.org'...
copying path '/nix/store/1x698alsd5iwx373x1f7313y0971qc24-aws-c-compression-0.2.14' from 'https://cache.nixos.org'...
copying path '/nix/store/jx12jrb2cys8l332ncql62vw0psx1p06-aws-c-sdkutils-0.1.2' from 'https://cache.nixos.org'...
copying path '/nix/store/7sldj4bdj49yd8sipp791dhdadr1shcg-aws-checksums-0.1.12' from 'https://cache.nixos.org'...
copying path '/nix/store/3j18grljsyy4nxc078g00sy4cx6cf16g-bash-5.1-p16' from 'https://cache.nixos.org'...
copying path '/nix/store/yvmxz0n04anxalkcfmirm9idikkhplpa-brotli-1.0.9-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/v014j9fmgn14jb7clkqy0a6n61nxapdw-bzip2-1.0.6.0.2' from 'https://cache.nixos.org'...
copying path '/nix/store/0k3mxbfivw9vxfkj8ir9lr1bncx5vm70-ed-1.18' from 'https://cache.nixos.org'...
copying path '/nix/store/kfd6xvkdnnc7wm40nlj2gnyf97lg15qh-bzip2-1.0.6.0.2-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/p4c8gvw7hvfs3lvlnd62av8j3hpwhqgp-editline-1.17.1' from 'https://cache.nixos.org'...
copying path '/nix/store/1apjzarlbpcgrd0cgv3m3211nkhb3549-expand-response-params' from 'https://cache.nixos.org'...
copying path '/nix/store/7m3n3kymwfgmbadw1248wxkrh01dc0ri-gawk-5.1.1' from 'https://cache.nixos.org'...
copying path '/nix/store/bym6162f9mf4qqsr7k9d73526ar176x4-gcc-11.3.0-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/rb2yfmzdciahc6czkh7s4gaj8m56zkbr-glibc-2.34-210-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/s6y3kfz4xxkrnb7jyfk665by50wa9ia9-boehm-gc-8.0.6' from 'https://cache.nixos.org'...
copying path '/nix/store/x35d72904sc58is4j4lsgzh3jkbidig4-glibc-2.34-210-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/cw47fg138c8w895pv581bg37hc7vc499-boehm-gc-8.0.6-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/kg2idfx53fivpxwdk7f7mm6ii7r874ah-gmp-with-cxx-stage4-6.2.1' from 'https://cache.nixos.org'...
copying path '/nix/store/rv00ipdjnvwynk5hbbc9n07hpjpvx159-gnumake-4.3' from 'https://cache.nixos.org'...
copying path '/nix/store/ib7q40m9vbkvqmq6lbmcwvmzxqnfmzs7-coreutils-stage4-9.1' from 'https://cache.nixos.org'...
copying path '/nix/store/5nmpxygcis4d967xjl5szj5j76kj383r-gnused-4.8' from 'https://cache.nixos.org'...
copying path '/nix/store/fdkwyjpbvvzybxdch6ldwa6j2d8w0ing-diffutils-3.8' from 'https://cache.nixos.org'...
copying path '/nix/store/m5r6yjqmd3aaaww8fhd5z5j2x7sylrxz-findutils-4.9.0' from 'https://cache.nixos.org'...
copying path '/nix/store/h9wkbx9y8b54naavx5rrp9lj15pzgjis-gnutar-1.34' from 'https://cache.nixos.org'...
copying path '/nix/store/b9kvfk3fmwhzc7qrsji0847wph5kvvj2-gzip-1.12' from 'https://cache.nixos.org'...
copying path '/nix/store/k2yca94qwpbj0jfi3a7z731fz7pq89wl-keyutils-1.6.3-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/5l6i59rzlkal96wbps76jzvdg1mqpx68-libcpuid-0.5.1' from 'https://cache.nixos.org'...
copying path '/nix/store/mpndqcz1nrvhh14wnsh4c7y8mvl4qw5h-libkrb5-1.19.3' from 'https://cache.nixos.org'...
copying path '/nix/store/mpr204cb82h9yxaazi3c37vxhrbmxh5z-libseccomp-2.5.4-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/660nklr0ln4j93pzd7xifbppjvw0lgxs-libsodium-1.0.18' from 'https://cache.nixos.org'...
copying path '/nix/store/nbd3wrj0mb1575af9sknf0j4n8g0frdx-lowdown-1.0.0-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/p9nmjgz8kzx87qjxka7g29j6qya752np-ncurses-6.3-p20220507' from 'https://cache.nixos.org'...
copying path '/nix/store/gzwqsr213k1dxl4qp984da892r28vqjp-nghttp2-1.47.0-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/4271vxflcnxwkdiscrg4g5kc9gw930k0-openssl-1.1.1p' from 'https://cache.nixos.org'...
copying path '/nix/store/rmb637pa6q2lpyzbab8kr53rxlik0zs3-patch-2.7.6' from 'https://cache.nixos.org'...
copying path '/nix/store/3f124aji5xay9z4jz5b8jk6gggsb1rr1-aws-c-cal-0.5.17' from 'https://cache.nixos.org'...
copying path '/nix/store/nn9abzlxp5k32jqg2q40ijqfsbajhcax-patchelf-0.14.5' from 'https://cache.nixos.org'...
copying path '/nix/store/x773khw8rdwwa1pjaw2gdxmghmw08n34-pcre-8.45' from 'https://cache.nixos.org'...
copying path '/nix/store/c23h9kzmh5fpa1drp9sclvynkxj57f4v-readline-8.1p2' from 'https://cache.nixos.org'...
copying path '/nix/store/rb23g7673465ls5v2wc2pjqc03r5r35i-gnugrep-3.7' from 'https://cache.nixos.org'...
copying path '/nix/store/kqbccy5vkrnbx0jb2klzx1sl4cjxpvzh-bash-interactive-5.1-p16' from 'https://cache.nixos.org'...
copying path '/nix/store/46xckgidqmai1wadl4ny6k2p0hlzffcn-s2n-tls-1.3.12' from 'https://cache.nixos.org'...
copying path '/nix/store/01bkry44wndk7m5d1bi3gyfmc3izs9lz-bash-interactive-5.1-p16-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/wv8x5ymk9hs63xm0z0ckdm88bl5w0hpc-aws-c-io-0.11.0' from 'https://cache.nixos.org'...
copying path '/nix/store/p6vws9zzv997asjmrnyc33v9xiw5pjyr-xz-5.2.5' from 'https://cache.nixos.org'...
copying path '/nix/store/flkp4isbb43f8fj8cvbgffjcqbg25yp8-aws-c-event-stream-0.2.7' from 'https://cache.nixos.org'...
copying path '/nix/store/p4jc4vkwbdpk3vf05031m6yi26nk1jqb-aws-c-http-0.6.15' from 'https://cache.nixos.org'...
copying path '/nix/store/s1cqinwipi2p655npg857kczd6212sr6-xz-5.2.5-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/bmi0qijmsz9yv9qk1pfxhxqw9xijs9bh-aws-c-auth-0.6.13' from 'https://cache.nixos.org'...
copying path '/nix/store/w9qpd9ipa6d6fjg9jihp72hxrjl7k9qh-aws-c-mqtt-0.7.10' from 'https://cache.nixos.org'...
copying path '/nix/store/x5iydpv3i2bs52z20z6s09zfijj0m6q4-aws-c-s3-0.1.39' from 'https://cache.nixos.org'...
copying path '/nix/store/hcdak2r7n3g850iw1hmhiasi0nzchdw8-zlib-1.2.12' from 'https://cache.nixos.org'...
copying path '/nix/store/kdqqv5n7cjmpfh2silfj0dqkaay0b4nl-aws-crt-cpp-0.17.28' from 'https://cache.nixos.org'...
copying path '/nix/store/f0rrfmf8kh5bsiql5bbq7m4h3xgihpnx-binutils-2.38' from 'https://cache.nixos.org'...
copying path '/nix/store/rpvx7gqcgjjkxp95qcxgahrgx821c2xs-file-5.42' from 'https://cache.nixos.org'...
copying path '/nix/store/5fly14l1fc49v395rn2jcp8aq6ndcb5v-binutils-wrapper-2.38' from 'https://cache.nixos.org'...
copying path '/nix/store/zs6hnk47hcrrcrd885d66xmhlvp05jxm-gcc-11.3.0' from 'https://cache.nixos.org'...
copying path '/nix/store/6px978hhc7qg1wadxz6haylhardnkh09-libssh2-1.10.0' from 'https://cache.nixos.org'...
copying path '/nix/store/d7d0ccp06rblhwk9sqnqn4lynijbjgv6-gcc-wrapper-11.3.0' from 'https://cache.nixos.org'...
copying path '/nix/store/s6zj4w1fw3mi94pmgc50agnirhpc2lw4-libxml2-2.9.14' from 'https://cache.nixos.org'...
copying path '/nix/store/gpqs5lx7h7cfm583ha4505d1fr59w37a-sqlite-3.39.0' from 'https://cache.nixos.org'...
copying path '/nix/store/6dpldw6wq7dh8zgp7x4q20xpiqlsp6aj-stdenv-linux' from 'https://cache.nixos.org'...
copying path '/nix/store/qh3ggnnzs34i3xmcvxbf3zr1504mmlbw-zstd-1.5.2' from 'https://cache.nixos.org'...
copying path '/nix/store/4a296l1jh89zabvgm1k7s26p5gypj59h-curl-7.83.1' from 'https://cache.nixos.org'...
copying path '/nix/store/q99pwx3v4fvmw1jlmzzm5jalj6fvxny3-curl-7.83.1' from 'https://cache.nixos.org'...
copying path '/nix/store/9l3n2hmjjkxi6d8r605a627l0j7xfsbk-aws-sdk-cpp-1.9.238' from 'https://cache.nixos.org'...
copying path '/nix/store/58npxfip0nlr13iy9q76nij2hx3cn4y8-libarchive-3.6.1-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/lsl7mwsi2ag0170gkfhgppfz1bxha696-nix-2.9.1' from 'https://cache.nixos.org'...
copying path '/nix/store/2j1x6fj0lc9ykixnnfv1ykfmsf58iqwg-nix-2.9.1-dev' from 'https://cache.nixos.org'...
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
error: attribute 'mayastor' in selection path 'mayastor' not found

Output of docker run --name mayastor-nix-prefetch -it -v $(pwd):/scratch:rw --privileged --workdir /scratch nixos/nix nix-shell --run "exit 0":

...
fixing pkg config paths in '/nix/store/6dsgml58whl1a7nd3ci692ap01njivbr-libspdk-dev-22.01-13a768291/lib/pkgconfig/spdk_util.pc' ...
fixing pkg config paths in '/nix/store/6dsgml58whl1a7nd3ci692ap01njivbr-libspdk-dev-22.01-13a768291/lib/pkgconfig/spdk_vhost.pc' ...
fixing pkg config paths in '/nix/store/6dsgml58whl1a7nd3ci692ap01njivbr-libspdk-dev-22.01-13a768291/lib/pkgconfig/spdk_virtio.pc' ...
fixing pkg config paths in '/nix/store/6dsgml58whl1a7nd3ci692ap01njivbr-libspdk-dev-22.01-13a768291/lib/pkgconfig/spdk_vmd.pc' ...
Copying test files
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/6dsgml58whl1a7nd3ci692ap01njivbr-libspdk-dev-22.01-13a768291
shrinking /nix/store/6dsgml58whl1a7nd3ci692ap01njivbr-libspdk-dev-22.01-13a768291/fio/spdk_nvme
shrinking /nix/store/6dsgml58whl1a7nd3ci692ap01njivbr-libspdk-dev-22.01-13a768291/fio/spdk_bdev
patching script interpreter paths in /nix/store/6dsgml58whl1a7nd3ci692ap01njivbr-libspdk-dev-22.01-13a768291
checking for references to /tmp/nix-build-libspdk-dev-22.01-13a768291.drv-0/ in /nix/store/6dsgml58whl1a7nd3ci692ap01njivbr-libspdk-dev-22.01-13a768291...
Hint: use rustup tool.

An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /root/.cache/pre-commit/pre-commit.log
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /root/.cache/pre-commit/pre-commit.log

OS info (please complete the following information):

Additional context x

Abhinandan-Purkait commented 2 years ago

Hi @MaisenbacherD there were some naming changes on this front but the docs were probably not updated. Can you please try with nix develop -f . io-engine. You can also do nix-shell in the root, and that should just bring up the environment for you.

MaisenbacherD commented 2 years ago

Hi @Abhinandan-Purkait :) Thank you, nix develop -f . io-engine helped! I had to manually do export SRCDIR=$(pwd) before I was able to successfully run cargo build.  Not sure how nix works, but the shell.nix should have done that?

Furthermore, I had to build spdk on my own in order to run cargo test -- --test-threads 1. Is that correct? I thought that spdk would be provided by nix as long as the norust argument is not set to true when accessing the nix-shell.

For completeness this is how I build spdk (in my regular shell):

#pwd = mayastor root directory
cd spdk-rs
git clone https://github.com/spdk/spdk.git
cd spdk
git checkout v22.01
git submodule update --init --recursive
sudo ./scripts/pkgdep.sh
cd ..
#The next step required me to point  `--with-fio` to the location of the from source build fio such that `config-host.h` would be found.
./build_spdk.sh
#spdk-rs needs to be build from its own directory (and not through `cargo test -- --test-threads 1` in the parent directory) because otherwise `get_target_dir` from https://github.com/mayadata-io/spdk-rs/blob/develop/build.rs does not set the correct path to search the `libspdk-bundle.so` file.
cargo build
cd ..

Now I was able to run cargo test -- --test-threads 1, which fails for now on the add_child test case:

running 1 test
test add_child ... [2022-07-14T15:15:28.302775016+02:00  INFO io_engine::subsys::config:mod.rs:216] Applying Mayastor configuration settings
[2022-07-14T15:15:28.303063857+02:00 DEBUG io_engine::subsys::config::opts:opts.rs:261] spdk_bdev_nvme_opts { action_on_timeout: 4, timeout_us: 5000000, timeout_admin_us: 5000000, keep_alive_timeout_ms: 1000, transport_retry_count: 0, arbitration_burst: 0, low_priority_weight: 0, medium_priority_weight: 0, high_priority_weight: 0, nvme_adminq_poll_period_us: 1000, nvme_ioq_poll_period_us: 0, io_queue_requests: 0, delay_cmd_submit: true, bdev_retry_count: 0 }
[2022-07-14T15:15:28.303168082+02:00 DEBUG io_engine::subsys::config:mod.rs:220] Config {
    source: None,
    nvmf_tcp_tgt_conf: NvmfTgtConfig {
        name: "mayastor_target",
        max_namespaces: 2048,
        opts: NvmfTcpTransportOpts {
            max_queue_depth: 32,
            max_qpairs_per_ctrl: 32,
            in_capsule_data_size: 4096,
            max_io_size: 131072,
            io_unit_size: 131072,
            max_aq_depth: 32,
            num_shared_buf: 2048,
            buf_cache_size: 64,
            dif_insert_or_strip: false,
            abort_timeout_sec: 1,
            acceptor_poll_rate: 10000,
            zcopy: true,
        },
    },
    nvme_bdev_opts: NvmeBdevOpts {
        action_on_timeout: 4,
        timeout_us: 5000000,
        timeout_admin_us: 5000000,
        keep_alive_timeout_ms: 1000,
        transport_retry_count: 0,
        arbitration_burst: 0,
        low_priority_weight: 0,
        medium_priority_weight: 0,
        high_priority_weight: 0,
        nvme_adminq_poll_period_us: 1000,
        nvme_ioq_poll_period_us: 0,
        io_queue_requests: 0,
        delay_cmd_submit: true,
        bdev_retry_count: 0,
        async_mode: false,
    },
    bdev_opts: BdevOpts {
        bdev_io_pool_size: 65535,
        bdev_io_cache_size: 512,
        small_buf_pool_size: 8191,
        large_buf_pool_size: 1023,
    },
    nexus_opts: NexusOpts {
        nvmf_enable: true,
        nvmf_discovery_enable: true,
        nvmf_nexus_port: 4421,
        nvmf_replica_port: 8420,
    },
}
[2022-07-14T15:15:28.303440273+02:00 DEBUG io_engine::core::env:env.rs:547] EAL arguments ["mayastor", "--no-shconf", "-m 0", "--no-pci", "--base-virtaddr=0x200000000000", "--file-prefix=mayastor_pid4122777", "--huge-unlink", "--log-level=lib.eal:6", "--log-level=lib.cryptodev:5", "--log-level=user1:6", "--match-allocations", "-c 0x1"]
EAL: No available 1048576 kB hugepages reported
EAL: Couldn't get fd on hugepage file
EAL: error allocating rte services array
EAL: FATAL: rte_service_init() failed
EAL: rte_service_init() failed
FAILED

failures:

---- add_child stdout ----
thread 'mayastor_master' panicked at 'Failed to init EAL', io-engine/src/core/env.rs:556:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', io-engine/tests/common/compose.rs:83:33

failures:
    add_child

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.14s

error: test failed, to rerun pass '-p io-engine --test add_child'

As suggested I configured 1024 2MiB huge pages (in two different ways):

# Option 1:
echo 1024 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
# Option 2:
cd spdk-rs/spdk/dpdk/usertools
sudo ./dpdk-hugepages.py -p 2048K --setup 2097152K 

Is it correct that also 1048576 kB huge pages are required or am I doing something wrong?

Abhinandan-Purkait commented 2 years ago

You would not need to build spdk. You should get it built on entering nix-shell. You would just need to run nix-shell from the root dir and that should just do everything for you. The option 1 for setting HugePages is right. The number of HugePages needed depends on the number of io-engine containers you want to run, each needing 1024.

MaisenbacherD commented 2 years ago

When I run nix-shell spdk seems to be build. However, when I run cargo build I am getting the following error:

   Compiling err-derive v0.2.4
error: `err-derive` depends on `proc-macro-error`, which requires rustc >= 1.34
 --> /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/err-derive-0.2.4/build.rs:2:1
  |
2 | compile_error!("`err-derive` depends on `proc-macro-error`, which requires rustc >= 1.34");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/dennis/src/mayastor/target/debug/deps/librustversion-f83f8ace0cac2a45.so)
 --> /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/err-derive-0.2.4/build.rs:1:3
  |
1 | #[rustversion::before(1.34)]
  |   ^^^^^^^^^^^

error: cannot determine resolution for the attribute macro `rustversion::before`
 --> /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/err-derive-0.2.4/build.rs:1:3
  |
1 | #[rustversion::before(1.34)]
  |   ^^^^^^^^^^^^^^^^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error: could not compile `err-derive` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...

It looks like GLIBC_2.32 is not installed within the nix-shell

Abhinandan-Purkait commented 2 years ago

Can you check whether your rust version matches the one being used. https://github.com/openebs/mayastor/blob/be4c196f24f696d502ed281fb605290e0743e6ba/nix/lib/rust.nix#L7

You can check that by rustup toolchain list Install that version by rustup toolchain install nightly-2021-11-30 Set it as default by rustup default nightly-2021-11-30-x86_64-unknown-linux-gnu

After that probably you can exit and enter nix-shell and do a cargo clean.

MaisenbacherD commented 2 years ago

The nightly rust toolchain was indeed not enabled within the nix shell. I followed your instructions and got the following output when executing rustup toolchain list:

stable-x86_64-unknown-linux-gnu
nightly-2021-11-30-x86_64-unknown-linux-gnu (default)

For rustc --version:

rustc 1.59.0-nightly (6db0a0e9a 2021-11-29)

After exiting and entering the nix-shell and running cargo clean followed by cargo build the error persists:

error: `err-derive` depends on `proc-macro-error`, which requires rustc >= 1.34
 --> /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/err-derive-0.2.4/build.rs:2:1
  |
2 | compile_error!("`err-derive` depends on `proc-macro-error`, which requires rustc >= 1.34");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/dennis/src/mayastor/target/debug/deps/librustversion-e67a322b869b9b50.so)
 --> /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/err-derive-0.2.4/build.rs:1:3
  |
1 | #[rustversion::before(1.34)]
  |   ^^^^^^^^^^^

error: could not compile `err-derive` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed
tiagolobocastro commented 2 years ago

Have you tried "nix-shell ci.nix"?

MaisenbacherD commented 2 years ago

When I enter the nix shell with nix-shell ci.nix I can cargo build without any error. However, if I am running cargo test -- --test-threads 1 I am getting the following compile error:

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.227zxd363hp6uelq.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.2kvr9klybxfa46no.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.3f1homfasr5oo61s.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.3puuuoziaen8bala.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.4stpvupew178h4q0.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.562gv39nqdx3beyw.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.5brjhirzzrecyei4.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.5g8fzc4w73fkiw1q.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.bnfcv25i3rfx0xd.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.xatxbpwv51ic558.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.xkal4l8w7fguft5.rcgu.o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915.6ggqp02vkbkgdmw.rcgu.o" "-Wl,--as-needed" "-L" "/home/dennis/src/mayastor/target/debug/deps" "-L" "/home/dennis/src/mayastor/target/debug/build/spdk-rs-d69df47bd3068b02/out" "-L" "/nix/store/dmd8i924mcm17nclazfmplyfrl8r67bv-rust-default-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lspdk-bundle" "-Wl,-Bstatic" "-Wl,--whole-archive" "-lhelpers" "-Wl,--no-whole-archive" "/home/dennis/src/mayastor/target/debug/deps/libuuid-0b0ef25926be8e52.rlib" "/home/dennis/src/mayastor/target/debug/deps/libgetrandom-d7a43268b84fee5d.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-7ddc9ce4941507e1.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-964c30d87a838365.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-915c2cbb4b7aa7c9.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-1bdb232450d24449.rlib" "/home/dennis/src/mayastor/target/debug/deps/libsnafu-4648e562ae6d7d9d.rlib" "/home/dennis/src/mayastor/target/debug/deps/libdoc_comment-5fc477848092951f.rlib" "/home/dennis/src/mayastor/target/debug/deps/libnix-6db103b0a8e41cb6.rlib" "/home/dennis/src/mayastor/target/debug/deps/libbitflags-69211c01e1d2aa85.rlib" "/home/dennis/src/mayastor/target/debug/deps/libmemoffset-74319917765de537.rlib" "/home/dennis/src/mayastor/target/debug/deps/liblibc-681c1f60245940b3.rlib" "/home/dennis/src/mayastor/target/debug/deps/libfutures-580f1152896027f3.rlib" "/home/dennis/src/mayastor/target/debug/deps/libfutures_executor-221b3029a970ecf5.rlib" "/home/dennis/src/mayastor/target/debug/deps/libfutures_util-e9c711ec6baff525.rlib" "/home/dennis/src/mayastor/target/debug/deps/libmemchr-2b8f7268d78fa7bd.rlib" "/home/dennis/src/mayastor/target/debug/deps/libfutures_io-cbabb44616baa9a6.rlib" "/home/dennis/src/mayastor/target/debug/deps/libslab-14f7fadda46aa470.rlib" "/home/dennis/src/mayastor/target/debug/deps/libfutures_channel-e69d4ac0e84ae734.rlib" "/home/dennis/src/mayastor/target/debug/deps/libfutures_sink-a40df182792851fb.rlib" "/home/dennis/src/mayastor/target/debug/deps/libfutures_task-e4f868f8b9072efd.rlib" "/home/dennis/src/mayastor/target/debug/deps/libpin_utils-a33c58baef8f8b55.rlib" "/home/dennis/src/mayastor/target/debug/deps/libfutures_core-e9cfa78b4873651e.rlib" "/home/dennis/src/mayastor/target/debug/deps/libserde_json-09263a3775d0a616.rlib" "/home/dennis/src/mayastor/target/debug/deps/libryu-25660ecbe64d8c1e.rlib" "/home/dennis/src/mayastor/target/debug/deps/libitoa-21dbbd85f89181ca.rlib" "/home/dennis/src/mayastor/target/debug/deps/libserde-48edbcfab4c32050.rlib" "/home/dennis/src/mayastor/target/debug/deps/libtracing-92db53aea8eff841.rlib" "/home/dennis/src/mayastor/target/debug/deps/libpin_project_lite-0108d58e3f46fd51.rlib" "/home/dennis/src/mayastor/target/debug/deps/libtracing_core-9c9130c715fa5e8b.rlib" "/home/dennis/src/mayastor/target/debug/deps/liblazy_static-972302aead5ba927.rlib" "/home/dennis/src/mayastor/target/debug/deps/liblog-a9441c04002a1c67.rlib" "/home/dennis/src/mayastor/target/debug/deps/libcfg_if-0c646b04edbea3dc.rlib" "-Wl,--start-group" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-ba99c63b775f734c.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-2c795be2d1f43514.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-4225fa5bc39268de.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-a6e9f64eae6e45dd.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b1c963add6e8b853.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-541ca82647a7fb7c.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-b93187d0f71da706.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-12352e7b2d1a318e.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-3787a903f1bee791.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-fdd9bd7e7b7760b0.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-4274f5e0121314fe.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-496757222b2a1fa7.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-e68feee69f5a82d8.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-5d6d15fab36665ef.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-10916d3506f78066.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-f6aebf5fbe06d09a.rlib" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-4e1b16fc9c111ada.rlib" "-Wl,--end-group" "/nix/store/nd5skgjdwy0jznjhlaifl5rpgxgbjl3z-rust-std-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-02203e01b7df4fdd.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/nix/store/dmd8i924mcm17nclazfmplyfrl8r67bv-rust-default-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/dennis/src/mayastor/target/debug/deps/spdk_rs-3434e6399ffbb915" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs"
  = note: /nix/store/77i6h1kjpdww9zzpvkmgyym2mz65yff1-binutils-2.35.1/bin/ld: cannot find -lspdk-bundle
          collect2: error: ld returned 1 exit status

The following warnings were emitted during compilation:

warning: /nix/store/a4yw1svqqk4d8lhwinn9xp847zz9gfma-bash-4.4-p23/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf-8)
warning: /nix/store/a4yw1svqqk4d8lhwinn9xp847zz9gfma-bash-4.4-p23/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf-8)
warning: /nix/store/a4yw1svqqk4d8lhwinn9xp847zz9gfma-bash-4.4-p23/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf-8)

error: could not compile `spdk-rs` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

I can link the libspdk-bundle.so by hand to the library directory of the cc call that fails: 

sudo ln -s /home/dennis/src/mayastor/target/debug/libspdk-bundle.so /nix/store/dmd8i924mcm17nclazfmplyfrl8r67bv-rust-default-1.56.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libspdk-bundle.so

Now cargo test -- --test-threads 1 starts running the tests which fail in add_child (that also failed when I compiled spdk on my own):

     Running tests/add_child.rs (target/debug/deps/add_child-3a8be718b7019c26)

running 1 test
test add_child ... [2022-07-18T11:24:22.179761508+02:00  INFO io_engine::subsys::config:mod.rs:216] Applying Mayastor configuration settings
[2022-07-18T11:24:22.180042154+02:00 DEBUG io_engine::subsys::config::opts:opts.rs:261] spdk_bdev_nvme_opts { action_on_timeout: 4, timeout_us: 5000000, timeout_admin_us: 5000000, keep_
alive_timeout_ms: 1000, transport_retry_count: 0, arbitration_burst: 0, low_priority_weight: 0, medium_priority_weight: 0, high_priority_weight: 0, nvme_adminq_poll_period_us: 1000, nvm
e_ioq_poll_period_us: 0, io_queue_requests: 0, delay_cmd_submit: true, bdev_retry_count: 0 }
[2022-07-18T11:24:22.180132935+02:00 DEBUG io_engine::subsys::config:mod.rs:220] Config {
    source: None,
    nvmf_tcp_tgt_conf: NvmfTgtConfig {
        name: "mayastor_target",
        max_namespaces: 2048,
        opts: NvmfTcpTransportOpts {
            max_queue_depth: 32,
            max_qpairs_per_ctrl: 32,
            in_capsule_data_size: 4096,
            max_io_size: 131072,
            io_unit_size: 131072,
            max_aq_depth: 32,
            num_shared_buf: 2048,
            buf_cache_size: 64,
            dif_insert_or_strip: false,
            abort_timeout_sec: 1,
            acceptor_poll_rate: 10000,
            zcopy: true,
        },
    },
    nvme_bdev_opts: NvmeBdevOpts {
        action_on_timeout: 4,
        timeout_us: 5000000,
        timeout_admin_us: 5000000,
        keep_alive_timeout_ms: 1000,
        transport_retry_count: 0,
        arbitration_burst: 0,
        low_priority_weight: 0,
        medium_priority_weight: 0,
        high_priority_weight: 0,
        nvme_adminq_poll_period_us: 1000,
        nvme_ioq_poll_period_us: 0,
        io_queue_requests: 0,
        delay_cmd_submit: true,
        bdev_retry_count: 0,
        async_mode: false,
    },
    bdev_opts: BdevOpts {
        bdev_io_pool_size: 65535,
        bdev_io_cache_size: 512,
        small_buf_pool_size: 8191,
        large_buf_pool_size: 1023,
    },
    nexus_opts: NexusOpts {
        nvmf_enable: true,
        nvmf_discovery_enable: true,
        nvmf_nexus_port: 4421,
        nvmf_replica_port: 8420,
    },
}
[2022-07-18T11:24:22.180386149+02:00 DEBUG io_engine::core::env:env.rs:547] EAL arguments ["mayastor", "--no-shconf", "-m 0", "--no-pci", "--base-virtaddr=0x200000000000", "--file-prefi
x=mayastor_pid1750993", "--huge-unlink", "--log-level=lib.eal:6", "--log-level=lib.cryptodev:5", "--log-level=user1:6", "--match-allocations", "-c 0x1"]
EAL: No available 1048576 kB hugepages reported
EAL: Couldn't get fd on hugepage file
EAL: error allocating rte services array
EAL: FATAL: rte_service_init() failed
EAL: rte_service_init() failed
FAILED

failures:

---- add_child stdout ----
thread 'mayastor_master' panicked at 'Failed to init EAL', io-engine/src/core/env.rs:556:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', io-engine/tests/common/compose.rs:83:33

failures:
    add_child

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.14s

error: test failed, to rerun pass '-p io-engine --test add_child'

I have setup 1024 2MiB huge pages - grep Huge /proc/meminfo:

AnonHugePages:   1644544 kB
ShmemHugePages:        0 kB
FileHugePages:         0 kB
HugePages_Total:    1024
HugePages_Free:     1024
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:         2097152 kB

Do I need to do something else in order to start spdk correctly?

tiagolobocastro commented 2 years ago

Could you try cd into io-engine and run the tests from there?

MaisenbacherD commented 2 years ago

Thank you @tiagolobocastro, executing the test within the io-engine directory solved the spdk issue!

Now RUST_BACKTRACE=1 cargo test -- --test-threads 1 fails with the persistence test cases:

     Running tests/persistence.rs (/home/dennis/src/mayastor/target/debug/deps/persistence-ad35c24c81526093)
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

running 4 tests
test persist_clean_shutdown ... FAILED
test persist_io_failure ... FAILED
test persist_unexpected_restart ... FAILED
test persistent_store_connection ... FAILED

failures:

---- persist_clean_shutdown stdout ----
thread 'main' panicked at 'Binary path should exist!: Custom { kind: NotFound, error: "etcd" }', composer/src/lib.rs:182:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: core::result::unwrap_failed
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1617:5
   3: core::result::Result<T,E>::expect
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1259:23
   4: composer::Binary::new
             at /home/dennis/src/mayastor/composer/src/lib.rs:182:19
   5: composer::Binary::from_nix
             at /home/dennis/src/mayastor/composer/src/lib.rs:131:9
   6: persistence::start_infrastructure::{{closure}}
             at ./tests/persistence.rs:345:17
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   8: persistence::persist_clean_shutdown::{{closure}}
             at ./tests/persistence.rs:93:16
   9: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
  10: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/future.rs:119:9
  11: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:498:48
  12: tokio::coop::with_budget::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
  13: std::thread::local::LocalKey<T>::try_with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:399:16
  14: std::thread::local::LocalKey<T>::with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:375:9
  15: tokio::coop::with_budget
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
  16: tokio::coop::budget
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
  17: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:498:25
  18: tokio::runtime::basic_scheduler::Context::enter
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:356:19
  19: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:497:36
  20: tokio::runtime::basic_scheduler::CoreGuard::enter::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:555:57
  21: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/macros/scoped_tls.rs:61:9
  22: tokio::runtime::basic_scheduler::CoreGuard::enter
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:555:27
  23: tokio::runtime::basic_scheduler::CoreGuard::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:488:9
  24: tokio::runtime::basic_scheduler::BasicScheduler::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:168:24
  25: tokio::runtime::Runtime::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/mod.rs:475:46
  26: persistence::persist_clean_shutdown
             at ./tests/persistence.rs:143:5
  27: persistence::persist_clean_shutdown::{{closure}}
             at ./tests/persistence.rs:92:7
  28: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
  29: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- persist_io_failure stdout ----
thread 'main' panicked at 'Binary path should exist!: Custom { kind: NotFound, error: "etcd" }', composer/src/lib.rs:182:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: core::result::unwrap_failed
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1617:5
   3: core::result::Result<T,E>::expect
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1259:23
   4: composer::Binary::new
             at /home/dennis/src/mayastor/composer/src/lib.rs:182:19
   5: composer::Binary::from_nix
             at /home/dennis/src/mayastor/composer/src/lib.rs:131:9
   6: persistence::start_infrastructure::{{closure}}
             at ./tests/persistence.rs:345:17
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   8: persistence::persist_io_failure::{{closure}}
             at ./tests/persistence.rs:150:16
   9: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
  10: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/future.rs:119:9
  11: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:498:48
  12: tokio::coop::with_budget::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
  13: std::thread::local::LocalKey<T>::try_with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:399:16
  14: std::thread::local::LocalKey<T>::with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:375:9
  15: tokio::coop::with_budget
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
  16: tokio::coop::budget
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
  17: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:498:25
  18: tokio::runtime::basic_scheduler::Context::enter
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:356:19
  19: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:497:36
  20: tokio::runtime::basic_scheduler::CoreGuard::enter::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:555:57
  21: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/macros/scoped_tls.rs:61:9
  22: tokio::runtime::basic_scheduler::CoreGuard::enter
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:555:27
  23: tokio::runtime::basic_scheduler::CoreGuard::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:488:9
  24: tokio::runtime::basic_scheduler::BasicScheduler::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:168:24
  25: tokio::runtime::Runtime::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/mod.rs:475:46
  26: persistence::persist_io_failure
             at ./tests/persistence.rs:292:5
  27: persistence::persist_io_failure::{{closure}}
             at ./tests/persistence.rs:149:7
  28: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
  29: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- persist_unexpected_restart stdout ----
thread 'main' panicked at 'Binary path should exist!: Custom { kind: NotFound, error: "etcd" }', composer/src/lib.rs:182:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: core::result::unwrap_failed
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1617:5
   3: core::result::Result<T,E>::expect
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1259:23
   4: composer::Binary::new
             at /home/dennis/src/mayastor/composer/src/lib.rs:182:19
   5: composer::Binary::from_nix
             at /home/dennis/src/mayastor/composer/src/lib.rs:131:9
   6: persistence::start_infrastructure::{{closure}}
             at ./tests/persistence.rs:345:17
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   8: persistence::persist_unexpected_restart::{{closure}}
             at ./tests/persistence.rs:39:16
   9: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
  10: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/future.rs:119:9
  11: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:498:48
  12: tokio::coop::with_budget::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
  13: std::thread::local::LocalKey<T>::try_with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:399:16
  14: std::thread::local::LocalKey<T>::with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:375:9
  15: tokio::coop::with_budget
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
  16: tokio::coop::budget
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
  17: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:498:25
  18: tokio::runtime::basic_scheduler::Context::enter
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:356:19
  19: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:497:36
  20: tokio::runtime::basic_scheduler::CoreGuard::enter::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:555:57
  21: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/macros/scoped_tls.rs:61:9
  22: tokio::runtime::basic_scheduler::CoreGuard::enter
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:555:27
  23: tokio::runtime::basic_scheduler::CoreGuard::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:488:9
  24: tokio::runtime::basic_scheduler::BasicScheduler::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:168:24
  25: tokio::runtime::Runtime::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/mod.rs:475:46
  26: persistence::persist_unexpected_restart
             at ./tests/persistence.rs:86:5
  27: persistence::persist_unexpected_restart::{{closure}}
             at ./tests/persistence.rs:38:7
  28: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
  29: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- persistent_store_connection stdout ----
thread 'main' panicked at 'Binary path should exist!: Custom { kind: NotFound, error: "etcd" }', composer/src/lib.rs:182:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: core::result::unwrap_failed
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1617:5
   3: core::result::Result<T,E>::expect
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1259:23
   4: composer::Binary::new
             at /home/dennis/src/mayastor/composer/src/lib.rs:182:19
   5: composer::Binary::from_nix
             at /home/dennis/src/mayastor/composer/src/lib.rs:131:9
   6: persistence::start_infrastructure::{{closure}}
             at ./tests/persistence.rs:345:17
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   8: persistence::persistent_store_connection::{{closure}}
             at ./tests/persistence.rs:299:16
   9: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
  10: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/future.rs:119:9
  11: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:498:48
  12: tokio::coop::with_budget::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
  13: std::thread::local::LocalKey<T>::try_with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:399:16
  14: std::thread::local::LocalKey<T>::with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:375:9
  15: tokio::coop::with_budget
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
  16: tokio::coop::budget
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
  17: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:498:25
  18: tokio::runtime::basic_scheduler::Context::enter
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:356:19
  19: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:497:36
  20: tokio::runtime::basic_scheduler::CoreGuard::enter::{{closure}}
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:555:57
  21: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/macros/scoped_tls.rs:61:9
  22: tokio::runtime::basic_scheduler::CoreGuard::enter
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:555:27
  23: tokio::runtime::basic_scheduler::CoreGuard::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:488:9
  24: tokio::runtime::basic_scheduler::BasicScheduler::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/basic_scheduler.rs:168:24
  25: tokio::runtime::Runtime::block_on
             at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/mod.rs:475:46
  26: persistence::persistent_store_connection
             at ./tests/persistence.rs:334:5
  27: persistence::persistent_store_connection::{{closure}}
             at ./tests/persistence.rs:298:7
  28: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
  29: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

failures:
    persist_clean_shutdown
    persist_io_failure
    persist_unexpected_restart
    persistent_store_connection

test result: FAILED. 0 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s

error: test failed, to rerun pass '--test persistence'

It looks like etcd can not be found in the PATH because these tests are executed with the root user. Output for which etcd in the nix shell with my regular user: 

/nix/store/r2av08h9shmgqkzs87j7dhhaxxbpnqkd-etcd-3.3.25/bin/etcd
tiagolobocastro commented 2 years ago

root user? When you enter the nix-shell it uses your current user, I'm confused, how are you running the tests? The etcd client is definitely provided within the nix-shell: https://github.com/openebs/mayastor/blob/be4c196f24f696d502ed281fb605290e0743e6ba/ci.nix#L30 EDIT: ah maybe the root is when we elevate so we can grab hugepages and other things IIRC

MaisenbacherD commented 2 years ago

EDIT: ah maybe the root is when we elevate so we can grab hugepages and other things IIRC

This might be the case. I was temporarily adding a line to print std::process::Command::new("whoami").output()? in this function, which printed root.

To recap what I did to run the tests from the start:

sudo modprobe nbd
sudo modprobe nvmet
sudo modprobe nvmet-rdma
sudo modprobe nvme-fabrics
sudo modprobe nvme-tcp
sudo modprobe nvme-rdma
sudo modprobe nvme-loop
echo 4096 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
git clone https://github.com/openebs/mayastor.git
cd mayastor
git submodule update --init --recursive
nix-shell ci.nix

In the nix shell:

cd io-engine
cargo test -- --test-threads 1
tiagolobocastro commented 2 years ago

Once you enter nix-shell ci.nix, can you run etcd --version?

MaisenbacherD commented 2 years ago

Sure :) Here the output of etcd --version:

etcd Version: 3.3.25
Git SHA: GitNotFound
Go Version: go1.16.4
Go OS/Arch: linux/amd64
tiagolobocastro commented 2 years ago

So it is there, then I don't understand this: thread 'main' panicked at 'Binary path should exist!: Custom { kind: NotFound, error: "etcd" }'

MaisenbacherD commented 2 years ago

etcd is accessible from my regular user because the PATH env is set accordingly in the nix-shell. Thus etcd --version results in:

etcd Version: 3.3.25
Git SHA: GitNotFound
Go Version: go1.16.4
Go OS/Arch: linux/amd64

However, when running sudo etcd --version the output is:

sudo: etcd: command not found

because the correct PATH is not preserved when running as root.

The cargo tests are run with the root user and therefore the etcd binary can not be found, which results in the panic thread 'main' panicked at 'Binary path should exist!: Custom { kind: NotFound, error: "etcd" }'.

I am not really familiar with nix, but is there the possibility to fix the PATH env for the root user within the nix shell?

tiagolobocastro commented 2 years ago

Ah you might need to add /nix to the sudoers secure path.

MaisenbacherD commented 2 years ago

That works! But only if I prepend the whole path to etcd (/nix/store/r2av08h9shmgqkzs87j7dhhaxxbpnqkd-etcd-3.3.25) in the secure_path. I unsuccessfully tied to specify wild card paths in the secure_path. Feels like a hack to me (with which I can live for now :) ) that could cause problems in the future. Maybe there is a cleaner solution with some nix/sudoers configuration.

Tests with cargo test -- --test-threads 1 pass now :)

Thanks @tiagolobocastro and @Abhinandan-Purkait for the help!

tiagolobocastro commented 2 years ago

@MaisenbacherD, could you please remove your secure_path changes and try this branch?

MaisenbacherD commented 2 years ago

Thank you @tiagolobocastro. That fix looks nice and works without hacking Debian's default secure_path :)