mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 13:11:31 +00:00
@ -27,7 +27,8 @@ async fn main() -> Result<()> {
|
||||
base: BaseDomainConfig {
|
||||
uuid: Uuid::new_v4(),
|
||||
max_vcpus: 1,
|
||||
mem_mb: 512,
|
||||
max_mem_mb: 512,
|
||||
target_mem_mb: 512,
|
||||
enable_iommu: true,
|
||||
kernel: fs::read(&kernel_image_path).await?,
|
||||
initrd: fs::read(&initrd_path).await?,
|
||||
|
@ -156,13 +156,13 @@ impl ClientTransaction {
|
||||
self.tx
|
||||
.write_string(
|
||||
format!("{}/memory/static-max", self.dom_path).as_str(),
|
||||
&(base.mem_mb * 1024).to_string(),
|
||||
&(base.max_mem_mb * 1024).to_string(),
|
||||
)
|
||||
.await?;
|
||||
self.tx
|
||||
.write_string(
|
||||
format!("{}/memory/target", self.dom_path).as_str(),
|
||||
&(base.mem_mb * 1024).to_string(),
|
||||
&(base.target_mem_mb * 1024).to_string(),
|
||||
)
|
||||
.await?;
|
||||
self.tx
|
||||
|
@ -162,11 +162,13 @@ impl<I: BootImageLoader, P: BootSetupPlatform> BootSetup<I, P> {
|
||||
pub async fn initialize(
|
||||
&mut self,
|
||||
initrd: &[u8],
|
||||
mem_mb: u64,
|
||||
target_mem_mb: u64,
|
||||
max_mem_mb: u64,
|
||||
max_vcpus: u32,
|
||||
cmdline: &str,
|
||||
) -> Result<BootDomain> {
|
||||
let total_pages = mem_mb << (20 - self.platform.page_shift());
|
||||
let target_pages = target_mem_mb << (20 - self.platform.page_shift());
|
||||
let total_pages = max_mem_mb << (20 - self.platform.page_shift());
|
||||
let image_info = self.image_loader.parse(self.platform.hvm()).await?;
|
||||
let mut domain = BootDomain {
|
||||
domid: self.domid,
|
||||
@ -175,7 +177,7 @@ impl<I: BootImageLoader, P: BootSetupPlatform> BootSetup<I, P> {
|
||||
virt_pgtab_end: 0,
|
||||
pfn_alloc_end: 0,
|
||||
total_pages,
|
||||
target_pages: total_pages,
|
||||
target_pages,
|
||||
page_size: self.platform.page_size(),
|
||||
image_info,
|
||||
console_evtchn: 0,
|
||||
|
@ -29,7 +29,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.mem_mb * 1024) + 2048)
|
||||
.set_max_mem(domid, (config.max_mem_mb * 1024) + 2048)
|
||||
.await?;
|
||||
let loader = ElfImageLoader::load_file_kernel(&config.kernel)?;
|
||||
let platform = (*self.platform).clone();
|
||||
@ -37,7 +37,8 @@ impl<P: BootSetupPlatform> BaseDomainManager<P> {
|
||||
let mut domain = boot
|
||||
.initialize(
|
||||
&config.initrd,
|
||||
config.mem_mb,
|
||||
config.target_mem_mb,
|
||||
config.max_mem_mb,
|
||||
config.max_vcpus,
|
||||
&config.cmdline,
|
||||
)
|
||||
@ -63,7 +64,8 @@ pub struct BaseDomainConfig {
|
||||
pub uuid: Uuid,
|
||||
pub owner_domid: u32,
|
||||
pub max_vcpus: u32,
|
||||
pub mem_mb: u64,
|
||||
pub max_mem_mb: u64,
|
||||
pub target_mem_mb: u64,
|
||||
pub kernel: Vec<u8>,
|
||||
pub initrd: Vec<u8>,
|
||||
pub cmdline: String,
|
||||
|
Reference in New Issue
Block a user