From 0502b05718868ceb66ca84079ab010f32932e707 Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Wed, 23 Jul 2025 03:09:24 +0000 Subject: [PATCH 1/5] dragonball: Remove `with-serde` feature assertion Code inside `test_mac_addr_serialization_and_deserialization` test does not actually require this `with-serde` feature to test, removing the assertion here to enable this test. Signed-off-by: Ruoqing He --- src/dragonball/dbs_utils/src/net/mac.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dragonball/dbs_utils/src/net/mac.rs b/src/dragonball/dbs_utils/src/net/mac.rs index 1c618694f1..184a2581fb 100644 --- a/src/dragonball/dbs_utils/src/net/mac.rs +++ b/src/dragonball/dbs_utils/src/net/mac.rs @@ -146,7 +146,6 @@ mod tests { assert!(MacAddr::from_bytes(&src3[..]).is_err()); } - #[cfg(feature = "with-serde")] #[test] fn test_mac_addr_serialization_and_deserialization() { let mac: MacAddr = From 225e6fffbc12b9dbb73535fa2cffa3a8f6f90abd Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Wed, 23 Jul 2025 03:16:13 +0000 Subject: [PATCH 2/5] dragonball: Gate `VcpuManagerError` behind `host-device` `VcpuManagerError` is only needed when `host-device` feature is enabled, gate the import behind that feature. Signed-off-by: Ruoqing He --- src/dragonball/src/api/v1/vmm_action.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dragonball/src/api/v1/vmm_action.rs b/src/dragonball/src/api/v1/vmm_action.rs index a0a070dd37..15a16efc3f 100644 --- a/src/dragonball/src/api/v1/vmm_action.rs +++ b/src/dragonball/src/api/v1/vmm_action.rs @@ -17,7 +17,6 @@ use tracing::instrument; use crate::error::{Result, StartMicroVmError, StopMicrovmError}; use crate::event_manager::EventManager; use crate::tracer::{DragonballTracer, TraceError, TraceInfo}; -use crate::vcpu::VcpuManagerError; use crate::vm::{CpuTopology, KernelConfigInfo, VmConfigInfo}; use crate::vmm::Vmm; @@ -55,6 +54,8 @@ pub use crate::device_manager::virtio_net_dev_mgr::{ }; #[cfg(feature = "virtio-vsock")] pub use crate::device_manager::vsock_dev_mgr::{VsockDeviceConfigInfo, VsockDeviceError}; +#[cfg(feature = "host-device")] +use crate::vcpu::VcpuManagerError; #[cfg(feature = "hotplug")] pub use crate::vcpu::{VcpuResizeError, VcpuResizeInfo}; From 5f7da1ccaa511023d5d174a5a033b59d8c372629 Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Wed, 23 Jul 2025 03:23:37 +0000 Subject: [PATCH 3/5] dragonball: Silence never read fields Some fields in structures used for testing purpose are never read, rename to send out the message. Signed-off-by: Ruoqing He --- src/dragonball/dbs_virtio_devices/src/vsock/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dragonball/dbs_virtio_devices/src/vsock/mod.rs b/src/dragonball/dbs_virtio_devices/src/vsock/mod.rs index 433ef46589..40c84a5f57 100644 --- a/src/dragonball/dbs_virtio_devices/src/vsock/mod.rs +++ b/src/dragonball/dbs_virtio_devices/src/vsock/mod.rs @@ -313,8 +313,8 @@ mod tests { pub struct TestContext { pub cid: u64, pub mem: GuestMemoryMmap, - pub mem_size: usize, - pub epoll_manager: EpollManager, + pub _mem_size: usize, + pub _epoll_manager: EpollManager, pub device: Vsock, TestMuxer>, } @@ -327,8 +327,8 @@ mod tests { Self { cid: CID, mem, - mem_size: MEM_SIZE, - epoll_manager: epoll_manager.clone(), + _mem_size: MEM_SIZE, + _epoll_manager: epoll_manager.clone(), device: Vsock::new_with_muxer( CID, Arc::new(defs::QUEUE_SIZES.to_vec()), @@ -394,7 +394,7 @@ mod tests { EventHandlerContext { guest_rxvq, guest_txvq, - guest_evvq, + _guest_evvq: guest_evvq, queues, epoll_handler: None, device: Vsock::new_with_muxer( @@ -422,7 +422,7 @@ mod tests { pub queues: Vec>, pub guest_rxvq: GuestQ<'a>, pub guest_txvq: GuestQ<'a>, - pub guest_evvq: GuestQ<'a>, + pub _guest_evvq: GuestQ<'a>, pub mem: Arc, } From 2e81ac463a260fecf7332a5b0376d6c835bcc845 Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Thu, 24 Jul 2025 05:01:34 +0000 Subject: [PATCH 4/5] dragonball: Allow unused to suppress warnings Some variables went unused if certain features are not enabled, use `#[allow(unused)]` to suppress those warnings at the time being. Signed-off-by: Ruoqing He --- src/dragonball/src/device_manager/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dragonball/src/device_manager/mod.rs b/src/dragonball/src/device_manager/mod.rs index 7d89dcb440..11cb35ddca 100644 --- a/src/dragonball/src/device_manager/mod.rs +++ b/src/dragonball/src/device_manager/mod.rs @@ -879,7 +879,7 @@ impl DeviceManager { /// Start all registered devices when booting the associated virtual machine. pub fn start_devices( &mut self, - vm_as: &GuestAddressSpaceImpl, + #[allow(unused)] vm_as: &GuestAddressSpaceImpl, ) -> std::result::Result<(), StartMicroVmError> { // It is safe because we don't expect poison lock. #[cfg(feature = "host-device")] @@ -899,6 +899,7 @@ impl DeviceManager { address_space: Option<&AddressSpace>, ) -> Result<()> { // create context for removing devices + #[allow(unused)] let mut ctx = DeviceOpContext::new( Some(epoll_mgr), self, From 639273366a79e6ec676339980091fa27515acd6d Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Thu, 24 Jul 2025 05:06:05 +0000 Subject: [PATCH 5/5] dragonball: Gate `MmapRegion` behind `virtio-fs` `MmapRegion` is only used while `virtio-fs` is enabled during testing dragonball, gate the import behind `virtio-fs` feature. Signed-off-by: Ruoqing He --- src/dragonball/src/device_manager/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dragonball/src/device_manager/mod.rs b/src/dragonball/src/device_manager/mod.rs index 11cb35ddca..ea9e8879b5 100644 --- a/src/dragonball/src/device_manager/mod.rs +++ b/src/dragonball/src/device_manager/mod.rs @@ -1276,7 +1276,9 @@ mod tests { use dbs_address_space::{AddressSpaceLayout, AddressSpaceRegion, AddressSpaceRegionType}; use kvm_ioctls::Kvm; use test_utils::skip_if_not_root; - use vm_memory::{GuestAddress, GuestUsize, MmapRegion}; + #[cfg(feature = "virtio-fs")] + use vm_memory::MmapRegion; + use vm_memory::{GuestAddress, GuestUsize}; use super::*; #[cfg(target_arch = "x86_64")]