mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 13:11:31 +00:00
feature(krata): first pass on cpu hotplug support (#340)
* fix(runtime): adjust memory resources inside a transaction * feature(krata): first pass on cpu hotplug support
This commit is contained in:
@ -27,6 +27,7 @@ async fn main() -> Result<()> {
|
||||
base: BaseDomainConfig {
|
||||
uuid: Uuid::new_v4(),
|
||||
max_vcpus: 1,
|
||||
target_vcpus: 1,
|
||||
max_mem_mb: 512,
|
||||
target_mem_mb: 512,
|
||||
enable_iommu: true,
|
||||
|
@ -194,7 +194,16 @@ impl ClientTransaction {
|
||||
self.tx.mkdir(&path).await?;
|
||||
self.tx.set_perms(&path, ro_perm).await?;
|
||||
let path = format!("{}/cpu/{}/availability", self.dom_path, i);
|
||||
self.tx.write_string(&path, "online").await?;
|
||||
self.tx
|
||||
.write_string(
|
||||
&path,
|
||||
if i < base.target_vcpus {
|
||||
"online"
|
||||
} else {
|
||||
"offline"
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
self.tx.set_perms(&path, ro_perm).await?;
|
||||
}
|
||||
Ok(())
|
||||
|
@ -9,6 +9,8 @@ use xencall::XenCall;
|
||||
|
||||
use crate::error::Result;
|
||||
|
||||
pub const XEN_EXTRA_MEMORY_KB: u64 = 2048;
|
||||
|
||||
pub struct BaseDomainManager<P: BootSetupPlatform> {
|
||||
call: XenCall,
|
||||
pub platform: Arc<P>,
|
||||
@ -29,7 +31,7 @@ impl<P: BootSetupPlatform> BaseDomainManager<P> {
|
||||
let domid = self.call.create_domain(domain).await?;
|
||||
self.call.set_max_vcpus(domid, config.max_vcpus).await?;
|
||||
self.call
|
||||
.set_max_mem(domid, (config.max_mem_mb * 1024) + 2048)
|
||||
.set_max_mem(domid, (config.max_mem_mb * 1024) + XEN_EXTRA_MEMORY_KB)
|
||||
.await?;
|
||||
let loader = ElfImageLoader::load_file_kernel(&config.kernel)?;
|
||||
let platform = (*self.platform).clone();
|
||||
@ -64,6 +66,7 @@ pub struct BaseDomainConfig {
|
||||
pub uuid: Uuid,
|
||||
pub owner_domid: u32,
|
||||
pub max_vcpus: u32,
|
||||
pub target_vcpus: u32,
|
||||
pub max_mem_mb: u64,
|
||||
pub target_mem_mb: u64,
|
||||
pub kernel: Vec<u8>,
|
||||
|
Reference in New Issue
Block a user