Skip to content

vsock saga, episode 1: vhost-free vsock device #1106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,4 @@ panic = "abort"
lto = true
panic = "abort"

[features]
vsock = ["api_server/vsock", "jailer/vsock"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How difficult would it be to keep the vsock-vhost implementation as an alternative to vsock-unixsockets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, aside from the considerable implementation and maintenance effort, supporting two different implementations for the same feature would not really align well with our tenets.


[workspace]
3 changes: 0 additions & 3 deletions api_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,3 @@ kernel = { path = "../kernel" }
memory_model = { path = "../memory_model" }
net_util = { path = "../net_util" }
rate_limiter = { path = "../rate_limiter" }

[features]
vsock = ["vmm/vsock"]
3 changes: 0 additions & 3 deletions api_server/src/http_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use vmm::vmm_config::instance_info::InstanceInfo;
use vmm::vmm_config::logger::LoggerConfig;
use vmm::vmm_config::machine_config::VmConfig;
use vmm::vmm_config::net::{NetworkInterfaceConfig, NetworkInterfaceUpdateConfig};
#[cfg(feature = "vsock")]
use vmm::vmm_config::vsock::VsockDeviceConfig;
use vmm::VmmAction;

Expand Down Expand Up @@ -365,7 +364,6 @@ fn parse_netif_req<'a>(path: &'a str, method: Method, body: &Chunk) -> Result<'a
}
}

#[cfg(feature = "vsock")]
// Turns a GET/PUT /vsocks HTTP request into a ParsedRequest.
fn parse_vsocks_req<'a>(path: &'a str, method: Method, body: &Chunk) -> Result<'a, ParsedRequest> {
let path_tokens: Vec<&str> = path[1..].split_terminator('/').collect();
Expand Down Expand Up @@ -432,7 +430,6 @@ fn parse_request<'a>(method: Method, path: &'a str, body: &Chunk) -> Result<'a,
"machine-config" => parse_machine_config_req(path, method, body),
"network-interfaces" => parse_netif_req(path, method, body),
"mmds" => parse_mmds_request(path, method, body),
#[cfg(feature = "vsock")]
"vsocks" => parse_vsocks_req(path, method, body),
_ => Err(Error::InvalidPathMethod(path, method)),
}
Expand Down
1 change: 0 additions & 1 deletion api_server/src/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub mod drive;
pub mod logger;
pub mod machine_configuration;
pub mod net;
#[cfg(feature = "vsock")]
pub mod vsock;

use serde_json::Value;
Expand Down
5 changes: 3 additions & 2 deletions api_server/src/request/vsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl IntoParsedRequest for VsockDeviceConfig {
_: Method,
) -> result::Result<ParsedRequest, String> {
let id_from_path = id_from_path.unwrap_or_default();
if id_from_path != self.id.as_str() {
if id_from_path != self.vsock_id.as_str() {
return Err(String::from(
"The id from the path does not match the id from the body!",
));
Expand All @@ -38,8 +38,9 @@ mod tests {
#[test]
fn test_vsock_into_parsed_request() {
let vsock = VsockDeviceConfig {
id: String::from("foo"),
vsock_id: String::from("foo"),
guest_cid: 42,
uds_path: "vsock.sock".to_string(),
};
assert!(vsock
.clone()
Expand Down
Loading