Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ and this project adheres to

### Changed

- [#5595](https://github.com/firecracker-microvm/firecracker/pull/5595): Added
`vsock_type` field to the vsock device API to denote the type of the
underlying socket. Can be `stream` or `seqpacket`
- [#5564](https://github.com/firecracker-microvm/firecracker/pull/5564): which
added support for VMClock, uses one extra GSI for the VMClock device itself
which reduces the available GSIs for VirtIO devices. New maximum values is 92
Expand Down
82 changes: 46 additions & 36 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ or_fun_call = "warn"

[profile.dev]
panic = "abort"
incremental = true

[profile.release]
panic = "abort"
Expand Down
2 changes: 1 addition & 1 deletion src/firecracker/src/api_server/parsed_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ pub mod tests {
fn test_try_from_put_vsock() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
let body = "{ \"vsock_id\": \"string\", \"guest_cid\": 0, \"uds_path\": \"string\" }";
let body = "{ \"vsock_id\": \"string\", \"guest_cid\": 0, \"uds_path\": \"string\", \"vsock_type\": \"stream\" }";
sender
.write_all(http_request("PUT", "/vsock", Some(body)).as_bytes())
.unwrap();
Expand Down
9 changes: 6 additions & 3 deletions src/firecracker/src/api_server/request/vsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ mod tests {
fn test_parse_put_vsock_request() {
let body = r#"{
"guest_cid": 42,
"uds_path": "vsock.sock"
"uds_path": "vsock.sock",
"vsock_type": "stream"
}"#;
parse_put_vsock(&Body::new(body)).unwrap();

Expand All @@ -57,7 +58,8 @@ mod tests {
let body = r#"{
"vsock_id": "foo",
"guest_cid": 42,
"uds_path": "vsock.sock"
"uds_path": "vsock.sock",
"vsock_type": "stream"
}"#;
depr_action_from_req(
parse_put_vsock(&Body::new(body)).unwrap(),
Expand All @@ -66,7 +68,8 @@ mod tests {

let body = r#"{
"guest_cid": 42,
"uds_path": "vsock.sock"
"uds_path": "vsock.sock",
"vsock_type": "stream"
}"#;
let (_, mut parsing_info) = parse_put_vsock(&Body::new(body)).unwrap().into_parts();
assert!(parsing_info.take_deprecation_message().is_none());
Expand Down
7 changes: 7 additions & 0 deletions src/firecracker/swagger/firecracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1779,6 +1779,13 @@ definitions:
uds_path:
type: string
description: Path to UNIX domain socket, used to proxy vsock connections.
vsock_type:
description: Enumeration indicating the type of the underlying socket (stream or seqpacket)
type: string
enum:
- stream
- seqpacket
default: stream
vsock_id:
type: string
description:
Expand Down
1 change: 1 addition & 0 deletions src/vmm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ serde = { version = "1.0.228", features = ["derive", "rc"] }
serde_json = "1.0.149"
slab = "0.4.11"
thiserror = "2.0.17"
uds = "0.4.2"
userfaultfd = "0.9.0"
utils = { path = "../utils" }
uuid = "1.19.0"
Expand Down
2 changes: 1 addition & 1 deletion src/vmm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ pub(crate) mod tests {
vsock_config: VsockDeviceConfig,
) {
let vsock_dev_id = VSOCK_DEV_ID.to_owned();
let vsock = VsockBuilder::create_unixsock_vsock(vsock_config).unwrap();
let vsock = VsockBuilder::create_unixsock_vsock(&vsock_config).unwrap();
let vsock = Arc::new(Mutex::new(vsock));

attach_unixsock_vsock_device(
Expand Down
6 changes: 4 additions & 2 deletions src/vmm/src/device_manager/pci_mngr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ mod tests {
use crate::vmm_config::memory_hotplug::MemoryHotplugConfig;
use crate::vmm_config::net::NetworkInterfaceConfig;
use crate::vmm_config::pmem::PmemConfig;
use crate::vmm_config::vsock::VsockDeviceConfig;
use crate::vmm_config::vsock::{VsockDeviceConfig, VsockType};

#[test]
fn test_device_manager_persistence() {
Expand Down Expand Up @@ -723,6 +723,7 @@ mod tests {
vsock_id: Some(vsock_dev_id.to_string()),
guest_cid: 3,
uds_path: tmp_sock_file.as_path().to_str().unwrap().to_string(),
vsock_type: VsockType::Stream,
};
insert_vsock_device(&mut vmm, &mut cmdline, &mut event_manager, vsock_config);
// Add an entropy device.
Expand Down Expand Up @@ -835,7 +836,8 @@ mod tests {
],
"vsock": {{
"guest_cid": 3,
"uds_path": "{}"
"uds_path": "{}",
"vsock_type": "stream"
}},
"entropy": {{
"rate_limiter": null
Expand Down
6 changes: 4 additions & 2 deletions src/vmm/src/device_manager/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ mod tests {
use crate::vmm_config::memory_hotplug::MemoryHotplugConfig;
use crate::vmm_config::net::NetworkInterfaceConfig;
use crate::vmm_config::pmem::PmemConfig;
use crate::vmm_config::vsock::VsockDeviceConfig;
use crate::vmm_config::vsock::{VsockDeviceConfig, VsockType};

impl<T> PartialEq for VirtioDeviceState<T> {
fn eq(&self, other: &VirtioDeviceState<T>) -> bool {
Expand Down Expand Up @@ -735,6 +735,7 @@ mod tests {
vsock_id: Some(vsock_dev_id.to_string()),
guest_cid: 3,
uds_path: tmp_sock_file.as_path().to_str().unwrap().to_string(),
vsock_type: VsockType::Stream,
};
insert_vsock_device(&mut vmm, &mut cmdline, &mut event_manager, vsock_config);
// Add an entropy device.
Expand Down Expand Up @@ -843,7 +844,8 @@ mod tests {
],
"vsock": {{
"guest_cid": 3,
"uds_path": "{}"
"uds_path": "{}",
"vsock_type": "stream"
}},
"entropy": {{
"rate_limiter": null
Expand Down
3 changes: 2 additions & 1 deletion src/vmm/src/devices/virtio/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ mod tests {
use crate::devices::virtio::transport::mmio::tests::DummyDevice;
use crate::devices::virtio::vsock::{Vsock, VsockUnixBackend};
use crate::snapshot::Snapshot;
use crate::vmm_config::vsock::VsockType;

const DEFAULT_QUEUE_MAX_SIZE: u16 = 256;
impl Default for QueueState {
Expand Down Expand Up @@ -500,7 +501,7 @@ mod tests {
// Remove the file so the path can be used by the socket.
temp_uds_path.remove().unwrap();
let uds_path = String::from(temp_uds_path.as_path().to_str().unwrap());
let backend = VsockUnixBackend::new(guest_cid, uds_path).unwrap();
let backend = VsockUnixBackend::new(guest_cid, uds_path, VsockType::Stream).unwrap();
let vsock = Vsock::new(guest_cid, backend).unwrap();
let vsock = Arc::new(Mutex::new(vsock));
let mmio_transport =
Expand Down
Loading