mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-25 14:18:54 +00:00
runtime-rs: Add BlockModern arm in DeviceManager
Add BlockModern handling in DeviceManager so that device index is correctly released both in get_device_info and in the error path. Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
committed by
Fabiano Fidêncio
parent
7da2ad712a
commit
65d580c2b0
@@ -167,6 +167,13 @@ impl DeviceManager {
|
||||
self.shared_info
|
||||
.release_device_index(device.config.index, false);
|
||||
}
|
||||
DeviceType::BlockModern(device) => {
|
||||
let (index, is_pmem) = {
|
||||
let cfg = &device.lock().await.config;
|
||||
(cfg.index, cfg.driver_option == *KATA_NVDIMM_DEV_TYPE)
|
||||
};
|
||||
self.shared_info.release_device_index(index, is_pmem);
|
||||
}
|
||||
_ => {
|
||||
debug!(sl!(), "no need to do release device index.");
|
||||
}
|
||||
@@ -191,12 +198,15 @@ impl DeviceManager {
|
||||
Ok(index) => {
|
||||
if let Some(i) = index {
|
||||
// release the declared device index
|
||||
let is_pmem =
|
||||
if let DeviceType::Block(blk) = device_guard.get_device_info().await {
|
||||
let is_pmem = match device_guard.get_device_info().await {
|
||||
DeviceType::Block(blk) => {
|
||||
blk.config.driver_option == *KATA_NVDIMM_DEV_TYPE
|
||||
} else {
|
||||
false
|
||||
};
|
||||
}
|
||||
DeviceType::BlockModern(dev) => {
|
||||
dev.lock().await.config.driver_option == *KATA_NVDIMM_DEV_TYPE
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
self.shared_info.release_device_index(i, is_pmem);
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user