From 63236de05e57b195503c73e77651cb97bba8a9ec Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Tue, 7 Sep 2021 15:27:18 -0400 Subject: [PATCH] [sled-agent] Add ability to allocate guest-visible NICs (#186) --- Cargo.lock | 496 +++++++++--------- omicron-common/Cargo.toml | 2 +- omicron-common/src/api/internal/sled_agent.rs | 12 +- omicron-common/src/sled_agent_client.rs | 19 +- omicron-nexus/Cargo.toml | 1 + omicron-nexus/src/db/model.rs | 2 +- omicron-nexus/src/nexus.rs | 12 +- omicron-nexus/src/sagas.rs | 10 +- omicron-sled-agent/Cargo.toml | 2 +- omicron-sled-agent/src/bin/sled-agent.rs | 7 +- omicron-sled-agent/src/common/mod.rs | 1 + omicron-sled-agent/src/common/vlan.rs | 41 ++ omicron-sled-agent/src/config.rs | 7 +- omicron-sled-agent/src/http_entrypoints.rs | 8 +- omicron-sled-agent/src/illumos/dladm.rs | 49 +- omicron-sled-agent/src/illumos/zone.rs | 12 +- omicron-sled-agent/src/instance.rs | 281 +++++++--- omicron-sled-agent/src/instance_manager.rs | 86 +-- omicron-sled-agent/src/server.rs | 10 +- .../src/sim/http_entrypoints.rs | 8 +- omicron-sled-agent/src/sim/sled_agent.rs | 5 +- omicron-sled-agent/src/sled_agent.rs | 13 +- smf/propolis-server/manifest.xml | 2 +- 23 files changed, 677 insertions(+), 409 deletions(-) create mode 100644 omicron-sled-agent/src/common/vlan.rs diff --git a/Cargo.lock b/Cargo.lock index aa39ae9320..2cab2ab5c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,9 +22,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.42" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "595d3cfa7a60d4555cb5067b99f07142a08ea778de5cf993f7b75c7d8fabc486" +checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf" [[package]] name = "api_identity" @@ -64,7 +64,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "winapi", ] @@ -110,17 +110,17 @@ dependencies = [ [[package]] name = "bhyve_api" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=b6da043d#b6da043dd8c2a3aef44f84aed1f43c6a7369e77f" +source = "git+https://github.com/oxidecomputer/propolis?rev=bc0661e#bc0661eb0d0c9365bbb69450f3033baabc5b3945" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "num_enum", ] [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" @@ -172,18 +172,18 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" dependencies = [ "serde", ] [[package]] name = "cc" -version = "1.0.68" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" +checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" [[package]] name = "cfg-if" @@ -197,7 +197,7 @@ version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer", "num-traits", "serde", @@ -227,7 +227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" dependencies = [ "core-foundation-sys", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -238,11 +238,11 @@ checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] name = "cpufeatures" -version = "0.1.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -257,9 +257,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -291,9 +291,9 @@ dependencies = [ [[package]] name = "crypto-mac" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" dependencies = [ "generic-array 0.14.4", "subtle", @@ -356,7 +356,7 @@ dependencies = [ "diesel_derives", "ipnetwork", "itoa", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "pq-sys", "r2d2", "serde_json", @@ -413,7 +413,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users", "winapi", ] @@ -421,9 +421,9 @@ dependencies = [ [[package]] name = "dladm" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=b6da043d#b6da043dd8c2a3aef44f84aed1f43c6a7369e77f" +source = "git+https://github.com/oxidecomputer/propolis?rev=bc0661e#bc0661eb0d0c9365bbb69450f3033baabc5b3945" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "num_enum", ] @@ -446,7 +446,7 @@ checksum = "4bb454f0228b18c7f4c3b0ebbee346ed9c52e7443b0999cd543ff3571205701d" [[package]] name = "dropshot" version = "0.5.2-dev" -source = "git+https://github.com/oxidecomputer/dropshot?branch=main#1c6f4d156c670edc6476ca5bcdffc33a7001cbc7" +source = "git+https://github.com/oxidecomputer/dropshot?branch=main#28b04efe999fc6344c39d70225885a86b2de49e2" dependencies = [ "async-trait", "base64", @@ -480,7 +480,7 @@ dependencies = [ [[package]] name = "dropshot_endpoint" version = "0.5.2-dev" -source = "git+https://github.com/oxidecomputer/dropshot?branch=main#1c6f4d156c670edc6476ca5bcdffc33a7001cbc7" +source = "git+https://github.com/oxidecomputer/dropshot?branch=main#28b04efe999fc6344c39d70225885a86b2de49e2" dependencies = [ "proc-macro2", "quote", @@ -551,12 +551,12 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "filetime" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" dependencies = [ "cfg-if", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall", "winapi", ] @@ -615,9 +615,9 @@ checksum = "69a039c3498dc930fe810151a34ba0c1c70b02b8625035592e74432f678591f2" [[package]] name = "futures" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" +checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" dependencies = [ "futures-channel", "futures-core", @@ -630,9 +630,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" +checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" dependencies = [ "futures-core", "futures-sink", @@ -640,15 +640,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" +checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" [[package]] name = "futures-executor" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79" +checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" dependencies = [ "futures-core", "futures-task", @@ -657,15 +657,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" +checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" [[package]] name = "futures-macro" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" +checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ "autocfg", "proc-macro-hack", @@ -676,21 +676,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" +checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" [[package]] name = "futures-task" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" +checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" [[package]] name = "futures-util" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" +checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" dependencies = [ "autocfg", "futures-channel", @@ -733,7 +733,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "wasi", ] @@ -745,9 +745,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "h2" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" +checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472" dependencies = [ "bytes", "fnv", @@ -764,9 +764,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.9.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "heck" @@ -779,11 +779,11 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -802,7 +802,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "match_cfg", "winapi", ] @@ -820,9 +820,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" +checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" dependencies = [ "bytes", "http", @@ -831,9 +831,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" @@ -843,9 +843,9 @@ checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" [[package]] name = "hyper" -version = "0.14.10" +version = "0.14.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7728a72c4c7d72665fde02204bcbd93b247721025b222ef78606f14513e0fd03" +checksum = "13f67199e765030fa08fe0bd581af683f0d5bc04ea09c2b1102012c5fb90e7fd" dependencies = [ "bytes", "futures-channel", @@ -912,9 +912,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", "hashbrown", @@ -932,9 +932,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" dependencies = [ "cfg-if", ] @@ -968,15 +968,15 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "js-sys" -version = "0.3.51" +version = "0.3.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" +checksum = "e4bf49d50e2961077d9c99f4b7997d770a1114f087c3c2e0069b36c13fc2979d" dependencies = [ "wasm-bindgen", ] @@ -989,9 +989,14 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.98" +version = "0.2.101" +source = "git+https://github.com/rust-lang/libc.git?rev=796459785#796459785e5190a02fdf7c223fc8aa91d04306f7" + +[[package]] +name = "libc" +version = "0.2.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" +checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21" [[package]] name = "linked-hash-map" @@ -1001,9 +1006,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" dependencies = [ "scopeguard", ] @@ -1040,9 +1045,9 @@ checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "md-5" @@ -1057,9 +1062,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" @@ -1078,11 +1083,11 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "mio" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" +checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "log", "miow", "ntapi", @@ -1127,12 +1132,12 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" dependencies = [ "lazy_static", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "log", "openssl", "openssl-probe", @@ -1199,14 +1204,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ "hermit-abi", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num_enum" -version = "0.5.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b45a5c2ac4dd696ed30fa6b94b057ad909c7b7fc2e0d0808192bced894066" +checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f" dependencies = [ "derivative", "num_enum_derive", @@ -1214,9 +1219,9 @@ dependencies = [ [[package]] name = "num_enum_derive" -version = "0.5.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c0fd9eba1d5db0994a239e09c1be402d35622277e35468ba891aa5e3188ce7e" +checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1260,7 +1265,7 @@ dependencies = [ "http", "hyper", "ipnet", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "macaddr", "postgres-protocol", "propolis-server", @@ -1307,7 +1312,8 @@ dependencies = [ "hyper", "ipnetwork", "lazy_static", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", + "macaddr", "newtype_derive", "omicron-common", "omicron-sled-agent", @@ -1344,7 +1350,7 @@ dependencies = [ "ipnet", "mockall", "omicron-common", - "propolis-client 0.1.0 (git+https://github.com/oxidecomputer/propolis?rev=3d58a6398)", + "propolis-client", "schemars", "serde", "serde_json", @@ -1360,9 +1366,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "opaque-debug" @@ -1379,7 +1385,7 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openapi-lint" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/openapi-lint?branch=main#cbf584bac7a0eefae46ffc4a0f75bd3c680775f4" +source = "git+https://github.com/oxidecomputer/openapi-lint?branch=main#ca2947b52139b58a3f07cfb17f2257b3ebd50b63" dependencies = [ "indexmap", "openapiv3", @@ -1399,14 +1405,14 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.34" +version = "0.10.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8" +checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" dependencies = [ "bitflags", "cfg-if", "foreign-types", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell", "openssl-sys", ] @@ -1419,13 +1425,13 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.63" +version = "0.9.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b0d6fb7d80f877617dfcb014e605e2b5ab2fb0afdf27935219bb6bd984cb98" +checksum = "1996d2d305e561b70d1ee0c53f1542833f4e1ac6ce9a6708b6ff2738ca67dc82" dependencies = [ "autocfg", "cc", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config", "vcpkg", ] @@ -1469,9 +1475,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", @@ -1480,13 +1486,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ "cfg-if", "instant", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall", "smallvec", "winapi", @@ -1577,18 +1583,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7509cc106041c40a4518d2af7a61530e1eed0e6285296a3d8c5472806ccc4a4" +checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f" +checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" dependencies = [ "proc-macro2", "quote", @@ -1597,9 +1603,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pin-utils" @@ -1682,9 +1688,9 @@ checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451" [[package]] name = "predicates-tree" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2" +checksum = "d7dd0fd014130206c9352efbdc92be592751b2b9274dff685348341082c6ea3d" dependencies = [ "predicates-core", "treeline", @@ -1692,10 +1698,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "0.1.5" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92" dependencies = [ + "thiserror", "toml", ] @@ -1737,9 +1744,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.28" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" +checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" dependencies = [ "unicode-xid", ] @@ -1747,14 +1754,14 @@ dependencies = [ [[package]] name = "propolis" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=b6da043d#b6da043dd8c2a3aef44f84aed1f43c6a7369e77f" +source = "git+https://github.com/oxidecomputer/propolis?rev=bc0661e#bc0661eb0d0c9365bbb69450f3033baabc5b3945" dependencies = [ "bhyve_api", "bitflags", "byteorder", "dladm", "lazy_static", - "libc", + "libc 0.2.101 (git+https://github.com/rust-lang/libc.git?rev=796459785)", "num_enum", "thiserror", "usdt", @@ -1764,23 +1771,7 @@ dependencies = [ [[package]] name = "propolis-client" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=3d58a6398#3d58a6398e08b88db5e9fe60e50ecb5e43a31c82" -dependencies = [ - "reqwest", - "ring", - "schemars", - "serde", - "serde_json", - "slog", - "structopt", - "thiserror", - "uuid", -] - -[[package]] -name = "propolis-client" -version = "0.1.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=b6da043d#b6da043dd8c2a3aef44f84aed1f43c6a7369e77f" +source = "git+https://github.com/oxidecomputer/propolis?rev=bc0661e#bc0661eb0d0c9365bbb69450f3033baabc5b3945" dependencies = [ "reqwest", "ring", @@ -1796,14 +1787,14 @@ dependencies = [ [[package]] name = "propolis-server" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=b6da043d#b6da043dd8c2a3aef44f84aed1f43c6a7369e77f" +source = "git+https://github.com/oxidecomputer/propolis?rev=bc0661e#bc0661eb0d0c9365bbb69450f3033baabc5b3945" dependencies = [ "anyhow", "dropshot", "futures", "hyper", "propolis", - "propolis-client 0.1.0 (git+https://github.com/oxidecomputer/propolis?rev=b6da043d)", + "propolis-client", "serde", "serde_derive", "slog", @@ -1837,11 +1828,11 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha", "rand_core", "rand_hc", @@ -1849,9 +1840,9 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core", @@ -1859,18 +1850,18 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ "getrandom", ] [[package]] name = "rand_hc" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ "rand_core", ] @@ -1902,9 +1893,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" dependencies = [ "bitflags", ] @@ -1991,7 +1982,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ "cc", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell", "spin", "untrusted", @@ -2106,25 +2097,25 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.3.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" +checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" dependencies = [ "bitflags", "core-foundation", "core-foundation-sys", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework-sys", ] [[package]] name = "security-framework-sys" -version = "2.3.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284" +checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" dependencies = [ "core-foundation-sys", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2135,18 +2126,18 @@ checksum = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" [[package]] name = "serde" -version = "1.0.127" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.127" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ "proc-macro2", "quote", @@ -2166,9 +2157,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.64" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +checksum = "a7f9e390c27c3c0ce8bc5d725f6e4d30a29d26659494aa4b17535f7522c5c950" dependencies = [ "itoa", "ryu", @@ -2200,9 +2191,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "1.9.4" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad9fdbb69badc8916db738c25efd04f0a65297d26c2f8de4b62e57b8c12bc72" +checksum = "062b87e45d8f26714eacfaef0ed9a583e2bfd50ebd96bdd3c200733bd5758e2c" dependencies = [ "rustversion", "serde", @@ -2211,9 +2202,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1569374bd54623ec8bd592cf22ba6e03c0f177ff55fbc8c29a49e296e7adecf" +checksum = "98c1fcca18d55d1763e1c16873c4bde0ac3ef75179a28c7b372917e0494625be" dependencies = [ "darling", "proc-macro2", @@ -2223,12 +2214,12 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.17" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" +checksum = "ad104641f3c958dab30eb3010e834c2622d1f3f4c530fef1dee20ad9485f3c09" dependencies = [ "dtoa", - "linked-hash-map", + "indexmap", "serde", "yaml-rust", ] @@ -2269,9 +2260,9 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.6" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ "block-buffer 0.9.0", "cfg-if", @@ -2282,9 +2273,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" +checksum = "9204c41a1597a8c5af23c82d1c921cb01ec0a4c59e07a9c7306062829a3903f3" dependencies = [ "block-buffer 0.9.0", "cfg-if", @@ -2295,11 +2286,11 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "470c5a6397076fae0094aaf06a08e6ba6f37acb77d3b1b91ea92b4d6c8650c39" +checksum = "9c98891d737e271a2954825ef19e46bd16bdb98e2746f2eec4f7a4ef7946efd1" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "signal-hook-registry", ] @@ -2309,7 +2300,7 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2319,22 +2310,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6c5d32165ff8b94e68e7b3bdecb1b082e958c22434b363482cfb89dcd6f3ff8" dependencies = [ "futures-core", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "signal-hook", "tokio", ] [[package]] name = "siphasher" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbce6d4507c7e4a3962091436e56e95290cb71fa302d0d270e32130b75fbff27" +checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" [[package]] name = "slab" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" +checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" [[package]] name = "slog" @@ -2344,9 +2335,9 @@ checksum = "8347046d4ebd943127157b94d63abb990fcf729dc4e9978927fdf4ac3c998d06" [[package]] name = "slog-async" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c60813879f820c85dbc4eabf3269befe374591289019775898d56a81a804fbdc" +checksum = "766c59b252e62a34651412870ff55d8c4e6d04df19b43eecb2703e417b097ffe" dependencies = [ "crossbeam-channel", "slog", @@ -2368,9 +2359,9 @@ dependencies = [ [[package]] name = "slog-json" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" +checksum = "52e9b96fb6b5e80e371423b4aca6656eb537661ce8f82c2697e619f8ca85d043" dependencies = [ "chrono", "serde", @@ -2408,11 +2399,11 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" +checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "winapi", ] @@ -2466,9 +2457,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "structopt" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b041cdcb67226aca307e6e7be44c8806423d83e018bd662360a93dabce4d71" +checksum = "bf9d950ef167e25e0bdb073cf1d68e9ad2795ac826f2f3f59647817cf23c0bfa" dependencies = [ "clap", "lazy_static", @@ -2477,9 +2468,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.15" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7813934aecf5f51a54775e00068c237de98489463968231a51746bbbc03f9c10" +checksum = "134d838a2c9943ac3125cf6df165eda53493451b719f3255b2a26b85f772d0ba" dependencies = [ "heck", "proc-macro-error", @@ -2494,21 +2485,21 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "334b801f9ca2529ba9605109f1d2835f15aff94cd6cfe5afe6ce8cf71e5fd3c4" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "winapi", ] [[package]] name = "subtle" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.74" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" +checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84" dependencies = [ "proc-macro2", "quote", @@ -2517,9 +2508,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +checksum = "474aaa926faa1603c40b7885a9eaea29b444d1cb2850cb7c0e37bb1a4182f4fa" dependencies = [ "proc-macro2", "quote", @@ -2535,12 +2526,12 @@ checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" [[package]] name = "tar" -version = "0.4.35" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d779dc6aeff029314570f666ec83f19df7280bb36ef338442cfa8c604021b80" +checksum = "d6f5515d3add52e0bbdcad7b83c388bb36ba7b754dda3b5f5bc2d38640cdba5c" dependencies = [ "filetime", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "xattr", ] @@ -2551,7 +2542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "rand", "redox_syscall", "remove_dir_all", @@ -2589,18 +2580,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.26" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" +checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.26" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" +checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c" dependencies = [ "proc-macro2", "quote", @@ -2622,16 +2613,16 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "wasi", "winapi", ] [[package]] name = "tinyvec" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" +checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" dependencies = [ "tinyvec_macros", ] @@ -2644,13 +2635,13 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cf844b23c6131f624accf65ce0e4e9956a8bb329400ea5bcc26ae3a5c20b0b" +checksum = "b4efe6fc2395938c8155973d7be49fe8d03a843726e285e100a8a383cc0154ce" dependencies = [ "autocfg", "bytes", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "memchr", "mio", "num_cpus", @@ -2664,9 +2655,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c49e3df43841dafb86046472506755d8501c5615673955f6aa17181125d13c37" +checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" dependencies = [ "proc-macro2", "quote", @@ -2732,9 +2723,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" +checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" dependencies = [ "bytes", "futures-core", @@ -2772,9 +2763,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +checksum = "2ca517f43f0fb96e0c3072ed5c275fe5eece87e8cb52f4a77b69226d3b1c9df8" dependencies = [ "lazy_static", ] @@ -2793,9 +2784,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "trybuild" -version = "1.0.44" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb73edd97c8d9ffa8140971f07307f0994ae95138ee9cc0fba0369c953f0963a" +checksum = "5bdaf2a1d317f3d58b44b31c7f6436b9b9acafe7bddfeace50897c2b804d7792" dependencies = [ "glob", "lazy_static", @@ -2819,7 +2810,7 @@ dependencies = [ "input_buffer", "log", "rand", - "sha-1 0.9.6", + "sha-1 0.9.8", "thiserror", "url", "utf-8", @@ -2827,9 +2818,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.13.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" [[package]] name = "ucd-trie" @@ -2839,12 +2830,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "unicode-bidi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" -dependencies = [ - "matches", -] +checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" [[package]] name = "unicode-normalization" @@ -2857,9 +2845,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" @@ -2911,7 +2899,7 @@ dependencies = [ "byteorder", "dof", "dtrace-parser", - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2", "quote", "serde", @@ -2951,9 +2939,9 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025ce40a007e1907e58d5bc1a594def78e5573bb0b1160bc389634e8f12e4faa" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vec_map" @@ -2970,7 +2958,7 @@ checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] name = "viona_api" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/propolis?rev=b6da043d#b6da043dd8c2a3aef44f84aed1f43c6a7369e77f" +source = "git+https://github.com/oxidecomputer/propolis?rev=bc0661e#bc0661eb0d0c9365bbb69450f3033baabc5b3945" [[package]] name = "walkdir" @@ -3001,9 +2989,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +checksum = "8ce9b1b516211d33767048e5d47fa2a381ed8b76fc48d2ce4aa39877f9f183e0" dependencies = [ "cfg-if", "serde", @@ -3013,9 +3001,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" +checksum = "cfe8dc78e2326ba5f845f4b5bf548401604fa20b1dd1d365fb73b6c1d6364041" dependencies = [ "bumpalo", "lazy_static", @@ -3028,9 +3016,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1" +checksum = "95fded345a6559c2cfee778d562300c581f7d4ff3edb9b0d230d69800d213972" dependencies = [ "cfg-if", "js-sys", @@ -3040,9 +3028,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" +checksum = "44468aa53335841d9d6b6c023eaab07c0cd4bddbcfdee3e2bb1e8d2cb8069fef" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3050,9 +3038,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" +checksum = "0195807922713af1e67dc66132c7328206ed9766af3858164fb583eedc25fbad" dependencies = [ "proc-macro2", "quote", @@ -3063,15 +3051,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" +checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29" [[package]] name = "web-sys" -version = "0.3.51" +version = "0.3.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" +checksum = "224b2f6b67919060055ef1a67807367c2066ed520c3862cc013d26cf893a783c" dependencies = [ "js-sys", "wasm-bindgen", @@ -3142,7 +3130,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc", + "libc 0.2.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3177,9 +3165,9 @@ dependencies = [ [[package]] name = "zone" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f308411d82ac9426366a91b6a6169aa43e3cacdd108a18e4a7522d9ecd4693" +checksum = "3596bbc963cd9dbaa69b02e349af4d061c56c41d211ba64150a2cedb2f722707" dependencies = [ "itertools", "thiserror", diff --git a/omicron-common/Cargo.toml b/omicron-common/Cargo.toml index 3cfba5cd61..68aa7574f3 100644 --- a/omicron-common/Cargo.toml +++ b/omicron-common/Cargo.toml @@ -12,7 +12,7 @@ futures = "0.3.15" http = "0.2.0" hyper = "0.14" libc = "0.2.98" -propolis-server = { git = "https://github.com/oxidecomputer/propolis", rev = "b6da043d" } +propolis-server = { git = "https://github.com/oxidecomputer/propolis", rev = "bc0661e" } postgres-protocol = "0.6.1" rayon = "1.5" reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] } diff --git a/omicron-common/src/api/internal/sled_agent.rs b/omicron-common/src/api/internal/sled_agent.rs index 27653fdde8..6aa7fcc9a8 100644 --- a/omicron-common/src/api/internal/sled_agent.rs +++ b/omicron-common/src/api/internal/sled_agent.rs @@ -1,6 +1,6 @@ //! APIs exposed by Sled Agent. -use crate::api::internal; +use crate::api::{external, internal}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::fmt::{Debug, Display, Formatter, Result as FormatResult}; @@ -39,15 +39,19 @@ impl DiskStateRequested { } } -/// Runtime state of an instance. -pub type InstanceRuntimeState = internal::nexus::InstanceRuntimeState; +/// Describes the instance hardware. +#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] +pub struct InstanceHardware { + pub runtime: internal::nexus::InstanceRuntimeState, + pub nics: Vec, +} /// Sent to a sled agent to establish the runtime state of an Instance #[derive(Serialize, Deserialize, JsonSchema)] pub struct InstanceEnsureBody { /// Last runtime state of the Instance known to Nexus (used if the agent /// has never seen this Instance before). - pub initial_runtime: InstanceRuntimeState, + pub initial: InstanceHardware, /// requested runtime state of the Instance pub target: InstanceRuntimeStateRequested, } diff --git a/omicron-common/src/sled_agent_client.rs b/omicron-common/src/sled_agent_client.rs index 969a4c8e4f..80312d6f8a 100644 --- a/omicron-common/src/sled_agent_client.rs +++ b/omicron-common/src/sled_agent_client.rs @@ -5,12 +5,14 @@ * generated by the server. */ -use crate::api; use crate::api::external::Error; use crate::api::internal::nexus::DiskRuntimeState; +use crate::api::internal::nexus::InstanceRuntimeState; use crate::api::internal::sled_agent::DiskEnsureBody; use crate::api::internal::sled_agent::DiskStateRequested; use crate::api::internal::sled_agent::InstanceEnsureBody; +use crate::api::internal::sled_agent::InstanceHardware; +use crate::api::internal::sled_agent::InstanceRuntimeStateRequested; use crate::http_client::HttpClient; use async_trait::async_trait; use http::Method; @@ -53,16 +55,13 @@ impl Client { pub async fn instance_ensure( self: &Arc, instance_id: Uuid, - initial_runtime: api::internal::sled_agent::InstanceRuntimeState, - target: api::internal::sled_agent::InstanceRuntimeStateRequested, - ) -> Result { + initial: InstanceHardware, + target: InstanceRuntimeStateRequested, + ) -> Result { let path = format!("/instances/{}", instance_id); let body = Body::from( - serde_json::to_string(&InstanceEnsureBody { - initial_runtime, - target, - }) - .unwrap(), + serde_json::to_string(&InstanceEnsureBody { initial, target }) + .unwrap(), ); let mut response = self.client.request(Method::PUT, path.as_str(), body).await?; @@ -70,7 +69,7 @@ impl Client { assert!(response.status().is_success()); let value = self .client - .read_json::( + .read_json::( &self.client.error_message_base(&Method::PUT, path.as_str()), &mut response, ) diff --git a/omicron-nexus/Cargo.toml b/omicron-nexus/Cargo.toml index bbfaa61360..59dbfbf123 100644 --- a/omicron-nexus/Cargo.toml +++ b/omicron-nexus/Cargo.toml @@ -16,6 +16,7 @@ hyper = "0.14" ipnetwork = "0.18" lazy_static = "1.4.0" libc = "0.2.98" +macaddr = { version = "1.0.1", features = [ "serde_std" ]} newtype_derive = "0.1.6" serde_json = "1.0" serde_with = "1.9.4" diff --git a/omicron-nexus/src/db/model.rs b/omicron-nexus/src/db/model.rs index 788e38e952..5005f4325b 100644 --- a/omicron-nexus/src/db/model.rs +++ b/omicron-nexus/src/db/model.rs @@ -382,7 +382,7 @@ impl From for InstanceRuntimeState { /// Conversion to the internal API type. impl Into for InstanceRuntimeState { fn into(self) -> internal::nexus::InstanceRuntimeState { - internal::sled_agent::InstanceRuntimeState { + internal::nexus::InstanceRuntimeState { run_state: *self.state.state(), sled_uuid: self.sled_uuid, ncpus: self.ncpus, diff --git a/omicron-nexus/src/nexus.rs b/omicron-nexus/src/nexus.rs index 0e674d6552..4524f8bb75 100644 --- a/omicron-nexus/src/nexus.rs +++ b/omicron-nexus/src/nexus.rs @@ -39,6 +39,7 @@ use omicron_common::api::internal::nexus::DiskRuntimeState; use omicron_common::api::internal::nexus::OximeterInfo; use omicron_common::api::internal::nexus::ProducerEndpoint; use omicron_common::api::internal::sled_agent::DiskStateRequested; +use omicron_common::api::internal::sled_agent::InstanceHardware; use omicron_common::api::internal::sled_agent::InstanceRuntimeStateRequested; use omicron_common::api::internal::sled_agent::InstanceStateRequested; use omicron_common::bail_unless; @@ -762,8 +763,17 @@ impl Nexus { * not the newest one, that's fine. That might just mean the sled agent * beat us to it. */ + + // TODO: Populate this with an appropriate NIC. + // See also: sic_create_instance_record in sagas.rs for a similar + // construction. + let instance_hardware = InstanceHardware { + runtime: instance.runtime().into(), + nics: vec![], + }; + let new_runtime = sa - .instance_ensure(instance.id, instance.runtime().into(), requested) + .instance_ensure(instance.id, instance_hardware, requested) .await?; self.db_datastore diff --git a/omicron-nexus/src/sagas.rs b/omicron-nexus/src/sagas.rs index 89d3f9e820..53047a466d 100644 --- a/omicron-nexus/src/sagas.rs +++ b/omicron-nexus/src/sagas.rs @@ -16,6 +16,7 @@ use omicron_common::api::external::Generation; use omicron_common::api::external::InstanceCreateParams; use omicron_common::api::external::InstanceState; use omicron_common::api::internal::nexus::InstanceRuntimeState; +use omicron_common::api::internal::sled_agent::InstanceHardware; use omicron_common::api::internal::sled_agent::InstanceRuntimeStateRequested; use omicron_common::api::internal::sled_agent::InstanceStateRequested; use serde::Deserialize; @@ -125,7 +126,7 @@ async fn sic_alloc_server( async fn sic_create_instance_record( sagactx: ActionContext, -) -> Result { +) -> Result { let osagactx = sagactx.user_data(); let params = sagactx.saga_params(); let sled_uuid = sagactx.lookup::("server_id"); @@ -151,7 +152,10 @@ async fn sic_create_instance_record( ) .await .map_err(ActionError::action_failed)?; - Ok(instance.runtime().into()) + + // TODO: Populate this with an appropriate NIC. + // See also: instance_set_runtime in nexus.rs for a similar construction. + Ok(InstanceHardware { runtime: instance.runtime().into(), nics: vec![] }) } async fn sic_instance_ensure( @@ -167,7 +171,7 @@ async fn sic_instance_ensure( let instance_id = sagactx.lookup::("instance_id")?; let sled_uuid = sagactx.lookup::("server_id")?; let initial_runtime = - sagactx.lookup::("initial_runtime")?; + sagactx.lookup::("initial_runtime")?; let sa = osagactx .sled_client(&sled_uuid) .await diff --git a/omicron-sled-agent/Cargo.toml b/omicron-sled-agent/Cargo.toml index 490b98866c..d870170ddf 100644 --- a/omicron-sled-agent/Cargo.toml +++ b/omicron-sled-agent/Cargo.toml @@ -13,7 +13,7 @@ http = "0.2.0" hyper = "0.14" ipnet = "2.3" omicron-common = { path = "../omicron-common" } -propolis-client = { git = "https://github.com/oxidecomputer/propolis", rev = "3d58a6398" } +propolis-client = { git = "https://github.com/oxidecomputer/propolis", rev = "bc0661e" } schemars = { version = "0.8", features = [ "chrono", "uuid" ] } serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" diff --git a/omicron-sled-agent/src/bin/sled-agent.rs b/omicron-sled-agent/src/bin/sled-agent.rs index 101aa5ad09..2df5f8381a 100644 --- a/omicron-sled-agent/src/bin/sled-agent.rs +++ b/omicron-sled-agent/src/bin/sled-agent.rs @@ -5,6 +5,7 @@ use dropshot::ConfigLogging; use dropshot::ConfigLoggingLevel; use omicron_common::cmd::fatal; use omicron_common::cmd::CmdError; +use omicron_sled_agent::common::vlan::VlanID; use omicron_sled_agent::config::Config; use omicron_sled_agent::server::{run_openapi, run_server}; use std::net::SocketAddr; @@ -29,6 +30,9 @@ enum Args { #[structopt(name = "NEXUS_IP:PORT", parse(try_from_str))] nexus_addr: SocketAddr, + + #[structopt(long = "vlan")] + vlan: Option, }, } @@ -46,7 +50,7 @@ async fn do_run() -> Result<(), CmdError> { match args { Args::OpenApi => run_openapi().map_err(CmdError::Failure), - Args::Run { uuid, sled_agent_addr, nexus_addr } => { + Args::Run { uuid, sled_agent_addr, nexus_addr, vlan } => { let config = Config { id: uuid, nexus_address: nexus_addr, @@ -57,6 +61,7 @@ async fn do_run() -> Result<(), CmdError> { log: ConfigLogging::StderrTerminal { level: ConfigLoggingLevel::Info, }, + vlan, }; run_server(&config).await.map_err(CmdError::Failure) } diff --git a/omicron-sled-agent/src/common/mod.rs b/omicron-sled-agent/src/common/mod.rs index 3834c63549..a419e2329c 100644 --- a/omicron-sled-agent/src/common/mod.rs +++ b/omicron-sled-agent/src/common/mod.rs @@ -2,3 +2,4 @@ pub mod disk; pub mod instance; +pub mod vlan; diff --git a/omicron-sled-agent/src/common/vlan.rs b/omicron-sled-agent/src/common/vlan.rs new file mode 100644 index 0000000000..49db81bbe7 --- /dev/null +++ b/omicron-sled-agent/src/common/vlan.rs @@ -0,0 +1,41 @@ +//! VLAN ID wrapper. + +use omicron_common::api::external::Error; +use std::fmt; +use std::str::FromStr; + +/// The maximum VLAN value (inclusive), as specified by IEEE 802.1Q. +pub const VLAN_MAX: u16 = 4094; + +/// Wrapper around a VLAN ID, ensuring it is valid. +#[derive(Debug, Clone, Copy)] +pub struct VlanID(u16); + +impl VlanID { + /// Creates a new VLAN ID, returning an error if it is out of range. + pub fn new(id: u16) -> Result { + if VLAN_MAX < id { + return Err(Error::InvalidValue { + label: id.to_string(), + message: "Invalid VLAN value".to_string(), + }); + } + Ok(Self(id)) + } +} + +impl fmt::Display for VlanID { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.0.to_string()) + } +} + +impl FromStr for VlanID { + type Err = Error; + fn from_str(s: &str) -> Result { + Self::new(s.parse().map_err(|e| Error::InvalidValue { + label: s.to_string(), + message: format!("{}", e), + })?) + } +} diff --git a/omicron-sled-agent/src/config.rs b/omicron-sled-agent/src/config.rs index b3e5e9f477..3ae08e50ef 100644 --- a/omicron-sled-agent/src/config.rs +++ b/omicron-sled-agent/src/config.rs @@ -1,14 +1,13 @@ //! Interfaces for working with sled agent configuration +use crate::common::vlan::VlanID; use dropshot::ConfigDropshot; use dropshot::ConfigLogging; -use serde::Deserialize; -use serde::Serialize; use std::net::SocketAddr; use uuid::Uuid; /// Configuration for a sled agent -#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +#[derive(Clone, Debug)] pub struct Config { /// Unique id for the sled pub id: Uuid, @@ -18,4 +17,6 @@ pub struct Config { pub dropshot: ConfigDropshot, /// Configuration for the sled agent debug log pub log: ConfigLogging, + /// Optional VLAN ID to be used for tagging guest VNICs. + pub vlan: Option, } diff --git a/omicron-sled-agent/src/http_entrypoints.rs b/omicron-sled-agent/src/http_entrypoints.rs index 72ea0c0e5a..8f3473fd03 100644 --- a/omicron-sled-agent/src/http_entrypoints.rs +++ b/omicron-sled-agent/src/http_entrypoints.rs @@ -54,12 +54,8 @@ async fn instance_put( let instance_id = path_params.into_inner().instance_id; let body_args = body.into_inner(); Ok(HttpResponseOk( - sa.instance_ensure( - instance_id, - body_args.initial_runtime.clone(), - body_args.target.clone(), - ) - .await?, + sa.instance_ensure(instance_id, body_args.initial, body_args.target) + .await?, )) } diff --git a/omicron-sled-agent/src/illumos/dladm.rs b/omicron-sled-agent/src/illumos/dladm.rs index 504d4e8237..8e91319ed9 100644 --- a/omicron-sled-agent/src/illumos/dladm.rs +++ b/omicron-sled-agent/src/illumos/dladm.rs @@ -1,11 +1,16 @@ //! Utilities for poking at data links. +use crate::common::vlan::VlanID; use crate::illumos::{execute, PFEXEC}; use omicron_common::api::external::Error; +use omicron_common::api::external::MacAddr; pub const VNIC_PREFIX: &str = "vnic_propolis"; +pub const DLADM: &str = "/usr/sbin/dladm"; -const DLADM: &str = "/usr/sbin/dladm"; +/// The name of a physical datalink. +#[derive(Debug, Clone)] +pub struct PhysicalLink(pub String); /// Wraps commands for interacting with data links. pub struct Dladm {} @@ -13,11 +18,11 @@ pub struct Dladm {} #[cfg_attr(test, mockall::automock, allow(dead_code))] impl Dladm { /// Returns the name of the first observed physical data link. - pub fn find_physical() -> Result { + pub fn find_physical() -> Result { let mut command = std::process::Command::new(PFEXEC); let cmd = command.args(&[DLADM, "show-phys", "-p", "-o", "LINK"]); let output = execute(cmd)?; - Ok(String::from_utf8(output.stdout) + let name = String::from_utf8(output.stdout) .map_err(|e| Error::InternalError { message: format!("Cannot parse dladm output as UTF-8: {}", e), })? @@ -30,14 +35,44 @@ impl Dladm { .ok_or_else(|| Error::InternalError { message: "No physical devices found".to_string(), })? - .to_string()) + .to_string(); + Ok(PhysicalLink(name)) } /// Creates a new VNIC atop a physical device. - pub fn create_vnic(physical: &str, vnic_name: &str) -> Result<(), Error> { + /// + /// * `physical`: The physical link on top of which a device will be + /// created. + /// * `vnic_name`: Exact name of the VNIC to be created. + /// * `mac`: An optional unicast MAC address for the newly created NIC. + /// * `vlan`: An optional VLAN ID for VLAN tagging. + pub fn create_vnic( + physical: &PhysicalLink, + vnic_name: &str, + mac: Option, + vlan: Option, + ) -> Result<(), Error> { let mut command = std::process::Command::new(PFEXEC); - let cmd = - command.args(&[DLADM, "create-vnic", "-l", physical, vnic_name]); + let mut args = vec![ + DLADM.to_string(), + "create-vnic".to_string(), + "-t".to_string(), + "-l".to_string(), + physical.0.to_string(), + ]; + + if let Some(mac) = mac { + args.push("-m".to_string()); + args.push(mac.0.to_string()); + } + + if let Some(vlan) = vlan { + args.push("-v".to_string()); + args.push(vlan.to_string()); + } + + args.push(vnic_name.to_string()); + let cmd = command.args(&args); execute(cmd)?; Ok(()) } diff --git a/omicron-sled-agent/src/illumos/zone.rs b/omicron-sled-agent/src/illumos/zone.rs index c69dcd5fc7..bc5ee961e2 100644 --- a/omicron-sled-agent/src/illumos/zone.rs +++ b/omicron-sled-agent/src/illumos/zone.rs @@ -122,7 +122,7 @@ impl Zones { pub fn configure_child_zone( log: &Logger, name: &str, - vnic: &str, + vnics: Vec, ) -> Result<(), Error> { info!(log, "Creating child zone: {}", name); let mut cfg = zone::Config::create( @@ -141,10 +141,12 @@ impl Zones { options: vec!["ro".to_string()], ..Default::default() }); - cfg.add_net(&zone::Net { - physical: vnic.to_string(), - ..Default::default() - }); + for vnic in &vnics { + cfg.add_net(&zone::Net { + physical: vnic.to_string(), + ..Default::default() + }); + } cfg.add_device(&zone::Device { name: "/dev/vmm/*".to_string() }); cfg.add_device(&zone::Device { name: "/dev/vmmctl".to_string() }); cfg.add_device(&zone::Device { name: "/dev/viona".to_string() }); diff --git a/omicron-sled-agent/src/instance.rs b/omicron-sled-agent/src/instance.rs index 1c352de388..f15aa62df7 100644 --- a/omicron-sled-agent/src/instance.rs +++ b/omicron-sled-agent/src/instance.rs @@ -1,12 +1,21 @@ //! API for controlling a single instance. -use crate::common::instance::{Action as InstanceAction, InstanceStates}; +use crate::common::{ + instance::{Action as InstanceAction, InstanceStates}, + vlan::VlanID, +}; use crate::illumos::svc::wait_for_service; -use crate::illumos::{dladm::VNIC_PREFIX, zone::ZONE_PREFIX}; -use crate::instance_manager::InstanceTicket; +use crate::illumos::{ + dladm::{PhysicalLink, VNIC_PREFIX}, + zone::ZONE_PREFIX, +}; +use crate::instance_manager::{IdAllocator, InstanceTicket}; use futures::lock::Mutex; use omicron_common::api::external::Error; +use omicron_common::api::external::MacAddr; +use omicron_common::api::external::NetworkInterface; use omicron_common::api::internal::nexus::InstanceRuntimeState; +use omicron_common::api::internal::sled_agent::InstanceHardware; use omicron_common::api::internal::sled_agent::InstanceRuntimeStateRequested; use omicron_common::dev::poll; use propolis_client::Client as PropolisClient; @@ -79,8 +88,12 @@ fn zone_name(id: &Uuid) -> String { format!("{}{}", ZONE_PREFIX, id) } -fn vnic_name(runtime_id: u64) -> String { - format!("{}{}", VNIC_PREFIX, runtime_id) +fn vnic_name(id: u64) -> String { + format!("{}{}", VNIC_PREFIX, id) +} + +fn guest_vnic_name(id: u64) -> String { + format!("{}_guest{}", VNIC_PREFIX, id) } fn interface_name(vnic_name: &str) -> String { @@ -126,13 +139,78 @@ impl Drop for RunningState { } } +/// Represents an allocated VNIC on the system. +/// The VNIC is de-allocated when it goes out of scope. +/// +/// Note that the "ownership" of the VNIC is based on convention; +/// another process in the global zone could also modify / destroy +/// the VNIC while this object is alive. +#[derive(Debug)] +struct Vnic { + name: String, + deleted: bool, +} + +impl Vnic { + // Creates a new NIC, intended for usage by the guest. + fn new_guest( + allocator: &IdAllocator, + physical_dl: &PhysicalLink, + mac: Option, + vlan: Option, + ) -> Result { + let name = guest_vnic_name(allocator.next()); + Dladm::create_vnic(physical_dl, &name, mac, vlan)?; + Ok(Vnic { name, deleted: false }) + } + + // Creates a new NIC, intended for allowing Propolis to communicate + // with the control plane. + fn new_control( + allocator: &IdAllocator, + physical_dl: &PhysicalLink, + mac: Option, + ) -> Result { + let name = vnic_name(allocator.next()); + Dladm::create_vnic(physical_dl, &name, mac, None)?; + Ok(Vnic { name, deleted: false }) + } + + // Deletes a NIC (if it has not already been deleted). + fn delete(&mut self) -> Result<(), Error> { + if self.deleted { + Ok(()) + } else { + self.deleted = true; + Dladm::delete_vnic(&self.name) + } + } +} + +impl Drop for Vnic { + fn drop(&mut self) { + let _ = self.delete(); + } +} + struct InstanceInner { log: Logger, - runtime_id: u64, + + // Properties visible to Propolis properties: propolis_client::api::InstanceProperties, + + // NIC-related properties + nic_id_allocator: IdAllocator, + requested_nics: Vec, + allocated_nics: Vec, + vlan: Option, + + // Internal State management state: InstanceStates, - nexus_client: Arc, running_state: Option, + + // Connection to Nexus + nexus_client: Arc, } impl InstanceInner { @@ -157,7 +235,7 @@ impl InstanceInner { // Notify Nexus of the state change. self.nexus_client - .notify_instance_updated(&self.properties.id, self.state.current()) + .notify_instance_updated(self.id(), self.state.current()) .await?; // Take the next action, if any. @@ -176,17 +254,31 @@ impl InstanceInner { .as_ref() .expect("Propolis client should be initialized before usage") .client - .instance_state_put(self.properties.id, request) + .instance_state_put(*self.id(), request) .await .map_err(|e| Error::InternalError { message: format!("Failed to set state of instance: {}", e), }) } - async fn ensure(&self) -> Result<(), Error> { + async fn ensure(&self, guest_nics: &Vec) -> Result<(), Error> { + // TODO: Store slot in NetworkInterface, make this more stable. + let nics = self + .requested_nics + .iter() + .enumerate() + .map(|(i, _)| propolis_client::api::NetworkInterfaceRequest { + name: guest_nics[i].name.clone(), + slot: propolis_client::api::Slot(i as u8), + }) + .collect(); + let request = propolis_client::api::InstanceEnsureRequest { properties: self.properties.clone(), + nics, }; + + info!(self.log, "Sending ensure request to propolis: {:?}", request); self.running_state .as_ref() .expect("Propolis client should be initialized before usage") @@ -242,8 +334,9 @@ mockall::mock! { pub fn new( log: Logger, id: Uuid, - runtime_id: u64, - initial_runtime: InstanceRuntimeState, + nic_id_allocator: IdAllocator, + initial: InstanceHardware, + vlan: Option, nexus_client: Arc, ) -> Result; pub async fn start(&self, ticket: InstanceTicket) -> Result<(), Error>; @@ -259,40 +352,48 @@ mockall::mock! { impl Instance { /// Creates a new (not yet running) instance object. - + /// /// Arguments: /// * `log`: Logger for dumping debug information. /// * `id`: UUID of the instance to be created. - /// * `runtime_id`: A unique (to the sled) numeric ID which may be used to + /// * `nic_id_allocator`: A unique (to the sled) ID generator to /// refer to a VNIC. (This exists because of a restriction on VNIC name /// lengths, otherwise the UUID would be used instead). - /// * `initial_runtime`: State of the instance at initialization time. + /// * `initial`: State of the instance at initialization time. /// * `nexus_client`: Connection to Nexus, used for sending notifications. + /// * `vlan`: An optional VLAN ID for tagging guest VNICs. + // TODO: This arg list is getting a little long; can we clean this up? pub fn new( log: Logger, id: Uuid, - runtime_id: u64, - initial_runtime: InstanceRuntimeState, + nic_id_allocator: IdAllocator, + initial: InstanceHardware, + vlan: Option, nexus_client: Arc, ) -> Result { + info!(log, "Instance::new w/initial HW: {:?}", initial); let instance = InstanceInner { log: log.new(o!("instance id" => id.to_string())), - runtime_id, // NOTE: Mostly lies. properties: propolis_client::api::InstanceProperties { id, - name: initial_runtime.hostname.clone(), + name: initial.runtime.hostname.clone(), description: "Test description".to_string(), image_id: Uuid::nil(), bootrom_id: Uuid::nil(), - memory: initial_runtime.memory.to_bytes(), + // TODO: Align the byte type w/propolis. + memory: initial.runtime.memory.to_whole_mebibytes(), // TODO: we should probably make propolis aligned with // InstanceCpuCount here, to avoid any casting... - vcpus: initial_runtime.ncpus.0 as u8, + vcpus: initial.runtime.ncpus.0 as u8, }, - state: InstanceStates::new(initial_runtime), - nexus_client, + nic_id_allocator, + requested_nics: initial.nics, + allocated_nics: vec![], + vlan, + state: InstanceStates::new(initial.runtime), running_state: None, + nexus_client, }; let inner = Arc::new(Mutex::new(instance)); @@ -303,48 +404,75 @@ impl Instance { /// Begins the execution of the instance's service (Propolis). pub async fn start(&self, ticket: InstanceTicket) -> Result<(), Error> { let mut inner = self.inner.lock().await; - let log = &inner.log; // Create the VNIC which will be attached to the zone. - let physical_dl = Dladm::find_physical()?; - info!(log, "Saw physical DL: {}", physical_dl); - + // // It would be preferable to use the UUID of the instance as a component // of the "per-Zone, control plane VNIC", but VNIC names are somewhat // restrictive. They must end with numerics, and they must be less than // 32 characters. // - // Instead, we just use a per-agent incrementing number. - let vnic_name = vnic_name(inner.runtime_id); - Dladm::create_vnic(&physical_dl, &vnic_name)?; - info!(log, "Created vnic: {}", vnic_name); + // Instead, we just use a per-agent incrementing number. We do the same + // for the guest-accessible NICs too. + let physical_dl = Dladm::find_physical()?; + let control_nic = + Vnic::new_control(&inner.nic_id_allocator, &physical_dl, None)?; + + // Instantiate all guest-requested VNICs. + // + // TODO: Ideally, we'd allocate VNICs directly within the Zone. + // However, this seems to have been a SmartOS feature which + // doesn't exist in illumos. + // + // https://github.com/illumos/ipd/blob/master/ipd/0003/README.md + let guest_nics = inner + .requested_nics + .clone() + .into_iter() + .map(|nic| { + Vnic::new_guest( + &inner.nic_id_allocator, + &physical_dl, + Some(nic.mac), + inner.vlan, + ) + }) + .collect::, Error>>()?; // Create a zone for the propolis instance, using the previously - // configured VNIC. + // configured VNICs. let zname = zone_name(inner.id()); - Zones::configure_child_zone(&log, &zname, &vnic_name)?; - info!(log, "Configured child zone: {}", zname); + + let nics_to_put_in_zone: Vec = guest_nics + .iter() + .map(|nic| nic.name.clone()) + .chain(std::iter::once(control_nic.name.clone())) + .collect(); + + Zones::configure_child_zone(&inner.log, &zname, nics_to_put_in_zone)?; + info!(inner.log, "Configured child zone: {}", zname); // Clone the zone from a base zone (faster than installing) and // boot it up. Zones::clone_from_base(&zname)?; - info!(log, "Cloned child zone: {}", zname); + info!(inner.log, "Cloned child zone: {}", zname); Zones::boot(&zname)?; - info!(log, "Booted zone: {}", zname); + info!(inner.log, "Booted zone: {}", zname); // Wait for the network services to come online, then create an address. wait_for_service(Some(&zname), "svc:/milestone/network:default") .await?; - info!(log, "Network milestone ready for {}", zname); + info!(inner.log, "Network milestone ready for {}", zname); - let ip = Zones::create_address(&zname, &interface_name(&vnic_name))?; - info!(log, "Created address {} for zone: {}", ip, zname); + let ip = + Zones::create_address(&zname, &interface_name(&control_nic.name))?; + info!(inner.log, "Created address {} for zone: {}", ip, zname); // Run Propolis in the Zone. let port = 12400; let server_addr = SocketAddr::new(ip.addr(), port); Zones::run_propolis(&zname, inner.id(), &server_addr)?; - info!(log, "Started propolis in zone: {}", zname); + info!(inner.log, "Started propolis in zone: {}", zname); // This isn't strictly necessary - we wait for the HTTP server below - // but it helps distinguish "online in SMF" from "responding to HTTP @@ -354,20 +482,20 @@ impl Instance { let client = Arc::new(PropolisClient::new( server_addr, - log.new(o!("component" => "propolis-client")), + inner.log.new(o!("component" => "propolis-client")), )); // Although the instance is online, the HTTP server may not be running // yet. Wait for it to respond to requests, so users of the instance // don't need to worry about initialization races. - wait_for_http_server(&log, &client).await?; + wait_for_http_server(&inner.log, &client).await?; inner.running_state = Some(RunningState { client, ticket, monitor_task: None }); // Ensure the instance exists in the Propolis Server before we start // using it. - inner.ensure().await?; + inner.ensure(&guest_nics).await?; // Monitor propolis for state changes in the background. let self_clone = self.clone(); @@ -381,6 +509,12 @@ impl Instance { } })); + // Store the VNICs while the instance is running. + inner.allocated_nics = guest_nics + .into_iter() + .chain(std::iter::once(control_nic)) + .collect(); + Ok(()) } @@ -391,8 +525,18 @@ impl Instance { let zname = zone_name(inner.id()); warn!(inner.log, "Halting and removing zone: {}", zname); Zones::halt_and_remove(&inner.log, &zname).unwrap(); - let vnic_name = vnic_name(inner.runtime_id); - Dladm::delete_vnic(&vnic_name)?; + + // Explicitly remove NICs. + // + // The NICs would self-delete on drop anyway, but this allows us + // to explicitly record errors. + let mut nics = vec![]; + std::mem::swap(&mut inner.allocated_nics, &mut nics); + for mut nic in nics { + if let Err(e) = nic.delete() { + error!(inner.log, "Failed to delete NIC {:?}: {}", nic, e); + } + } inner.running_state.as_mut().unwrap().ticket.terminate(); Ok(()) @@ -535,6 +679,7 @@ mod test { if let Some(server) = server.as_ref() { if server.id == id { + // TODO: Patch this up with real values let instance_info = api::Instance { properties: api::InstanceProperties { id, @@ -679,15 +824,15 @@ mod test { .expect() .times(1) .in_sequence(&mut seq) - .returning(|| Ok("physical".to_string())); + .returning(|| Ok(PhysicalLink("physical".to_string()))); let dladm_create_vnic_ctx = MockDladm::create_vnic_context(); dladm_create_vnic_ctx .expect() .times(1) .in_sequence(&mut seq) - .returning(|phys, vnic| { - assert_eq!(phys, "physical"); + .returning(|phys, vnic, _maybe_mac, _maybe_vlan| { + assert_eq!(phys.0, "physical"); assert_eq!(vnic, vnic_name(0)); Ok(()) }); @@ -698,9 +843,10 @@ mod test { .expect() .times(1) .in_sequence(&mut seq) - .returning(|_, zone, vnic| { + .returning(|_, zone, vnics| { assert_eq!(zone, zone_name(&test_uuid())); - assert_eq!(vnic, vnic_name(0)); + assert_eq!(vnics.len(), 1); + assert_eq!(vnics[0], vnic_name(0)); Ok(()) }); @@ -808,15 +954,18 @@ mod test { .unwrap() } - fn new_runtime_state() -> InstanceRuntimeState { - InstanceRuntimeState { - run_state: InstanceState::Creating, - sled_uuid: Uuid::new_v4(), - ncpus: InstanceCpuCount(2), - memory: ByteCount::from_mebibytes_u32(512), - hostname: "myvm".to_string(), - gen: Generation::new(), - time_updated: Utc::now(), + fn new_initial_instance() -> InstanceHardware { + InstanceHardware { + runtime: InstanceRuntimeState { + run_state: InstanceState::Creating, + sled_uuid: Uuid::new_v4(), + ncpus: InstanceCpuCount(2), + memory: ByteCount::from_mebibytes_u32(512), + hostname: "myvm".to_string(), + gen: Generation::new(), + time_updated: Utc::now(), + }, + nics: vec![], } } @@ -836,7 +985,7 @@ mod test { #[serial_test::serial] async fn start_then_stop() { let log = logger(); - let runtime_id = 0; + let nic_id_allocator = IdAllocator::new(); let mut nexus_client = MockNexusClient::default(); // Set expectations about what will be seen (and when) by Nexus before @@ -865,8 +1014,9 @@ mod test { let inst = Instance::new( log.clone(), test_uuid(), - runtime_id, - new_runtime_state(), + nic_id_allocator, + new_initial_instance(), + None, Arc::new(nexus_client), ) .unwrap(); @@ -913,14 +1063,15 @@ mod test { )] async fn transition_before_start() { let log = logger(); - let runtime_id = 0; + let nic_id_allocator = IdAllocator::new(); let nexus_client = MockNexusClient::default(); let inst = Instance::new( log.clone(), test_uuid(), - runtime_id, - new_runtime_state(), + nic_id_allocator, + new_initial_instance(), + None, Arc::new(nexus_client), ) .unwrap(); diff --git a/omicron-sled-agent/src/instance_manager.rs b/omicron-sled-agent/src/instance_manager.rs index 3173ed9a27..0f7be0f8cf 100644 --- a/omicron-sled-agent/src/instance_manager.rs +++ b/omicron-sled-agent/src/instance_manager.rs @@ -1,8 +1,10 @@ //! API for controlling multiple instances on a sled. +use crate::common::vlan::VlanID; use crate::illumos::zfs::ZONE_ZFS_DATASET; use omicron_common::api::external::Error; use omicron_common::api::internal::nexus::InstanceRuntimeState; +use omicron_common::api::internal::sled_agent::InstanceHardware; use omicron_common::api::internal::sled_agent::InstanceRuntimeStateRequested; use slog::Logger; use std::collections::BTreeMap; @@ -31,6 +33,23 @@ use crate::{ instance::MockInstance as Instance, }; +/// A shareable wrapper around an atomic counter. +/// May be used to allocate runtime-unique IDs. +#[derive(Clone, Debug)] +pub struct IdAllocator { + value: Arc, +} + +impl IdAllocator { + pub fn new() -> Self { + Self { value: Arc::new(AtomicU64::new(0)) } + } + + pub fn next(&self) -> u64 { + self.value.fetch_add(1, Ordering::SeqCst) + } +} + struct InstanceManagerInternal { log: Logger, nexus_client: Arc, @@ -40,7 +59,8 @@ struct InstanceManagerInternal { // if the Propolis client hasn't been initialized. instances: Mutex>, - next_id: AtomicU64, + vlan: Option, + nic_id_allocator: IdAllocator, } /// All instances currently running on the sled. @@ -52,6 +72,7 @@ impl InstanceManager { /// Initializes a new [`InstanceManager`] object. pub fn new( log: Logger, + vlan: Option, nexus_client: Arc, ) -> Result { // Before we start creating instances, we need to ensure that the @@ -91,18 +112,19 @@ impl InstanceManager { log, nexus_client, instances: Mutex::new(BTreeMap::new()), - next_id: AtomicU64::new(1), + vlan, + nic_id_allocator: IdAllocator::new(), }), }) } /// Idempotently ensures that the given Instance (described by - /// `initial_runtime`) exists on this server in the given runtime state + /// `initial_hardware`) exists on this server in the given runtime state /// (described by `target`). pub async fn ensure( &self, instance_id: Uuid, - initial_runtime: InstanceRuntimeState, + initial_hardware: InstanceHardware, target: InstanceRuntimeStateRequested, ) -> Result { info!( @@ -128,8 +150,9 @@ impl InstanceManager { Instance::new( instance_log, instance_id, - self.inner.next_id.fetch_add(1, Ordering::SeqCst), - initial_runtime, + self.inner.nic_id_allocator.clone(), + initial_hardware, + self.inner.vlan, self.inner.nexus_client.clone(), )?, ); @@ -219,15 +242,18 @@ mod test { .unwrap() } - fn new_runtime_state() -> InstanceRuntimeState { - InstanceRuntimeState { - run_state: InstanceState::Creating, - sled_uuid: Uuid::new_v4(), - ncpus: InstanceCpuCount(2), - memory: ByteCount::from_mebibytes_u32(512), - hostname: "myvm".to_string(), - gen: Generation::new(), - time_updated: Utc::now(), + fn new_initial_instance() -> InstanceHardware { + InstanceHardware { + runtime: InstanceRuntimeState { + run_state: InstanceState::Creating, + sled_uuid: Uuid::new_v4(), + ncpus: InstanceCpuCount(2), + memory: ByteCount::from_mebibytes_u32(512), + hostname: "myvm".to_string(), + gen: Generation::new(), + time_updated: Utc::now(), + }, + nics: vec![], } } @@ -256,7 +282,7 @@ mod test { let dladm_get_vnics_ctx = MockDladm::get_vnics_context(); dladm_get_vnics_ctx.expect().return_once(|| Ok(vec![])); - let im = InstanceManager::new(log, nexus_client).unwrap(); + let im = InstanceManager::new(log, None, nexus_client).unwrap(); // Verify that no instances exist. assert!(im.inner.instances.lock().unwrap().is_empty()); @@ -273,7 +299,7 @@ mod test { let ticket = Arc::new(std::sync::Mutex::new(None)); let ticket_clone = ticket.clone(); let instance_new_ctx = MockInstance::new_context(); - instance_new_ctx.expect().return_once(move |_, _, _, _, _| { + instance_new_ctx.expect().return_once(move |_, _, _, _, _, _| { let mut inst = MockInstance::default(); inst.expect_clone().return_once(move || { let mut inst = MockInstance::default(); @@ -285,9 +311,9 @@ mod test { Ok(()) }); inst.expect_transition().return_once(|_| { - let mut rt_state = new_runtime_state(); - rt_state.run_state = InstanceState::Running; - Ok(rt_state) + let mut rt_state = new_initial_instance(); + rt_state.runtime.run_state = InstanceState::Running; + Ok(rt_state.runtime) }); inst }); @@ -296,7 +322,7 @@ mod test { let rt_state = im .ensure( test_uuid(), - new_runtime_state(), + new_initial_instance(), InstanceRuntimeStateRequested { run_state: InstanceStateRequested::Running, }, @@ -338,13 +364,13 @@ mod test { let dladm_get_vnics_ctx = MockDladm::get_vnics_context(); dladm_get_vnics_ctx.expect().return_once(|| Ok(vec![])); - let im = InstanceManager::new(log, nexus_client).unwrap(); + let im = InstanceManager::new(log, None, nexus_client).unwrap(); let ticket = Arc::new(std::sync::Mutex::new(None)); let ticket_clone = ticket.clone(); let instance_new_ctx = MockInstance::new_context(); let mut seq = mockall::Sequence::new(); - instance_new_ctx.expect().return_once(move |_, _, _, _, _| { + instance_new_ctx.expect().return_once(move |_, _, _, _, _, _| { let mut inst = MockInstance::default(); // First call to ensure (start + transition). inst.expect_clone().times(1).in_sequence(&mut seq).return_once( @@ -356,9 +382,9 @@ mod test { Ok(()) }); inst.expect_transition().return_once(|_| { - let mut rt_state = new_runtime_state(); - rt_state.run_state = InstanceState::Running; - Ok(rt_state) + let mut rt_state = new_initial_instance(); + rt_state.runtime.run_state = InstanceState::Running; + Ok(rt_state.runtime) }); inst }, @@ -368,9 +394,9 @@ mod test { move || { let mut inst = MockInstance::default(); inst.expect_transition().returning(|_| { - let mut rt_state = new_runtime_state(); - rt_state.run_state = InstanceState::Running; - Ok(rt_state) + let mut rt_state = new_initial_instance(); + rt_state.runtime.run_state = InstanceState::Running; + Ok(rt_state.runtime) }); inst }, @@ -379,7 +405,7 @@ mod test { }); let id = test_uuid(); - let rt = new_runtime_state(); + let rt = new_initial_instance(); let target = InstanceRuntimeStateRequested { run_state: InstanceStateRequested::Running, }; diff --git a/omicron-sled-agent/src/server.rs b/omicron-sled-agent/src/server.rs index 71ff3949fc..b670f34caf 100644 --- a/omicron-sled-agent/src/server.rs +++ b/omicron-sled-agent/src/server.rs @@ -39,9 +39,13 @@ impl Server { "component" => "SledAgent", "server" => config.id.clone().to_string() )); - let sled_agent = - SledAgent::new(&config.id, sa_log, nexus_client.clone()) - .map_err(|e| e.to_string())?; + let sled_agent = SledAgent::new( + &config.id, + sa_log, + config.vlan, + nexus_client.clone(), + ) + .map_err(|e| e.to_string())?; let dropshot_log = log.new(o!("component" => "dropshot")); let http_server = dropshot::HttpServerStarter::new( diff --git a/omicron-sled-agent/src/sim/http_entrypoints.rs b/omicron-sled-agent/src/sim/http_entrypoints.rs index b553bc7dd2..9a17456be6 100644 --- a/omicron-sled-agent/src/sim/http_entrypoints.rs +++ b/omicron-sled-agent/src/sim/http_entrypoints.rs @@ -63,12 +63,8 @@ async fn instance_put( let instance_id = path_params.into_inner().instance_id; let body_args = body.into_inner(); Ok(HttpResponseOk( - sa.instance_ensure( - instance_id, - body_args.initial_runtime.clone(), - body_args.target.clone(), - ) - .await?, + sa.instance_ensure(instance_id, body_args.initial, body_args.target) + .await?, )) } diff --git a/omicron-sled-agent/src/sim/sled_agent.rs b/omicron-sled-agent/src/sim/sled_agent.rs index da2cc48ba5..13bf5430dc 100644 --- a/omicron-sled-agent/src/sim/sled_agent.rs +++ b/omicron-sled-agent/src/sim/sled_agent.rs @@ -6,6 +6,7 @@ use omicron_common::api::external::Error; use omicron_common::api::internal::nexus::DiskRuntimeState; use omicron_common::api::internal::nexus::InstanceRuntimeState; use omicron_common::api::internal::sled_agent::DiskStateRequested; +use omicron_common::api::internal::sled_agent::InstanceHardware; use omicron_common::api::internal::sled_agent::InstanceRuntimeStateRequested; use omicron_common::NexusClient; use slog::Logger; @@ -76,12 +77,12 @@ impl SledAgent { pub async fn instance_ensure( self: &Arc, instance_id: Uuid, - initial_runtime: InstanceRuntimeState, + initial_hardware: InstanceHardware, target: InstanceRuntimeStateRequested, ) -> Result { Ok(self .instances - .sim_ensure(&instance_id, initial_runtime, target) + .sim_ensure(&instance_id, initial_hardware.runtime, target) .await?) } diff --git a/omicron-sled-agent/src/sled_agent.rs b/omicron-sled-agent/src/sled_agent.rs index 5c5d6d0f12..f19056512d 100644 --- a/omicron-sled-agent/src/sled_agent.rs +++ b/omicron-sled-agent/src/sled_agent.rs @@ -1,9 +1,10 @@ //! Sled agent implementation -use omicron_common::api::external::Error; use omicron_common::api::{ - internal::nexus::DiskRuntimeState, internal::nexus::InstanceRuntimeState, + external::Error, internal::nexus::DiskRuntimeState, + internal::nexus::InstanceRuntimeState, internal::sled_agent::DiskStateRequested, + internal::sled_agent::InstanceHardware, internal::sled_agent::InstanceRuntimeStateRequested, }; @@ -16,6 +17,7 @@ use crate::mocks::MockNexusClient as NexusClient; #[cfg(not(test))] use omicron_common::NexusClient; +use crate::common::vlan::VlanID; use crate::instance_manager::InstanceManager; /// Describes an executing Sled Agent object. @@ -30,12 +32,13 @@ impl SledAgent { pub fn new( id: &Uuid, log: Logger, + vlan: Option, nexus_client: Arc, ) -> Result { info!(&log, "created sled agent"; "id" => ?id); Ok(SledAgent { - instances: InstanceManager::new(log.clone(), nexus_client)?, + instances: InstanceManager::new(log.clone(), vlan, nexus_client)?, }) } @@ -43,10 +46,10 @@ impl SledAgent { pub async fn instance_ensure( &self, instance_id: Uuid, - initial_runtime: InstanceRuntimeState, + initial: InstanceHardware, target: InstanceRuntimeStateRequested, ) -> Result { - self.instances.ensure(instance_id, initial_runtime, target).await + self.instances.ensure(instance_id, initial, target).await } /// Idempotently ensures that the given Disk is attached (or not) as diff --git a/smf/propolis-server/manifest.xml b/smf/propolis-server/manifest.xml index f838f4b89e..a3e23ea51f 100644 --- a/smf/propolis-server/manifest.xml +++ b/smf/propolis-server/manifest.xml @@ -15,7 +15,7 @@