diff --git a/.gitmodules b/.gitmodules index c9a360c16..2dc1e92e0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,8 @@ -[submodule "rpc/mayastor-api"] - path = rpc/mayastor-api - url = https://github.com/openebs/mayastor-api - branch = develop [submodule "spdk-rs"] path = spdk-rs url = https://github.com/openebs/spdk-rs branch = develop -[submodule "utils/io-engine-dependencies"] - path = utils/io-engine-dependencies +[submodule "utils/dependencies"] + path = utils/dependencies url = https://github.com/openebs/mayastor-dependencies.git branch = develop diff --git a/.rustfmt.toml b/.rustfmt.toml index 550e33015..f1d06f558 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -15,5 +15,5 @@ spaces_around_ranges = true edition = "2018" ignore = [ - "rpc/mayastor-api" + "utils/dependencies/apis/io-engine" ] diff --git a/Cargo.lock b/Cargo.lock index 24d8ba8f9..8e9a74720 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -143,7 +143,7 @@ dependencies = [ "polling", "rustix 0.37.19", "slab", - "socket2 0.4.9", + "socket2 0.4.10", "waker-fn", ] @@ -255,9 +255,9 @@ checksum = "b9441c6b2fe128a7c2bf680a44c34d0df31ce09e5b7e401fcca3faa483dbc921" [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", @@ -338,9 +338,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -370,7 +370,7 @@ dependencies = [ "lazycell", "log", "peeking_take_while", - "prettyplease 0.2.15", + "prettyplease", "proc-macro2", "quote", "regex", @@ -699,7 +699,7 @@ dependencies = [ "criterion-plot", "futures", "is-terminal", - "itertools", + "itertools 0.10.5", "num-traits", "once_cell", "oorandom", @@ -721,7 +721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", ] [[package]] @@ -1010,15 +1010,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "erased-serde" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da96524cc884f6558f1769b6c46686af2fe8e8b4cd253bd5a3cdba8181b8e070" -dependencies = [ - "serde", -] - [[package]] name = "errno" version = "0.3.4" @@ -1047,11 +1038,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d982a3b3088a5f95d19882d298b352a2e0be20703e3080c1e6767731d5dec79" dependencies = [ "http", - "prost 0.12.1", + "prost", "tokio", "tokio-stream", - "tonic 0.10.2", - "tonic-build 0.10.2", + "tonic", + "tonic-build", "tower", "tower-service", ] @@ -1094,14 +1085,14 @@ dependencies = [ "chrono", "futures", "once_cell", - "prost 0.11.9", - "prost-wkt-types", + "prost", + "prost-extend", "serde", "serde_json", "snafu", "tokio", - "tonic 0.9.2", - "tonic-build 0.9.2", + "tonic", + "tonic-build", "tracing", "uuid", ] @@ -1358,9 +1349,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -1477,7 +1468,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -1579,12 +1570,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "inventory" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a53088c87cf71c9d4f3372a2cb9eea1e7b8a0b1bf8b7f7d23fe5b76dbb07e63b" - [[package]] name = "io-engine" version = "1.0.0" @@ -1614,6 +1599,7 @@ dependencies = [ "hex", "http", "humantime", + "io-engine-api", "io-engine-tests", "io-uring", "ioctl-gen", @@ -1622,7 +1608,6 @@ dependencies = [ "libc", "libnvme-rs", "log", - "mayastor-api", "md5", "merge", "nix", @@ -1630,8 +1615,8 @@ dependencies = [ "parking_lot", "pin-utils", "proc-mounts", - "prost 0.11.9", - "prost-derive 0.11.9", + "prost", + "prost-derive", "rand", "regex", "rstack", @@ -1648,10 +1633,11 @@ dependencies = [ "sysfs", "tokio", "tokio-stream", - "tonic 0.9.2", + "tonic", "tower", "tracing", "tracing-core", + "tracing-filter", "tracing-log", "tracing-subscriber", "udev", @@ -1660,6 +1646,23 @@ dependencies = [ "version-info", ] +[[package]] +name = "io-engine-api" +version = "1.0.0" +dependencies = [ + "bytes", + "prost", + "prost-build", + "prost-derive", + "prost-extend", + "prost-types", + "serde", + "serde_derive", + "serde_json", + "tonic", + "tonic-build", +] + [[package]] name = "io-engine-bench" version = "0.1.0" @@ -1671,14 +1674,14 @@ dependencies = [ "env_logger", "futures", "io-engine", + "io-engine-api", "io-engine-tests", "libnvme-rs", - "mayastor-api", "once_cell", "run_script", "spdk-rs", "tokio", - "tonic 0.9.2", + "tonic", "tracing", "tracing-core", "tracing-futures", @@ -1708,6 +1711,7 @@ dependencies = [ "hex", "http", "io-engine", + "io-engine-api", "io-engine-tests-macros", "io-uring", "ioctl-gen", @@ -1716,7 +1720,6 @@ dependencies = [ "libc", "libnvme-rs", "log", - "mayastor-api", "md5", "merge", "nix", @@ -1724,8 +1727,8 @@ dependencies = [ "parking_lot", "pin-utils", "proc-mounts", - "prost 0.11.9", - "prost-derive 0.11.9", + "prost", + "prost-derive", "rand", "rand_chacha", "regex", @@ -1739,7 +1742,7 @@ dependencies = [ "spdk-rs", "sysfs", "tokio", - "tonic 0.9.2", + "tonic", "tower", "tracing", "tracing-core", @@ -1816,6 +1819,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -1840,7 +1852,7 @@ dependencies = [ "serde_derive", "serde_json", "tokio", - "tonic 0.9.2", + "tonic", "tracing", ] @@ -1935,26 +1947,9 @@ dependencies = [ [[package]] name = "matchit" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" - -[[package]] -name = "mayastor-api" -version = "1.0.0" -dependencies = [ - "bytes", - "prost 0.11.9", - "prost-build 0.11.9", - "prost-derive 0.11.9", - "prost-types 0.11.9", - "prost-wkt-types", - "serde", - "serde_derive", - "serde_json", - "tonic 0.9.2", - "tonic-build 0.9.2", -] +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "md5" @@ -2031,9 +2026,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "log", @@ -2346,16 +2341,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "prettyplease" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "prettyplease" version = "0.2.15" @@ -2408,16 +2393,6 @@ dependencies = [ "partition-identity", ] -[[package]] -name = "prost" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" -dependencies = [ - "bytes", - "prost-derive 0.11.9", -] - [[package]] name = "prost" version = "0.12.1" @@ -2425,29 +2400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" dependencies = [ "bytes", - "prost-derive 0.12.1", -] - -[[package]] -name = "prost-build" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" -dependencies = [ - "bytes", - "heck", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prettyplease 0.1.25", - "prost 0.11.9", - "prost-types 0.11.9", - "regex", - "syn 1.0.109", - "tempfile", - "which", + "prost-derive", ] [[package]] @@ -2458,33 +2411,20 @@ checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac" dependencies = [ "bytes", "heck", - "itertools", + "itertools 0.11.0", "log", "multimap", "once_cell", "petgraph", - "prettyplease 0.2.15", - "prost 0.12.1", - "prost-types 0.12.1", + "prettyplease", + "prost", + "prost-types", "regex", "syn 2.0.38", "tempfile", "which", ] -[[package]] -name = "prost-derive" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "prost-derive" version = "0.12.1" @@ -2492,19 +2432,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" dependencies = [ "anyhow", - "itertools", + "itertools 0.11.0", "proc-macro2", "quote", "syn 2.0.38", ] [[package]] -name = "prost-types" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +name = "prost-extend" +version = "0.1.0" dependencies = [ - "prost 0.11.9", + "chrono", + "prost", + "serde", + "tonic-build", ] [[package]] @@ -2513,53 +2454,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf" dependencies = [ - "prost 0.12.1", -] - -[[package]] -name = "prost-wkt" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562788060bcf2bfabe055194bd991ed2442457661744c88e0a0828ff9a08c08b" -dependencies = [ - "chrono", - "inventory", - "prost 0.11.9", - "serde", - "serde_derive", - "serde_json", - "typetag", -] - -[[package]] -name = "prost-wkt-build" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4dca8bcead3b728a6a7da017cc95e7f4cb2320ec4f6896bc593a1c4700f7328" -dependencies = [ - "heck", - "prost 0.11.9", - "prost-build 0.11.9", - "prost-types 0.11.9", - "quote", -] - -[[package]] -name = "prost-wkt-types" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2377c5680f2342871823045052e791b4487f7c90aae17e0feaee24cf59578a34" -dependencies = [ - "chrono", - "prost 0.11.9", - "prost-build 0.11.9", - "prost-types 0.11.9", - "prost-wkt", - "prost-wkt-build", - "regex", - "serde", - "serde_derive", - "serde_json", + "prost", ] [[package]] @@ -2880,18 +2775,18 @@ checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", @@ -3075,9 +2970,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -3085,9 +2980,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys", @@ -3309,7 +3204,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.5", "tokio-macros", "windows-sys", ] @@ -3369,9 +3264,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -3381,34 +3276,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tonic" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" -dependencies = [ - "async-trait", - "axum", - "base64", - "bytes", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost 0.11.9", - "tokio", - "tokio-stream", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tonic" version = "0.10.2" @@ -3427,7 +3294,7 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.12.1", + "prost", "tokio", "tokio-stream", "tower", @@ -3436,28 +3303,15 @@ dependencies = [ "tracing", ] -[[package]] -name = "tonic-build" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07" -dependencies = [ - "prettyplease 0.1.25", - "proc-macro2", - "prost-build 0.11.9", - "quote", - "syn 1.0.109", -] - [[package]] name = "tonic-build" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" dependencies = [ - "prettyplease 0.2.15", + "prettyplease", "proc-macro2", - "prost-build 0.12.1", + "prost-build", "quote", "syn 2.0.38", ] @@ -3496,11 +3350,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -3509,9 +3362,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -3520,14 +3373,21 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", ] +[[package]] +name = "tracing-filter" +version = "0.1.0" +dependencies = [ + "tracing-subscriber", +] + [[package]] name = "tracing-futures" version = "0.2.5" @@ -3579,30 +3439,6 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" -[[package]] -name = "typetag" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aec6850cc671cd0cfb3ab285465e48a3b927d9de155051c35797446b32f9169f" -dependencies = [ - "erased-serde", - "inventory", - "once_cell", - "serde", - "typetag-impl", -] - -[[package]] -name = "typetag-impl" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30c49a6815b4f8379c36f06618bc1b80ca77aaf8a3fd4d8549dca6fdb016000f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "udev" version = "0.8.0" @@ -3880,9 +3716,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -3895,45 +3731,45 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "yansi" diff --git a/Cargo.toml b/Cargo.toml index 52d10ef37..5bf6369ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,12 @@ members = [ "io-engine", "io-engine-bench", "io-engine-tests", - "rpc/mayastor-api", "sysfs", "spdk-rs", - "utils/io-engine-dependencies/version-info", - "utils/io-engine-dependencies/composer", - "utils/io-engine-dependencies/devinfo", - "utils/io-engine-dependencies/nvmeadm", + "utils/dependencies/apis/io-engine", + "utils/dependencies/prost-extend", + "utils/dependencies/version-info", + "utils/dependencies/composer", + "utils/dependencies/devinfo", + "utils/dependencies/nvmeadm", ] diff --git a/io-engine-bench/Cargo.toml b/io-engine-bench/Cargo.toml index c820a89f8..c106423e5 100644 --- a/io-engine-bench/Cargo.toml +++ b/io-engine-bench/Cargo.toml @@ -11,7 +11,7 @@ chrono = "0.4.31" env_logger = "0.10.0" futures = "0.3.28" once_cell = "1.18.0" -tonic = "0.9.2" +tonic = "0.10.2" tracing = "0.1.37" tracing-core = "0.1.31" tracing-futures = "0.2.5" @@ -20,9 +20,9 @@ url = "2.4.1" crossbeam = "0.8.2" uuid = { version = "1.4.1", features = ["v4"] } run_script = "0.10.1" -mayastor-api = { path = "../rpc/mayastor-api" } +io-engine-api = { path = "../utils/dependencies/apis/io-engine" } io-engine = { path = "../io-engine" } -composer = { path = "../utils/io-engine-dependencies/composer" } +composer = { path = "../utils/dependencies/composer" } spdk-rs = { path = "../spdk-rs" } io-engine-tests = { path = "../io-engine-tests" } libnvme-rs = { path = "../libnvme-rs", version = "0.1.0" } diff --git a/io-engine-tests/Cargo.toml b/io-engine-tests/Cargo.toml index 0480c7fa6..5a0cd00c4 100644 --- a/io-engine-tests/Cargo.toml +++ b/io-engine-tests/Cargo.toml @@ -33,8 +33,8 @@ once_cell = "1.18.0" parking_lot = "0.12.1" pin-utils = "0.1.0" proc-mounts = "0.3.0" -prost = "0.11.9" -prost-derive = "0.11.9" +prost = "0.12.1" +prost-derive = "0.12.1" rand = "0.8.5" rand_chacha = "0.3.1" regex = "1.10.0" @@ -44,7 +44,7 @@ serde_yaml = "0.9.25" sha2 = "0.10.8" signal-hook = "0.3.17" snafu = "0.7.5" -tonic = "0.9.2" +tonic = "0.10.2" tower = "0.4.13" tracing = "0.1.37" tracing-core = "0.1.31" @@ -53,10 +53,10 @@ tracing-subscriber = "0.3.17" udev = "0.8.0" url = "2.4.1" -composer = { path = "../utils/io-engine-dependencies/composer" } +composer = { path = "../utils/dependencies/composer" } libnvme-rs = { path = "../libnvme-rs" } -mayastor-api = { path = "../rpc/mayastor-api" } -version-info = { path = "../utils/io-engine-dependencies/version-info" } +io-engine-api = { path = "../utils/dependencies/apis/io-engine" } +version-info = { path = "../utils/dependencies/version-info" } io-engine = { path = "../io-engine" } io-engine-tests-macros = { path = "./io-engine-tests-macros" } diff --git a/io-engine-tests/src/compose/rpc/v0.rs b/io-engine-tests/src/compose/rpc/v0.rs index 920f4d845..805ceb6fb 100644 --- a/io-engine-tests/src/compose/rpc/v0.rs +++ b/io-engine-tests/src/compose/rpc/v0.rs @@ -14,7 +14,7 @@ use std::{ use tonic::transport::Channel; pub mod mayastor { - pub use mayastor_api::v0::*; + pub use io_engine_api::v0::*; } #[derive(Clone)] diff --git a/io-engine-tests/src/compose/rpc/v1.rs b/io-engine-tests/src/compose/rpc/v1.rs index 2866f086c..9e9c14f87 100644 --- a/io-engine-tests/src/compose/rpc/v1.rs +++ b/io-engine-tests/src/compose/rpc/v1.rs @@ -10,7 +10,7 @@ use std::{ use tonic::transport::Channel; pub use tonic::Status; -pub use mayastor_api::v1::*; +pub use io_engine_api::v1::*; type HandleLock = tokio::sync::Mutex; type HandleLockGuard<'a, T> = tokio::sync::MutexGuard<'a, T>; diff --git a/io-engine-tests/src/replica.rs b/io-engine-tests/src/replica.rs index 60e0d4f64..ae39ae38e 100644 --- a/io-engine-tests/src/replica.rs +++ b/io-engine-tests/src/replica.rs @@ -5,7 +5,7 @@ use super::{ pool::PoolBuilder, }; use io_engine::{constants::NVME_NQN_PREFIX, subsys::make_subsystem_serial}; -use mayastor_api::v1::replica::{ +use io_engine_api::v1::replica::{ destroy_replica_request, CreateReplicaRequest, DestroyReplicaRequest, @@ -83,7 +83,7 @@ impl ReplicaBuilder { } pub fn with_nvmf(mut self) -> Self { - self.share = mayastor_api::v1::common::ShareProtocol::Nvmf as i32; + self.share = io_engine_api::v1::common::ShareProtocol::Nvmf as i32; self } diff --git a/io-engine-tests/src/snapshot.rs b/io-engine-tests/src/snapshot.rs index 261af23a8..66d92d534 100644 --- a/io-engine-tests/src/snapshot.rs +++ b/io-engine-tests/src/snapshot.rs @@ -1,6 +1,6 @@ use super::{compose::rpc::v1::SharedRpcHandle, generate_uuid}; -use mayastor_api::v1::snapshot::{ +use io_engine_api::v1::snapshot::{ CreateReplicaSnapshotRequest, CreateReplicaSnapshotResponse, CreateSnapshotCloneRequest, diff --git a/io-engine/Cargo.toml b/io-engine/Cargo.toml index 9ef728a8f..f0b668db3 100644 --- a/io-engine/Cargo.toml +++ b/io-engine/Cargo.toml @@ -74,8 +74,8 @@ once_cell = "1.18.0" parking_lot = "0.12.1" pin-utils = "0.1.0" proc-mounts = "0.3.0" -prost = "0.11.9" -prost-derive = "0.11.9" +prost = "0.12.1" +prost-derive = "0.12.1" rand = "0.8.5" regex = "1.10.0" serde_json = "1.0.107" @@ -85,7 +85,7 @@ signal-hook = "0.3.17" snafu = "0.7.5" strum = "0.25" strum_macros = "0.25" -tonic = "0.9.2" +tonic = "0.10.2" tower = "0.4.13" tracing = "0.1.37" tracing-core = "0.1.31" @@ -99,12 +99,13 @@ rstack = { version = "0.3.3" } tokio-stream = "0.1.14" jsonrpc = { path = "../jsonrpc"} -mayastor-api = { path = "../rpc/mayastor-api" } +io-engine-api = { path = "../utils/dependencies/apis/io-engine" } spdk-rs = { path = "../spdk-rs" } sysfs = { path = "../sysfs" } -version-info = { path = "../utils/io-engine-dependencies/version-info" } -events-api = { path = "../utils/io-engine-dependencies/events-api" } -event-publisher = { path = "../utils/io-engine-dependencies/event-publisher" } +version-info = { path = "../utils/dependencies/version-info" } +events-api = { path = "../utils/dependencies/apis/events" } +event-publisher = { path = "../utils/dependencies/event-publisher" } +tracing-filter = { path = "../utils/dependencies/tracing-filter" } [dependencies.serde] features = ["derive"] diff --git a/io-engine/src/bdev/nexus/nexus_bdev.rs b/io-engine/src/bdev/nexus/nexus_bdev.rs index 7f9213954..b483e3eaa 100644 --- a/io-engine/src/bdev/nexus/nexus_bdev.rs +++ b/io-engine/src/bdev/nexus/nexus_bdev.rs @@ -1261,7 +1261,7 @@ impl<'n> BdevOps for Nexus<'n> { | IoType::WriteZeros => { let supported = self.io_is_supported(io_type); if !supported { - info!( + debug!( "{:?}: I/O type '{:?}' not supported by at least \ one of child devices", self, io_type diff --git a/io-engine/src/bin/io-engine-client/context.rs b/io-engine/src/bin/io-engine-client/context.rs index 782ad75b6..28ca5e5b2 100644 --- a/io-engine/src/bin/io-engine-client/context.rs +++ b/io-engine/src/bin/io-engine-client/context.rs @@ -56,7 +56,7 @@ impl FromStr for OutputFormat { mod v1 { use super::Error; - use mayastor_api::v1::*; + use io_engine_api::v1::*; use tonic::transport::{Channel, Endpoint}; pub type BdevRpcClient = bdev::BdevRpcClient; diff --git a/io-engine/src/bin/io-engine-client/main.rs b/io-engine/src/bin/io-engine-client/main.rs index c1550d8bc..10eae3ef7 100644 --- a/io-engine/src/bin/io-engine-client/main.rs +++ b/io-engine/src/bin/io-engine-client/main.rs @@ -2,7 +2,7 @@ use byte_unit::Byte; use snafu::{Backtrace, Snafu}; use tonic::transport::Channel; -use mayastor_api::v0::{ +use io_engine_api::v0::{ bdev_rpc_client::BdevRpcClient, json_rpc_client::JsonRpcClient, mayastor_client::MayastorClient, diff --git a/io-engine/src/bin/io-engine-client/v0/bdev_cli.rs b/io-engine/src/bin/io-engine-client/v0/bdev_cli.rs index d4262fab3..899794c6e 100644 --- a/io-engine/src/bin/io-engine-client/v0/bdev_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/bdev_cli.rs @@ -8,7 +8,7 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::prelude::*; -use mayastor_api::v0::{BdevShareRequest, BdevUri, CreateReply, Null}; +use io_engine_api::v0::{BdevShareRequest, BdevUri, CreateReply, Null}; use snafu::ResultExt; use tonic::Status; @@ -62,6 +62,7 @@ pub fn subcommands() -> Command { .arg(Arg::new("name").required(true).index(1)); Command::new("bdev") + .subcommand_required(true) .arg_required_else_help(true) .about("Block device management") .subcommand(list) diff --git a/io-engine/src/bin/io-engine-client/v0/controller_cli.rs b/io-engine/src/bin/io-engine-client/v0/controller_cli.rs index bb0f3c902..da47fc421 100755 --- a/io-engine/src/bin/io-engine-client/v0/controller_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/controller_cli.rs @@ -5,8 +5,9 @@ use super::context::Context; use crate::{context::OutputFormat, GrpcStatus}; use clap::{ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; +use std::convert::TryFrom; use tonic::Status; pub fn subcommands() -> Command { @@ -15,6 +16,7 @@ pub fn subcommands() -> Command { .about("Display I/O statistics for NVMe controllers"); Command::new("controller") + .subcommand_required(true) .arg_required_else_help(true) .about("NVMe controllers") .subcommand(list) @@ -33,7 +35,7 @@ pub async fn handler(ctx: Context, matches: &ArgMatches) -> crate::Result<()> { } fn controller_state_to_str(idx: i32) -> String { - match rpc::NvmeControllerState::from_i32(idx).unwrap() { + match rpc::NvmeControllerState::try_from(idx).unwrap() { rpc::NvmeControllerState::New => "new", rpc::NvmeControllerState::Initializing => "init", rpc::NvmeControllerState::Running => "running", diff --git a/io-engine/src/bin/io-engine-client/v0/device_cli.rs b/io-engine/src/bin/io-engine-client/v0/device_cli.rs index 93572a8e9..b56cb5e51 100644 --- a/io-engine/src/bin/io-engine-client/v0/device_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/device_cli.rs @@ -5,7 +5,7 @@ use super::context::Context; use crate::{context::OutputFormat, GrpcStatus}; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; use tonic::Status; @@ -21,6 +21,7 @@ pub fn subcommands() -> Command { ); Command::new("device") + .subcommand_required(true) .arg_required_else_help(true) .about("Host devices") .subcommand(list) diff --git a/io-engine/src/bin/io-engine-client/v0/jsonrpc_cli.rs b/io-engine/src/bin/io-engine-client/v0/jsonrpc_cli.rs index f81dc7595..d52f23406 100644 --- a/io-engine/src/bin/io-engine-client/v0/jsonrpc_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/jsonrpc_cli.rs @@ -5,12 +5,13 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; use tracing::debug; pub fn subcommands() -> Command { Command::new("jsonrpc") + .subcommand_required(true) .arg_required_else_help(true) .about("Call a json-rpc method with a raw JSON payload") .arg( diff --git a/io-engine/src/bin/io-engine-client/v0/mod.rs b/io-engine/src/bin/io-engine-client/v0/mod.rs index e22c38d9d..6b51961b8 100644 --- a/io-engine/src/bin/io-engine-client/v0/mod.rs +++ b/io-engine/src/bin/io-engine-client/v0/mod.rs @@ -73,7 +73,7 @@ pub(super) async fn main_() -> crate::Result<()> { .subcommand(snapshot_cli::subcommands()) .subcommand(jsonrpc_cli::subcommands()) .subcommand(controller_cli::subcommands()) - .arg_required_else_help(true) + .subcommand_required(true).arg_required_else_help(true) .get_matches(); let ctx = context::Context::new(&matches) diff --git a/io-engine/src/bin/io-engine-client/v0/nexus_child_cli.rs b/io-engine/src/bin/io-engine-client/v0/nexus_child_cli.rs index 307216100..027cd0fe6 100644 --- a/io-engine/src/bin/io-engine-client/v0/nexus_child_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/nexus_child_cli.rs @@ -8,7 +8,7 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; use tonic::Status; @@ -87,6 +87,7 @@ pub fn subcommands() -> Command { ); Command::new("child") + .subcommand_required(true) .arg_required_else_help(true) .about("Nexus child management") .subcommand(fault) diff --git a/io-engine/src/bin/io-engine-client/v0/nexus_cli.rs b/io-engine/src/bin/io-engine-client/v0/nexus_cli.rs index d5812f15c..cadb1a357 100644 --- a/io-engine/src/bin/io-engine-client/v0/nexus_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/nexus_cli.rs @@ -8,8 +8,9 @@ use crate::{ use byte_unit::Byte; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::{v0, v1}; +use io_engine_api::{v0, v1}; use snafu::ResultExt; +use std::convert::TryFrom; use tonic::{Code, Status}; use uuid::Uuid; @@ -215,6 +216,7 @@ pub fn subcommands() -> Command { ); Command::new("nexus") + .subcommand_required(true) .arg_required_else_help(true) .about("Nexus device management") .subcommand(create) @@ -614,7 +616,7 @@ async fn nexus_children( .iter() .map(|c| { let state = child_state_to_str_v0( - v0::ChildState::from_i32(c.state).unwrap(), + v0::ChildState::try_from(c.state).unwrap(), ); vec![c.uri.clone(), state.to_string()] }) @@ -676,10 +678,10 @@ async fn nexus_children_2( .iter() .map(|c| { let state = child_state_to_str_v1( - v1::nexus::ChildState::from_i32(c.state).unwrap(), + v1::nexus::ChildState::try_from(c.state).unwrap(), ); let reason = child_reason_to_str_v1( - v1::nexus::ChildStateReason::from_i32(c.state_reason) + v1::nexus::ChildStateReason::try_from(c.state_reason) .unwrap(), ); vec![c.uri.clone(), state.to_string(), reason.to_string()] @@ -942,7 +944,7 @@ async fn nexus_remove( } fn ana_state_idx_to_str(idx: i32) -> &'static str { - match v0::NvmeAnaState::from_i32(idx).unwrap() { + match v0::NvmeAnaState::try_from(idx).unwrap() { v0::NvmeAnaState::NvmeAnaInvalidState => "invalid", v0::NvmeAnaState::NvmeAnaOptimizedState => "optimized", v0::NvmeAnaState::NvmeAnaNonOptimizedState => "non_optimized", @@ -953,7 +955,7 @@ fn ana_state_idx_to_str(idx: i32) -> &'static str { } fn nexus_state_to_str(idx: i32) -> &'static str { - match v0::NexusState::from_i32(idx).unwrap() { + match v0::NexusState::try_from(idx).unwrap() { v0::NexusState::NexusUnknown => "unknown", v0::NexusState::NexusOnline => "online", v0::NexusState::NexusDegraded => "degraded", diff --git a/io-engine/src/bin/io-engine-client/v0/perf_cli.rs b/io-engine/src/bin/io-engine-client/v0/perf_cli.rs index 11a1956b9..aab689c2f 100644 --- a/io-engine/src/bin/io-engine-client/v0/perf_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/perf_cli.rs @@ -10,7 +10,7 @@ use super::{ }; use clap::{ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; use tonic::Status; @@ -18,6 +18,7 @@ pub fn subcommands() -> Command { let resource = Command::new("resource").about("Resource usage statistics"); Command::new("perf") + .subcommand_required(true) .arg_required_else_help(true) .about("Performance statistics") .subcommand(resource) diff --git a/io-engine/src/bin/io-engine-client/v0/pool_cli.rs b/io-engine/src/bin/io-engine-client/v0/pool_cli.rs index 912f25107..613d4eab5 100644 --- a/io-engine/src/bin/io-engine-client/v0/pool_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/pool_cli.rs @@ -6,8 +6,9 @@ use crate::{ use byte_unit::Byte; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; +use std::convert::TryFrom; use tonic::Status; pub fn subcommands() -> Command { @@ -33,6 +34,7 @@ pub fn subcommands() -> Command { .help("Storage pool name"), ); Command::new("pool") + .subcommand_required(true) .arg_required_else_help(true) .about("Storage pool management") .subcommand(create) @@ -180,7 +182,7 @@ async fn list(mut ctx: Context, _matches: &ArgMatches) -> crate::Result<()> { } fn pool_state_to_str(idx: i32) -> &'static str { - match rpc::PoolState::from_i32(idx).unwrap() { + match rpc::PoolState::try_from(idx).unwrap() { rpc::PoolState::PoolUnknown => "unknown", rpc::PoolState::PoolOnline => "online", rpc::PoolState::PoolDegraded => "degraded", diff --git a/io-engine/src/bin/io-engine-client/v0/rebuild_cli.rs b/io-engine/src/bin/io-engine-client/v0/rebuild_cli.rs index ba7c0469d..f902e9ab7 100644 --- a/io-engine/src/bin/io-engine-client/v0/rebuild_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/rebuild_cli.rs @@ -8,7 +8,7 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; use tonic::Status; @@ -135,6 +135,7 @@ pub fn subcommands() -> Command { ); Command::new("rebuild") + .subcommand_required(true) .arg_required_else_help(true) .about("Rebuild management") .subcommand(start) diff --git a/io-engine/src/bin/io-engine-client/v0/replica_cli.rs b/io-engine/src/bin/io-engine-client/v0/replica_cli.rs index adf8d9731..576fea5b1 100644 --- a/io-engine/src/bin/io-engine-client/v0/replica_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/replica_cli.rs @@ -7,8 +7,9 @@ use crate::{ use byte_unit::Byte; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; +use std::convert::TryFrom; use tonic::{Code, Status}; pub fn subcommands() -> Command { @@ -131,6 +132,7 @@ pub fn subcommands() -> Command { .help("NQN of hosts which are allowed to connect to the target")); Command::new("replica") + .subcommand_required(true) .arg_required_else_help(true) .about("Replica management") .subcommand(create) @@ -538,10 +540,10 @@ fn parse_replica_protocol(pcol: Option<&String>) -> Result { } fn replica_protocol_to_str(idx: i32) -> &'static str { - match rpc::ShareProtocolReplica::from_i32(idx) { - Some(rpc::ShareProtocolReplica::ReplicaNone) => "none", - Some(rpc::ShareProtocolReplica::ReplicaNvmf) => "nvmf", - Some(rpc::ShareProtocolReplica::ReplicaIscsi) => "iscsi", - None => "unknown", + match rpc::ShareProtocolReplica::try_from(idx) { + Ok(rpc::ShareProtocolReplica::ReplicaNone) => "none", + Ok(rpc::ShareProtocolReplica::ReplicaNvmf) => "nvmf", + Ok(rpc::ShareProtocolReplica::ReplicaIscsi) => "iscsi", + Err(_) => "unknown", } } diff --git a/io-engine/src/bin/io-engine-client/v0/snapshot_cli.rs b/io-engine/src/bin/io-engine-client/v0/snapshot_cli.rs index 5723554b9..0a8b80a8e 100644 --- a/io-engine/src/bin/io-engine-client/v0/snapshot_cli.rs +++ b/io-engine/src/bin/io-engine-client/v0/snapshot_cli.rs @@ -8,7 +8,7 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; use tonic::Status; @@ -31,6 +31,7 @@ pub fn subcommands() -> Command { ); Command::new("snapshot") + .subcommand_required(true) .arg_required_else_help(true) .about("Snapshot management") .subcommand(create) diff --git a/io-engine/src/bin/io-engine-client/v1/bdev_cli.rs b/io-engine/src/bin/io-engine-client/v1/bdev_cli.rs index 6e0299ed7..a2d2c4841 100644 --- a/io-engine/src/bin/io-engine-client/v1/bdev_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/bdev_cli.rs @@ -8,7 +8,7 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::prelude::*; -use mayastor_api::v1 as v1rpc; +use io_engine_api::v1 as v1rpc; use snafu::ResultExt; use tonic::Status; @@ -63,6 +63,7 @@ pub fn subcommands() -> Command { .arg(Arg::new("name").required(true).index(1)); Command::new("bdev") + .subcommand_required(true) .arg_required_else_help(true) .about("Block device management") .subcommand(list) diff --git a/io-engine/src/bin/io-engine-client/v1/controller_cli.rs b/io-engine/src/bin/io-engine-client/v1/controller_cli.rs index c5c9045b4..ee1920de6 100755 --- a/io-engine/src/bin/io-engine-client/v1/controller_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/controller_cli.rs @@ -5,8 +5,9 @@ use super::context::Context; use crate::{context::OutputFormat, GrpcStatus}; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v1 as v1rpc; +use io_engine_api::v1 as v1rpc; use snafu::ResultExt; +use std::convert::TryFrom; use tonic::Status; pub fn subcommands() -> Command { @@ -20,6 +21,7 @@ pub fn subcommands() -> Command { ); Command::new("controller") + .subcommand_required(true) .arg_required_else_help(true) .about("NVMe controllers") .subcommand(list) @@ -38,7 +40,7 @@ pub async fn handler(ctx: Context, matches: &ArgMatches) -> crate::Result<()> { } fn controller_state_to_str(idx: i32) -> String { - match v1rpc::host::NvmeControllerState::from_i32(idx).unwrap() { + match v1rpc::host::NvmeControllerState::try_from(idx).unwrap() { v1rpc::host::NvmeControllerState::New => "new", v1rpc::host::NvmeControllerState::Initializing => "init", v1rpc::host::NvmeControllerState::Running => "running", diff --git a/io-engine/src/bin/io-engine-client/v1/device_cli.rs b/io-engine/src/bin/io-engine-client/v1/device_cli.rs index c3976502c..e0820251c 100644 --- a/io-engine/src/bin/io-engine-client/v1/device_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/device_cli.rs @@ -5,7 +5,7 @@ use super::context::Context; use crate::{context::OutputFormat, GrpcStatus}; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v1 as v1rpc; +use io_engine_api::v1 as v1rpc; use snafu::ResultExt; use tonic::Status; @@ -21,6 +21,7 @@ pub fn subcommands() -> Command { ); Command::new("device") + .subcommand_required(true) .arg_required_else_help(true) .about("Host devices") .subcommand(list) diff --git a/io-engine/src/bin/io-engine-client/v1/jsonrpc_cli.rs b/io-engine/src/bin/io-engine-client/v1/jsonrpc_cli.rs index 8d08b8edf..dca073a34 100644 --- a/io-engine/src/bin/io-engine-client/v1/jsonrpc_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/jsonrpc_cli.rs @@ -5,7 +5,7 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v1 as v1rpc; +use io_engine_api::v1 as v1rpc; use snafu::ResultExt; use tracing::debug; @@ -24,6 +24,7 @@ pub fn subcommands() -> Command { .index(2) .help("Parameters (JSON string) to pass to method call"), ) + .subcommand_required(true) .arg_required_else_help(true) } diff --git a/io-engine/src/bin/io-engine-client/v1/mod.rs b/io-engine/src/bin/io-engine-client/v1/mod.rs index b33101a9a..0b324a458 100644 --- a/io-engine/src/bin/io-engine-client/v1/mod.rs +++ b/io-engine/src/bin/io-engine-client/v1/mod.rs @@ -76,6 +76,7 @@ pub(super) async fn main_() -> crate::Result<()> { .subcommand(jsonrpc_cli::subcommands()) .subcommand(controller_cli::subcommands()) .subcommand(test_cli::subcommands()) + .subcommand_required(true) .arg_required_else_help(true) .get_matches(); diff --git a/io-engine/src/bin/io-engine-client/v1/nexus_child_cli.rs b/io-engine/src/bin/io-engine-client/v1/nexus_child_cli.rs index 493ea22f3..50fa323e1 100644 --- a/io-engine/src/bin/io-engine-client/v1/nexus_child_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/nexus_child_cli.rs @@ -8,7 +8,7 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v1 as v1rpc; +use io_engine_api::v1 as v1rpc; use snafu::ResultExt; use tonic::Status; @@ -87,6 +87,7 @@ pub fn subcommands() -> Command { ); Command::new("child") + .subcommand_required(true) .arg_required_else_help(true) .about("Nexus child management") .subcommand(fault) diff --git a/io-engine/src/bin/io-engine-client/v1/nexus_cli.rs b/io-engine/src/bin/io-engine-client/v1/nexus_cli.rs index 33abe349f..0496c6059 100644 --- a/io-engine/src/bin/io-engine-client/v1/nexus_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/nexus_cli.rs @@ -8,8 +8,9 @@ use crate::{ use byte_unit::Byte; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::{v1, v1::nexus::NvmeReservation}; +use io_engine_api::{v1, v1::nexus::NvmeReservation}; use snafu::ResultExt; +use std::convert::TryFrom; use tonic::{Code, Status}; use uuid::Uuid; @@ -196,6 +197,7 @@ pub fn subcommands() -> Command { ); Command::new("nexus") + .subcommand_required(true) .arg_required_else_help(true) .about("Nexus device management") .subcommand(create) @@ -534,10 +536,10 @@ async fn nexus_children_2( .iter() .map(|c| { let state = child_state_to_str_v1( - v1::nexus::ChildState::from_i32(c.state).unwrap(), + v1::nexus::ChildState::try_from(c.state).unwrap(), ); let reason = child_reason_to_str_v1( - v1::nexus::ChildStateReason::from_i32(c.state_reason) + v1::nexus::ChildStateReason::try_from(c.state_reason) .unwrap(), ); let fault_timestamp = match &c.fault_timestamp { @@ -822,7 +824,7 @@ async fn nexus_remove( } fn ana_state_idx_to_str(idx: i32) -> &'static str { - match v1::nexus::NvmeAnaState::from_i32(idx).unwrap() { + match v1::nexus::NvmeAnaState::try_from(idx).unwrap() { v1::nexus::NvmeAnaState::NvmeAnaInvalidState => "invalid", v1::nexus::NvmeAnaState::NvmeAnaOptimizedState => "optimized", v1::nexus::NvmeAnaState::NvmeAnaNonOptimizedState => "non_optimized", @@ -835,7 +837,7 @@ fn ana_state_idx_to_str(idx: i32) -> &'static str { } fn nexus_state_to_str(idx: i32) -> &'static str { - match v1::nexus::NexusState::from_i32(idx).unwrap() { + match v1::nexus::NexusState::try_from(idx).unwrap() { v1::nexus::NexusState::NexusUnknown => "unknown", v1::nexus::NexusState::NexusOnline => "online", v1::nexus::NexusState::NexusDegraded => "degraded", diff --git a/io-engine/src/bin/io-engine-client/v1/perf_cli.rs b/io-engine/src/bin/io-engine-client/v1/perf_cli.rs index 972dc5e1e..4dcf20d45 100644 --- a/io-engine/src/bin/io-engine-client/v1/perf_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/perf_cli.rs @@ -10,7 +10,7 @@ use super::{ }; use clap::{ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use snafu::ResultExt; use tonic::Status; @@ -18,6 +18,7 @@ pub fn subcommands() -> Command { let resource = Command::new("resource").about("Resource usage statistics"); Command::new("perf") + .subcommand_required(true) .arg_required_else_help(true) .about("Performance statistics") .subcommand(resource) diff --git a/io-engine/src/bin/io-engine-client/v1/pool_cli.rs b/io-engine/src/bin/io-engine-client/v1/pool_cli.rs index 9da6d1b81..408698d60 100644 --- a/io-engine/src/bin/io-engine-client/v1/pool_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/pool_cli.rs @@ -7,8 +7,9 @@ use crate::{ use byte_unit::Byte; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v1 as v1rpc; +use io_engine_api::v1 as v1rpc; use snafu::ResultExt; +use std::convert::TryFrom; use tonic::Status; pub fn subcommands() -> Command { @@ -79,6 +80,7 @@ pub fn subcommands() -> Command { ); Command::new("pool") + .subcommand_required(true) .arg_required_else_help(true) .about("Storage pool management") .subcommand(create) @@ -324,7 +326,7 @@ async fn list(mut ctx: Context, _matches: &ArgMatches) -> crate::Result<()> { } fn pool_state_to_str(idx: i32) -> &'static str { - match v1rpc::pool::PoolState::from_i32(idx).unwrap() { + match v1rpc::pool::PoolState::try_from(idx).unwrap() { v1rpc::pool::PoolState::PoolUnknown => "unknown", v1rpc::pool::PoolState::PoolOnline => "online", v1rpc::pool::PoolState::PoolDegraded => "degraded", diff --git a/io-engine/src/bin/io-engine-client/v1/rebuild_cli.rs b/io-engine/src/bin/io-engine-client/v1/rebuild_cli.rs index 658f4468f..c33086189 100644 --- a/io-engine/src/bin/io-engine-client/v1/rebuild_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/rebuild_cli.rs @@ -8,8 +8,9 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v1; +use io_engine_api::v1; use snafu::ResultExt; +use std::convert::TryFrom; use tonic::Status; pub async fn handler(ctx: Context, matches: &ArgMatches) -> crate::Result<()> { @@ -145,6 +146,7 @@ pub fn subcommands() -> Command { ); Command::new("rebuild") + .subcommand_required(true) .arg_required_else_help(true) .about("Rebuild management") .subcommand(start) @@ -403,7 +405,7 @@ async fn history(mut ctx: Context, matches: &ArgMatches) -> crate::Result<()> { .iter() .map(|r| { let state = rebuild_state_to_str( - v1::nexus::RebuildJobState::from_i32(r.state).unwrap(), + v1::nexus::RebuildJobState::try_from(r.state).unwrap(), ) .to_string(); diff --git a/io-engine/src/bin/io-engine-client/v1/replica_cli.rs b/io-engine/src/bin/io-engine-client/v1/replica_cli.rs index cb749d627..0a3f225a6 100644 --- a/io-engine/src/bin/io-engine-client/v1/replica_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/replica_cli.rs @@ -7,8 +7,9 @@ use crate::{ use byte_unit::Byte; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::{v0 as rpc, v1 as v1_rpc}; +use io_engine_api::{v0 as rpc, v1 as v1_rpc}; use snafu::ResultExt; +use std::convert::TryFrom; use tonic::{Code, Status}; pub fn subcommands() -> Command { @@ -107,6 +108,7 @@ pub fn subcommands() -> Command { .help("Replica uuid"), ); Command::new("replica") + .subcommand_required(true) .arg_required_else_help(true) .about("Replica management") .subcommand(create) @@ -479,10 +481,10 @@ fn parse_replica_protocol(pcol: Option<&String>) -> Result { } fn replica_protocol_to_str(idx: i32) -> &'static str { - match v1_rpc::common::ShareProtocol::from_i32(idx) { - Some(v1_rpc::common::ShareProtocol::None) => "none", - Some(v1_rpc::common::ShareProtocol::Nvmf) => "nvmf", - Some(v1_rpc::common::ShareProtocol::Iscsi) => "iscsi", - None => "unknown", + match v1_rpc::common::ShareProtocol::try_from(idx) { + Ok(v1_rpc::common::ShareProtocol::None) => "none", + Ok(v1_rpc::common::ShareProtocol::Nvmf) => "nvmf", + Ok(v1_rpc::common::ShareProtocol::Iscsi) => "iscsi", + Err(_) => "unknown", } } diff --git a/io-engine/src/bin/io-engine-client/v1/snapshot_cli.rs b/io-engine/src/bin/io-engine-client/v1/snapshot_cli.rs index 893215fc4..97535e6e9 100644 --- a/io-engine/src/bin/io-engine-client/v1/snapshot_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/snapshot_cli.rs @@ -8,7 +8,7 @@ use crate::{ }; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; -use mayastor_api::v1 as v1_rpc; +use io_engine_api::v1 as v1_rpc; use snafu::ResultExt; use tonic::Status; @@ -162,6 +162,7 @@ pub fn subcommands() -> Command { .help("Snapshot uuid"), ); Command::new("snapshot") + .subcommand_required(true) .arg_required_else_help(true) .about("Snapshot management") .subcommand(create_for_nexus) diff --git a/io-engine/src/bin/io-engine-client/v1/test_cli.rs b/io-engine/src/bin/io-engine-client/v1/test_cli.rs index 7c371eb0d..29cca6de4 100644 --- a/io-engine/src/bin/io-engine-client/v1/test_cli.rs +++ b/io-engine/src/bin/io-engine-client/v1/test_cli.rs @@ -8,7 +8,7 @@ use byte_unit::Byte; use clap::{Arg, ArgMatches, Command}; use colored_json::ToColoredJson; use futures::StreamExt; -use mayastor_api::v1 as v1_rpc; +use io_engine_api::v1 as v1_rpc; use snafu::ResultExt; use std::{convert::TryInto, str::FromStr}; use strum::VariantNames; @@ -86,6 +86,7 @@ pub fn subcommands() -> Command { ); Command::new("test") + .subcommand_required(true) .arg_required_else_help(true) .about("Test management") .subcommand(inject) diff --git a/io-engine/src/grpc/server.rs b/io-engine/src/grpc/server.rs index cfb655d2a..3a838e13e 100644 --- a/io-engine/src/grpc/server.rs +++ b/io-engine/src/grpc/server.rs @@ -16,7 +16,7 @@ use super::{ }, }; -use mayastor_api::{ +use io_engine_api::{ v0::{ bdev_rpc_server::BdevRpcServer, json_rpc_server::JsonRpcServer, diff --git a/io-engine/src/grpc/v0/bdev_grpc.rs b/io-engine/src/grpc/v0/bdev_grpc.rs index cf3ae2e50..4e5b5a073 100644 --- a/io-engine/src/grpc/v0/bdev_grpc.rs +++ b/io-engine/src/grpc/v0/bdev_grpc.rs @@ -4,7 +4,7 @@ use tracing::instrument; use std::{convert::TryFrom, pin::Pin}; use url::Url; -use mayastor_api::v0::{ +use io_engine_api::v0::{ bdev_rpc_server::BdevRpc, Bdev as RpcBdev, BdevShareReply, diff --git a/io-engine/src/grpc/v0/json_grpc.rs b/io-engine/src/grpc/v0/json_grpc.rs index 451274228..d2e451993 100644 --- a/io-engine/src/grpc/v0/json_grpc.rs +++ b/io-engine/src/grpc/v0/json_grpc.rs @@ -2,12 +2,12 @@ //! gRPC method to proxy calls to (local) SPDK json-rpc service use crate::grpc::GrpcResult; -use jsonrpc::error::Error; -use mayastor_api::v0::{ +use io_engine_api::v0::{ json_rpc_server::JsonRpc, JsonRpcReply, JsonRpcRequest, }; +use jsonrpc::error::Error; use std::borrow::Cow; use tonic::{Request, Response}; diff --git a/io-engine/src/grpc/v0/mayastor_grpc.rs b/io-engine/src/grpc/v0/mayastor_grpc.rs index 78dd92930..418f410ec 100644 --- a/io-engine/src/grpc/v0/mayastor_grpc.rs +++ b/io-engine/src/grpc/v0/mayastor_grpc.rs @@ -58,7 +58,7 @@ use crate::{ use chrono::Utc; use futures::FutureExt; -use mayastor_api::v0::*; +use io_engine_api::v0::*; use nix::errno::Errno; use std::{ convert::{TryFrom, TryInto}, @@ -392,7 +392,7 @@ impl From for RebuildStatsReply { } } -impl From for mayastor_api::v0::MayastorFeatures { +impl From for io_engine_api::v0::MayastorFeatures { fn from(f: MayastorFeatures) -> Self { Self { asymmetric_namespace_access: f.asymmetric_namespace_access, @@ -526,9 +526,9 @@ impl TryFrom for nexus::NvmeReservation { type Error = tonic::Status; fn try_from(value: NvmeReservationConv) -> Result { match value.0 { - Some(v) => match NvmeReservation::from_i32(v) { - Some(v) => Ok(v.into()), - None => Err(tonic::Status::invalid_argument(format!( + Some(v) => match NvmeReservation::try_from(v) { + Ok(v) => Ok(v.into()), + Err(_) => Err(tonic::Status::invalid_argument(format!( "Invalid reservation type {v}" ))), }, @@ -540,14 +540,14 @@ struct NvmePreemptionConv(i32); impl TryFrom for nexus::NexusNvmePreemption { type Error = tonic::Status; fn try_from(value: NvmePreemptionConv) -> Result { - match NexusNvmePreemption::from_i32(value.0) { - Some(NexusNvmePreemption::ArgKey) => { + match NexusNvmePreemption::try_from(value.0) { + Ok(NexusNvmePreemption::ArgKey) => { Ok(nexus::NexusNvmePreemption::ArgKey) } - Some(NexusNvmePreemption::Holder) => { + Ok(NexusNvmePreemption::Holder) => { Ok(nexus::NexusNvmePreemption::Holder) } - None => Err(tonic::Status::invalid_argument(format!( + Err(_) => Err(tonic::Status::invalid_argument(format!( "Invalid reservation preempt policy {}", value.0 ))), diff --git a/io-engine/src/grpc/v0/nexus_grpc.rs b/io-engine/src/grpc/v0/nexus_grpc.rs index 85d020c7d..4528d8d54 100644 --- a/io-engine/src/grpc/v0/nexus_grpc.rs +++ b/io-engine/src/grpc/v0/nexus_grpc.rs @@ -1,5 +1,5 @@ ///! Helpers related to nexus grpc methods. -use mayastor_api::v0 as rpc; +use io_engine_api::v0 as rpc; use rpc::{ChildState, ChildStateReason}; use std::{convert::From, pin::Pin}; use uuid::Uuid; diff --git a/io-engine/src/grpc/v1/bdev.rs b/io-engine/src/grpc/v1/bdev.rs index 203b680c1..fd9c04366 100644 --- a/io-engine/src/grpc/v1/bdev.rs +++ b/io-engine/src/grpc/v1/bdev.rs @@ -4,7 +4,7 @@ use crate::{ core::{CoreError, Protocol, Share, ShareProps}, grpc::{rpc_submit, GrpcResult}, }; -use mayastor_api::v1::bdev::{ +use io_engine_api::v1::bdev::{ Bdev, BdevRpc, BdevShareRequest, diff --git a/io-engine/src/grpc/v1/host.rs b/io-engine/src/grpc/v1/host.rs index 1499739dc..8cc570390 100644 --- a/io-engine/src/grpc/v1/host.rs +++ b/io-engine/src/grpc/v1/host.rs @@ -17,7 +17,7 @@ use crate::{ }; use ::function_name::named; use futures::FutureExt; -use mayastor_api::v1::{host as host_rpc, registration::RegisterRequest}; +use io_engine_api::v1::{host as host_rpc, registration::RegisterRequest}; use std::panic::AssertUnwindSafe; use tonic::{Request, Response, Status}; use version_info::raw_version_string; @@ -221,7 +221,7 @@ impl host_rpc::HostRpc for HostService { .api_versions .iter() .map(|v| { - let api_version: mayastor_api::v1::registration::ApiVersion = + let api_version: io_engine_api::v1::registration::ApiVersion = v.clone().into(); api_version as i32 }) diff --git a/io-engine/src/grpc/v1/json.rs b/io-engine/src/grpc/v1/json.rs index c3503fd07..ec3a76338 100644 --- a/io-engine/src/grpc/v1/json.rs +++ b/io-engine/src/grpc/v1/json.rs @@ -2,8 +2,8 @@ //! gRPC method to proxy calls to (local) SPDK json-rpc service use crate::grpc::GrpcResult; +use io_engine_api::v1::json::{JsonRpc, JsonRpcRequest, JsonRpcResponse}; use jsonrpc::error::Error; -use mayastor_api::v1::json::{JsonRpc, JsonRpcRequest, JsonRpcResponse}; use std::borrow::Cow; use tonic::{Request, Response}; diff --git a/io-engine/src/grpc/v1/nexus.rs b/io-engine/src/grpc/v1/nexus.rs index fa7f3e2c8..8d2080025 100644 --- a/io-engine/src/grpc/v1/nexus.rs +++ b/io-engine/src/grpc/v1/nexus.rs @@ -27,7 +27,7 @@ use std::{ }; use tonic::{Request, Response, Status}; -use mayastor_api::v1::nexus::*; +use io_engine_api::v1::nexus::*; #[derive(Debug)] struct UnixStream(tokio::net::UnixStream); @@ -199,7 +199,7 @@ impl From for RebuildStatsResponse { } } -impl From for mayastor_api::v1::nexus::RebuildJobState { +impl From for io_engine_api::v1::nexus::RebuildJobState { fn from(state: RebuildState) -> Self { match state { RebuildState::Init => RebuildJobState::Init, @@ -257,9 +257,9 @@ impl TryFrom for nexus::NvmeReservation { type Error = tonic::Status; fn try_from(value: NvmeReservationConv) -> Result { match value.0 { - Some(v) => match NvmeReservation::from_i32(v) { - Some(v) => Ok(v.into()), - None => Err(tonic::Status::invalid_argument(format!( + Some(v) => match NvmeReservation::try_from(v) { + Ok(v) => Ok(v.into()), + Err(_) => Err(tonic::Status::invalid_argument(format!( "Invalid reservation type {v}" ))), }, @@ -271,14 +271,14 @@ struct NvmePreemptionConv(i32); impl TryFrom for nexus::NexusNvmePreemption { type Error = tonic::Status; fn try_from(value: NvmePreemptionConv) -> Result { - match NexusNvmePreemption::from_i32(value.0) { - Some(NexusNvmePreemption::ArgKey) => { + match NexusNvmePreemption::try_from(value.0) { + Ok(NexusNvmePreemption::ArgKey) => { Ok(nexus::NexusNvmePreemption::ArgKey) } - Some(NexusNvmePreemption::Holder) => { + Ok(NexusNvmePreemption::Holder) => { Ok(nexus::NexusNvmePreemption::Holder) } - None => Err(tonic::Status::invalid_argument(format!( + Err(_) => Err(tonic::Status::invalid_argument(format!( "Invalid reservation preempt policy {}", value.0 ))), @@ -337,7 +337,7 @@ impl<'n> nexus::Nexus<'n> { // Get ANA state only for published nexuses. if let Some(Protocol::Nvmf) = self.shared() { if let Ok(state) = self.get_ana_state().await { - ana_state = NvmeAnaState::from_i32(state as i32) + ana_state = NvmeAnaState::try_from(state as i32) .unwrap_or(NvmeAnaState::NvmeAnaInvalidState); } } @@ -1063,7 +1063,7 @@ impl NexusRpc for NexusService { let count = args.count.unwrap_or(u32::MAX) as usize; let end_time = args .since_end_time - .map(chrono::DateTime::::from); + .and_then(|t| chrono::DateTime::::try_from(t).ok()); let rx = rpc_submit::<_, _, nexus::Error>(async move { let mut newest_end_time = None; let default_end_time = chrono::Utc::now(); diff --git a/io-engine/src/grpc/v1/pool.rs b/io-engine/src/grpc/v1/pool.rs index eadb4250c..1c04b23b7 100644 --- a/io-engine/src/grpc/v1/pool.rs +++ b/io-engine/src/grpc/v1/pool.rs @@ -9,7 +9,7 @@ use nix::errno::Errno; use std::{convert::TryFrom, fmt::Debug}; use tonic::{Request, Response, Status}; -use mayastor_api::v1::pool::*; +use io_engine_api::v1::pool::*; #[derive(Debug)] struct UnixStream(tokio::net::UnixStream); diff --git a/io-engine/src/grpc/v1/replica.rs b/io-engine/src/grpc/v1/replica.rs index 82b937558..6856b4016 100644 --- a/io-engine/src/grpc/v1/replica.rs +++ b/io-engine/src/grpc/v1/replica.rs @@ -16,7 +16,7 @@ use crate::{ }; use ::function_name::named; use futures::FutureExt; -use mayastor_api::v1::replica::*; +use io_engine_api::v1::replica::*; use nix::errno::Errno; use std::{convert::TryFrom, panic::AssertUnwindSafe, pin::Pin}; use tonic::{Request, Response, Status}; diff --git a/io-engine/src/grpc/v1/snapshot.rs b/io-engine/src/grpc/v1/snapshot.rs index a7eb3857c..07745e4d7 100644 --- a/io-engine/src/grpc/v1/snapshot.rs +++ b/io-engine/src/grpc/v1/snapshot.rs @@ -30,7 +30,7 @@ use ::function_name::named; use chrono::{DateTime, Utc}; use core::ffi::{c_char, c_void}; use futures::FutureExt; -use mayastor_api::v1::snapshot::*; +use io_engine_api::v1::snapshot::*; use nix::errno::Errno; use spdk_rs::libspdk::spdk_blob_get_xattr_value; use std::{convert::TryFrom, panic::AssertUnwindSafe}; diff --git a/io-engine/src/grpc/v1/test.rs b/io-engine/src/grpc/v1/test.rs index 2b05887a3..9df7a91ba 100644 --- a/io-engine/src/grpc/v1/test.rs +++ b/io-engine/src/grpc/v1/test.rs @@ -9,7 +9,7 @@ use crate::{ lvs::{Error as LvsError, Lvol, Lvs, LvsLvol}, }; use ::function_name::named; -use mayastor_api::{ +use io_engine_api::{ v1, v1::test::{ wipe_options::WipeMethod, @@ -233,9 +233,10 @@ impl TryFrom<&Option> Ok(crate::core::wiper::StreamWipeOptions { chunk_size: wipe.chunk_size, wipe_method: { - let method = WipeMethod::from_i32(options.wipe_method).ok_or( - tonic::Status::invalid_argument("Invalid Wipe Method"), - )?; + let method = WipeMethod::try_from(options.wipe_method) + .map_err(|_| { + tonic::Status::invalid_argument("Invalid Wipe Method") + })?; Wiper::supported(match method { WipeMethod::None => crate::core::wiper::WipeMethod::None, WipeMethod::WriteZeroes => { diff --git a/io-engine/src/logger.rs b/io-engine/src/logger.rs index 117b0cdc5..0823325c7 100644 --- a/io-engine/src/logger.rs +++ b/io-engine/src/logger.rs @@ -25,7 +25,6 @@ use tracing_subscriber::{ }, layer::{Layer, SubscriberExt}, registry::LookupSpan, - EnvFilter, Registry, }; @@ -451,10 +450,7 @@ pub fn init_ex(level: &str, format: LogFormat, events_url: Option) { metadata.target() != EVENTING_TARGET })); - let filter = match EnvFilter::try_from_default_env() { - Ok(filter) => filter, - Err(_) => tracing_subscriber::EnvFilter::new(level), - }; + let filter = tracing_filter::rust_log_filter_ext(level); // Get the optional eventing layer. let events_layer = match events_url { diff --git a/io-engine/src/rebuild/rebuild_task.rs b/io-engine/src/rebuild/rebuild_task.rs index 4c0ba13db..038a670f6 100644 --- a/io-engine/src/rebuild/rebuild_task.rs +++ b/io-engine/src/rebuild/rebuild_task.rs @@ -94,7 +94,7 @@ impl RebuildTask { len, })?; - // Perform the copy + // Perform the copy. let result = self.copy_one(blk, descriptor).await; // Wait for the LBA range to be unlocked. @@ -113,27 +113,30 @@ impl RebuildTask { descriptor.blk_synced(blk); } - result.map(|_| true) + result } /// Copies one segment worth of data from source into destination. + /// Returns true if write transfer took place, false otherwise. async fn copy_one( &mut self, offset_blk: u64, desc: &RebuildDescriptor, - ) -> Result<(), RebuildError> { + ) -> Result { let iov = desc.adjusted_iov(&self.buffer, offset_blk); let iovs = &mut [iov]; - if desc.read_src_segment(offset_blk, iovs).await? { - desc.write_dst_segment(offset_blk, iovs).await?; + if !desc.read_src_segment(offset_blk, iovs).await? { + // Segment is not allocated in the source, skip the write. + return Ok(false); + } + desc.write_dst_segment(offset_blk, iovs).await?; - if !matches!(desc.options.verify_mode, RebuildVerifyMode::None) { - desc.verify_segment(offset_blk, iovs).await?; - } + if !matches!(desc.options.verify_mode, RebuildVerifyMode::None) { + desc.verify_segment(offset_blk, iovs).await?; } - Ok(()) + Ok(true) } } diff --git a/io-engine/src/subsys/config/pool.rs b/io-engine/src/subsys/config/pool.rs index f0c857abb..9af419185 100644 --- a/io-engine/src/subsys/config/pool.rs +++ b/io-engine/src/subsys/config/pool.rs @@ -209,7 +209,9 @@ struct Replica { share: Option, } -async fn create_pool(args: PoolArgs) -> Result { +async fn create_pool( + args: PoolArgs, +) -> Result { if args.disks.is_empty() { return Err(Status::invalid_argument("Missing devices")); } diff --git a/io-engine/src/subsys/registration/registration_grpc.rs b/io-engine/src/subsys/registration/registration_grpc.rs index 1b82c4857..abf4398a2 100644 --- a/io-engine/src/subsys/registration/registration_grpc.rs +++ b/io-engine/src/subsys/registration/registration_grpc.rs @@ -2,7 +2,7 @@ use futures::{select, FutureExt, StreamExt}; use http::Uri; -use mayastor_api::v1::registration::{ +use io_engine_api::v1::registration::{ registration_client, DeregisterRequest, RegisterRequest, @@ -158,7 +158,7 @@ impl Registration { .clone() .into_iter() .map(|v| { - let api_version: mayastor_api::v1::registration::ApiVersion = + let api_version: io_engine_api::v1::registration::ApiVersion = v.into(); api_version as i32 }) @@ -254,7 +254,7 @@ impl Registration { } } -impl From for mayastor_api::v1::registration::ApiVersion { +impl From for io_engine_api::v1::registration::ApiVersion { fn from(api_version: ApiVersion) -> Self { match api_version { ApiVersion::V0 => Self::V0, diff --git a/io-engine/tests/snapshot_nexus.rs b/io-engine/tests/snapshot_nexus.rs index 8051531e7..79b951721 100755 --- a/io-engine/tests/snapshot_nexus.rs +++ b/io-engine/tests/snapshot_nexus.rs @@ -40,7 +40,7 @@ use io_engine::{ use io_engine_tests::file_io::{test_write_to_file, DataSize}; use nix::errno::Errno; -use mayastor_api::v1::{ +use io_engine_api::v1::{ replica::list_replica_options, snapshot::{ destroy_snapshot_request::Pool, diff --git a/io-engine/tests/wipe.rs b/io-engine/tests/wipe.rs index f63aaf455..84e07e633 100644 --- a/io-engine/tests/wipe.rs +++ b/io-engine/tests/wipe.rs @@ -12,7 +12,7 @@ use io_engine_tests::{ replica::ReplicaBuilder, }; -use mayastor_api::{ +use io_engine_api::{ v1 as v1_rpc, v1::{ replica::Replica, diff --git a/jsonrpc/Cargo.toml b/jsonrpc/Cargo.toml index b16501703..2910b5457 100644 --- a/jsonrpc/Cargo.toml +++ b/jsonrpc/Cargo.toml @@ -9,7 +9,7 @@ nix = "0.27.1" serde = "1.0.188" serde_derive = "1.0.188" serde_json = "1.0.107" -tonic = "0.9.2" +tonic = "0.10.2" tokio = { version = "1.33.0", features = ["full"] } tracing = "0.1.37" diff --git a/nix/pkgs/io-engine/cargo-package.nix b/nix/pkgs/io-engine/cargo-package.nix index 420eb0086..0540b1af9 100644 --- a/nix/pkgs/io-engine/cargo-package.nix +++ b/nix/pkgs/io-engine/cargo-package.nix @@ -51,7 +51,6 @@ let "jsonrpc" "libnvme-rs" "io-engine" - "rpc" "spdk-rs" "sysfs" "utils" diff --git a/rpc/mayastor-api b/rpc/mayastor-api deleted file mode 160000 index 669c958a2..000000000 --- a/rpc/mayastor-api +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 669c958a204b3a42e51aa83e594d9f374664474a diff --git a/test/grpc/grpc_enums.js b/test/grpc/grpc_enums.js index 32bac340d..8c28a5106 100644 --- a/test/grpc/grpc_enums.js +++ b/test/grpc/grpc_enums.js @@ -9,7 +9,7 @@ const constants = {}; const defs = Object.values( grpc.loadPackageDefinition( protoLoader.loadSync( - path.join(__dirname, '..', '..', 'rpc', 'mayastor-api', 'protobuf', 'mayastor.proto'), + path.join(__dirname, '..', '..', 'utils', 'dependencies', 'apis', 'io-engine', 'protobuf', 'mayastor.proto'), { // this is to load google/descriptor.proto includeDirs: ['./node_modules/protobufjs'] diff --git a/test/grpc/test_cli.js b/test/grpc/test_cli.js index 3aeeaf0c4..550a34a94 100644 --- a/test/grpc/test_cli.js +++ b/test/grpc/test_cli.js @@ -40,14 +40,16 @@ function runMockServer (rules) { __dirname, '..', '..', - 'rpc', - 'mayastor-api', + 'utils', + 'dependencies', + 'apis', + 'io-engine', 'protobuf', 'mayastor.proto' ), packageName: 'mayastor', serviceName: 'Mayastor', - rules: rules + rules }); mayastorMockServer.listen('127.0.0.1:' + EGRESS_PORT); diff --git a/test/grpc/test_common.js b/test/grpc/test_common.js index 197b0848b..d38183bf6 100644 --- a/test/grpc/test_common.js +++ b/test/grpc/test_common.js @@ -305,13 +305,15 @@ function createGrpcClient (serviceName = 'Mayastor', endpoint = grpcEndpoint) { __dirname, '..', '..', - 'rpc', - 'mayastor-api', + 'utils', + 'dependencies', + 'apis', + 'io-engine', 'protobuf', 'mayastor.proto' ), packageName: 'mayastor', - serviceName: serviceName, + serviceName, options: { keepCase: true, longs: String, @@ -356,10 +358,10 @@ function createBdevs (bdevs, proto, endpoint, done) { bdevs, (uri, next) => { client.create( - { uri: uri }, + { uri }, (err, res) => { if (err) return next(err); - client.share({ name: res.name, proto: proto }, next); + client.share({ name: res.name, proto }, next); } ); }, diff --git a/test/grpc/test_rebuild.js b/test/grpc/test_rebuild.js index 0164c7592..d57830ab5 100644 --- a/test/grpc/test_rebuild.js +++ b/test/grpc/test_rebuild.js @@ -50,7 +50,7 @@ const childOfflineArgs = { }; function createGrpcClient () { - const PROTO_PATH = path.join(__dirname, '/../../rpc/mayastor-api/protobuf/mayastor.proto'); + const PROTO_PATH = path.join(__dirname, '/../../utils/dependencies/apis/io-engine/protobuf/mayastor.proto'); // Load mayastor proto file with mayastor service const packageDefinition = protoLoader.loadSync(PROTO_PATH, { diff --git a/test/python/README.md b/test/python/README.md index bf80c16ed..589db56de 100644 --- a/test/python/README.md +++ b/test/python/README.md @@ -53,16 +53,16 @@ Not all packages are available on nix, so one extra step is needed if you run nix. ```shell -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf` --python_out=test/python --grpc_python_out=test/python mayastor.proto -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf` --python_out=test/python --grpc_python_out=test/python csi.proto -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf/v1` --python_out=test/python --grpc_python_out=test/python registration.proto -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf/v1` --python_out=test/python --grpc_python_out=test/python host.proto -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf/v1` --python_out=test/python --grpc_python_out=test/python common.proto -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf/v1` --python_out=test/python --grpc_python_out=test/python bdev.proto -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf/v1` --python_out=test/python --grpc_python_out=test/python replica.proto -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf/v1` --python_out=test/python --grpc_python_out=test/python pool.proto -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf/v1` --python_out=test/python --grpc_python_out=test/python nexus.proto -python -m grpc_tools.protoc --proto_path=`realpath rpc/mayastor-api/protobuf/v1` --python_out=test/python --grpc_python_out=test/python snapshot.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf` --python_out=test/python --grpc_python_out=test/python mayastor.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf` --python_out=test/python --grpc_python_out=test/python csi.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf/v1` --python_out=test/python --grpc_python_out=test/python registration.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf/v1` --python_out=test/python --grpc_python_out=test/python host.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf/v1` --python_out=test/python --grpc_python_out=test/python common.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf/v1` --python_out=test/python --grpc_python_out=test/python bdev.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf/v1` --python_out=test/python --grpc_python_out=test/python replica.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf/v1` --python_out=test/python --grpc_python_out=test/python pool.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf/v1` --python_out=test/python --grpc_python_out=test/python nexus.proto +python -m grpc_tools.protoc --proto_path=`realpath utils/dependencies/apis/io-engine/protobuf/v1` --python_out=test/python --grpc_python_out=test/python snapshot.proto virtualenv --no-setuptools test/python/venv source test/python/venv/bin/activate diff --git a/test/python/setup.sh b/test/python/setup.sh index 53803204a..81f776e52 100755 --- a/test/python/setup.sh +++ b/test/python/setup.sh @@ -10,8 +10,8 @@ fi cd "$SRCDIR" -python -m grpc_tools.protoc --proto_path=rpc/mayastor-api/protobuf --grpc_python_out=test/python --python_out=test/python mayastor.proto -python -m grpc_tools.protoc --proto_path=rpc/mayastor-api/protobuf/v1 --grpc_python_out=test/python --python_out=test/python \ +python -m grpc_tools.protoc --proto_path=utils/dependencies/apis/io-engine/protobuf --grpc_python_out=test/python --python_out=test/python mayastor.proto +python -m grpc_tools.protoc --proto_path=utils/dependencies/apis/io-engine/protobuf/v1 --grpc_python_out=test/python --python_out=test/python \ bdev.proto common.proto nexus.proto pool.proto replica.proto host.proto registration.proto snapshot.proto virtualenv --no-setuptools test/python/venv diff --git a/utils/dependencies b/utils/dependencies new file mode 160000 index 000000000..2a43512b9 --- /dev/null +++ b/utils/dependencies @@ -0,0 +1 @@ +Subproject commit 2a43512b95d1974ac85c661d036c0ec389e6fd94 diff --git a/utils/io-engine-dependencies b/utils/io-engine-dependencies deleted file mode 160000 index 236918d70..000000000 --- a/utils/io-engine-dependencies +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 236918d70b137cc0f434af031ae9358c0a54c21e