mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: api: Modify FsConfig to be OpenAPI friendly
When consumer of the HTTP API try to interact with cloud-hypervisor, they have to provide the equivalent of the config structure related to each component they need. Problem is, the Rust enum type "Option" cannot be obtained from the OpenAPI YAML definition. This patch intends to fix this inconsistency between what is possible through the CLI and what's possible through the HTTP API by using simple types bool and int64 instead of Option<u64>. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -958,8 +958,8 @@ impl DeviceManager {
|
||||
if let Some(fs_list_cfg) = &vm_info.vm_cfg.lock().unwrap().fs {
|
||||
for fs_cfg in fs_list_cfg.iter() {
|
||||
if let Some(fs_sock) = fs_cfg.sock.to_str() {
|
||||
let mut cache: Option<(VirtioSharedMemoryList, u64)> = None;
|
||||
if let Some(fs_cache) = fs_cfg.cache_size {
|
||||
let cache: Option<(VirtioSharedMemoryList, u64)> = if fs_cfg.dax {
|
||||
let fs_cache = fs_cfg.cache_size;
|
||||
// The memory needs to be 2MiB aligned in order to support
|
||||
// hugepages.
|
||||
let fs_guest_addr = allocator
|
||||
@@ -1004,15 +1004,18 @@ impl DeviceManager {
|
||||
offset: 0,
|
||||
len: fs_cache,
|
||||
});
|
||||
cache = Some((
|
||||
|
||||
Some((
|
||||
VirtioSharedMemoryList {
|
||||
addr: fs_guest_addr,
|
||||
len: fs_cache as GuestUsize,
|
||||
region_list,
|
||||
},
|
||||
addr as u64,
|
||||
));
|
||||
}
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let virtio_fs_device = vm_virtio::vhost_user::Fs::new(
|
||||
fs_sock,
|
||||
|
||||
Reference in New Issue
Block a user