mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
Revert "vmm: api: Modify FsConfig to be OpenAPI friendly"
This reverts commit defc5dcd9c.
This commit is contained in:
committed by
Rob Bradford
parent
9b1ba14f2d
commit
aa94e9b8f3
@@ -321,13 +321,9 @@ components:
|
|||||||
type: integer
|
type: integer
|
||||||
queue_size:
|
queue_size:
|
||||||
type: integer
|
type: integer
|
||||||
dax:
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
cache_size:
|
cache_size:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
default: 8589934592
|
|
||||||
|
|
||||||
PmemConfig:
|
PmemConfig:
|
||||||
required:
|
required:
|
||||||
|
|||||||
@@ -409,8 +409,7 @@ pub struct FsConfig {
|
|||||||
pub sock: PathBuf,
|
pub sock: PathBuf,
|
||||||
pub num_queues: usize,
|
pub num_queues: usize,
|
||||||
pub queue_size: u16,
|
pub queue_size: u16,
|
||||||
pub dax: bool,
|
pub cache_size: Option<u64>,
|
||||||
pub cache_size: u64,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FsConfig {
|
impl FsConfig {
|
||||||
@@ -445,7 +444,7 @@ impl FsConfig {
|
|||||||
let mut queue_size: u16 = 1024;
|
let mut queue_size: u16 = 1024;
|
||||||
let mut dax: bool = true;
|
let mut dax: bool = true;
|
||||||
// Default cache size set to 8Gib.
|
// Default cache size set to 8Gib.
|
||||||
let mut cache_size: u64 = 0x0002_0000_0000;
|
let mut cache_size: Option<u64> = Some(0x0002_0000_0000);
|
||||||
|
|
||||||
if tag.is_empty() {
|
if tag.is_empty() {
|
||||||
return Err(Error::ParseFsTagParam);
|
return Err(Error::ParseFsTagParam);
|
||||||
@@ -477,9 +476,9 @@ impl FsConfig {
|
|||||||
if !cache_size_str.is_empty() {
|
if !cache_size_str.is_empty() {
|
||||||
return Err(Error::InvalidCacheSizeWithDaxOff);
|
return Err(Error::InvalidCacheSizeWithDaxOff);
|
||||||
}
|
}
|
||||||
cache_size = 0;
|
cache_size = None;
|
||||||
} else if !cache_size_str.is_empty() {
|
} else if !cache_size_str.is_empty() {
|
||||||
cache_size = parse_size(cache_size_str)?;
|
cache_size = Some(parse_size(cache_size_str)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(FsConfig {
|
Ok(FsConfig {
|
||||||
@@ -487,7 +486,6 @@ impl FsConfig {
|
|||||||
sock: PathBuf::from(sock),
|
sock: PathBuf::from(sock),
|
||||||
num_queues,
|
num_queues,
|
||||||
queue_size,
|
queue_size,
|
||||||
dax,
|
|
||||||
cache_size,
|
cache_size,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -974,8 +974,8 @@ impl DeviceManager {
|
|||||||
if let Some(fs_list_cfg) = &vm_info.vm_cfg.lock().unwrap().fs {
|
if let Some(fs_list_cfg) = &vm_info.vm_cfg.lock().unwrap().fs {
|
||||||
for fs_cfg in fs_list_cfg.iter() {
|
for fs_cfg in fs_list_cfg.iter() {
|
||||||
if let Some(fs_sock) = fs_cfg.sock.to_str() {
|
if let Some(fs_sock) = fs_cfg.sock.to_str() {
|
||||||
let cache: Option<(VirtioSharedMemoryList, u64)> = if fs_cfg.dax {
|
let mut cache: Option<(VirtioSharedMemoryList, u64)> = None;
|
||||||
let fs_cache = fs_cfg.cache_size;
|
if let Some(fs_cache) = fs_cfg.cache_size {
|
||||||
// The memory needs to be 2MiB aligned in order to support
|
// The memory needs to be 2MiB aligned in order to support
|
||||||
// hugepages.
|
// hugepages.
|
||||||
let fs_guest_addr = allocator
|
let fs_guest_addr = allocator
|
||||||
@@ -1020,18 +1020,15 @@ impl DeviceManager {
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
len: fs_cache,
|
len: fs_cache,
|
||||||
});
|
});
|
||||||
|
cache = Some((
|
||||||
Some((
|
|
||||||
VirtioSharedMemoryList {
|
VirtioSharedMemoryList {
|
||||||
addr: fs_guest_addr,
|
addr: fs_guest_addr,
|
||||||
len: fs_cache as GuestUsize,
|
len: fs_cache as GuestUsize,
|
||||||
region_list,
|
region_list,
|
||||||
},
|
},
|
||||||
addr as u64,
|
addr as u64,
|
||||||
))
|
));
|
||||||
} else {
|
}
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let virtio_fs_device = vm_virtio::vhost_user::Fs::new(
|
let virtio_fs_device = vm_virtio::vhost_user::Fs::new(
|
||||||
fs_sock,
|
fs_sock,
|
||||||
|
|||||||
Reference in New Issue
Block a user