Skip to content

Commit

Permalink
runtime-rs: fix ci complains
Browse files Browse the repository at this point in the history
vfio commits introduce quite a lot change in runtime-rs, this commit is
for all the changes related to ci, including compilation errors and so on.

Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
  • Loading branch information
studychao committed Dec 28, 2023
1 parent f9e0a4b commit e69c9eb
Show file tree
Hide file tree
Showing 11 changed files with 386 additions and 18 deletions.
320 changes: 312 additions & 8 deletions src/agent/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/dragonball/src/api/v1/vmm_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub use crate::device_manager::fs_dev_mgr::{
#[cfg(feature = "virtio-mem")]
pub use crate::device_manager::mem_dev_mgr::{MemDeviceConfigInfo, MemDeviceError};
#[cfg(feature = "host-device")]
use crate::device_manager::vfio_dev_mgr::{HostDeviceConfig, VfioDeviceError, VfioDeviceHostInfo};
use crate::device_manager::vfio_dev_mgr::{HostDeviceConfig, VfioDeviceError};
#[cfg(feature = "vhost-net")]
pub use crate::device_manager::vhost_net_dev_mgr::{
VhostNetDeviceConfigInfo, VhostNetDeviceError, VhostNetDeviceMgr,
Expand Down Expand Up @@ -871,7 +871,7 @@ impl VmmService {
.vfio_manager
.lock()
.unwrap()
.insert_device(&mut ctx, config.into())
.insert_device(&mut ctx, config)
.map_err(VmmActionError::HostDeviceConfig)?;
Ok(VmmData::Empty)
}
Expand Down
2 changes: 1 addition & 1 deletion src/dragonball/src/dbs_device/src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ pub(crate) mod tests {
resource.append(entry.clone());
assert_eq!(entry, resource[6]);

let entry = Resource::MacAddresss(MAC_ADDRESS.to_string());
let entry = Resource::MacAddress(MAC_ADDRESS.to_string());
resource.append(entry.clone());
assert_eq!(entry, resource[7]);

Expand Down
2 changes: 1 addition & 1 deletion src/dragonball/src/dbs_pci/src/vfio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl Interrupt {

fn get_irq_pin(&self) -> u32 {
if let Some(legacy_irq) = self.legacy_irq {
(PciInterruptPin::IntA as u32) << 8 | self.legacy_irq.unwrap()
(PciInterruptPin::IntA as u32) << 8 | legacy_irq
} else {
0
}
Expand Down
16 changes: 12 additions & 4 deletions src/dragonball/src/device_manager/vfio_dev_mgr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use dbs_pci::ECAM_SPACE_LENGTH;
use dbs_pci::{VfioPciDevice, VENDOR_NVIDIA};
use dbs_upcall::{DevMgrResponse, UpcallClientResponse};
use kvm_ioctls::{DeviceFd, VmFd};
use log::error;
use log::{debug, error};
use serde_derive::{Deserialize, Serialize};
use vfio_ioctls::{VfioContainer, VfioDevice};
use vm_memory::{
Expand Down Expand Up @@ -116,6 +116,10 @@ pub enum VfioDeviceError {
#[error("failure while allocate device resource: {0:?}")]
AllocateDeviceResource(#[source] ResourceError),

/// Failed to free device resource
#[error("failure while freeing device resource: {0:?}")]
FreeDeviceResource(#[source] ResourceError),

/// Vfio container not found
#[error("vfio container not found")]
VfioContainerNotFound,
Expand Down Expand Up @@ -364,8 +368,10 @@ impl VfioDeviceMgr {
error!("send upcall result failed, due to {:?}!", e);
}
}
#[cfg(test)]
UpcallClientResponse::FakeResponse => {}
#[allow(unreachable_patterns)]
_ => {
debug!("this arm should only be triggered under test");
}
}));
ctx.remove_hotplug_pci_device(dev, callback)
.map_err(VfioDeviceError::VfioDeviceMgr)?
Expand Down Expand Up @@ -678,7 +684,9 @@ impl VfioDeviceMgr {
resources
};

ctx.res_manager.free_device_resources(&filtered_resources);
ctx.res_manager
.free_device_resources(&filtered_resources)
.map_err(VfioDeviceError::FreeDeviceResource)?;

vfio_pci_device
.clear_device()
Expand Down
1 change: 1 addition & 0 deletions src/dragonball/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub mod tests {
sockets: 1,
},
vpmu_feature: 0,
pci_hotplug_enabled: false,
};
vm.set_vm_config(vm_config);
vm.init_guest_memory().unwrap();
Expand Down
2 changes: 2 additions & 0 deletions src/dragonball/src/vcpu/vcpu_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ mod tests {
sockets: 1,
},
vpmu_feature: 0,
pci_hotplug_enabled: false,
};
vm.set_vm_config(vm_config);
vm.init_guest_memory().unwrap();
Expand Down Expand Up @@ -1181,6 +1182,7 @@ mod tests {
sockets: 1,
},
vpmu_feature: 0,
pci_hotplug_enabled: false,
};
vm.set_vm_config(vm_config.clone());
vm.init_guest_memory().unwrap();
Expand Down
1 change: 1 addition & 0 deletions src/dragonball/src/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ pub struct Vm {
shared_info: Arc<RwLock<InstanceInfo>>,

address_space: AddressSpaceMgr,
/// device manager for Dragonball
pub device_manager: DeviceManager,
dmesg_fifo: Option<Box<dyn io::Write + Send>>,
kernel_config: Option<KernelConfigInfo>,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/kata-types/src/annotations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ impl Annotation {
}
// Hypervisor Memory related annotations
KATA_ANNO_CFG_HYPERVISOR_DEFAULT_MEMORY => {
match byte_unit::Byte::parse_str(value,true) {
match byte_unit::Byte::parse_str(value, true) {
Ok(mem_bytes) => {
let memory_size = mem_bytes
.get_adjusted_unit(byte_unit::Unit::MiB)
Expand Down
52 changes: 52 additions & 0 deletions src/runtime-rs/Cargo.lock

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

2 changes: 1 addition & 1 deletion src/runtime-rs/crates/hypervisor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ kata-types = { path = "../../../libs/kata-types" }
logging = { path = "../../../libs/logging" }
shim-interface = { path = "../../../libs/shim-interface" }

dragonball = { path = "../../../dragonball", features = ["atomic-guest-memory", "virtio-vsock", "hotplug", "virtio-blk", "virtio-net", "virtio-fs", "vhost-net", "dbs-upcall","virtio-mem", "virtio-balloon", "vhost-user-net"] }
dragonball = { path = "../../../dragonball", features = ["atomic-guest-memory", "virtio-vsock", "hotplug", "virtio-blk", "virtio-net", "virtio-fs", "vhost-net", "dbs-upcall", "virtio-mem", "virtio-balloon", "vhost-user-net", "host-device"] }

ch-config = { path = "ch-config", optional = true }
tests_utils = { path = "../../tests/utils" }
Expand Down

0 comments on commit e69c9eb

Please sign in to comment.