From c70b225816136427a5ddc0b9b02c4048f915c906 Mon Sep 17 00:00:00 2001 From: Mauran Date: Sun, 21 Apr 2024 19:12:05 +0200 Subject: [PATCH 1/5] feat: grpc and cli Signed-off-by: Mauran --- src/vmm/Cargo.toml | 6 ++++ src/vmm/build.rs | 4 +++ src/vmm/src/args.rs | 18 ++++++++++++ src/vmm/src/lib.rs | 8 ++++++ src/vmm/src/main.rs | 64 +++++++++++++++++++++++++----------------- src/vmm/src/service.rs | 51 +++++++++++++++++++++++++++++++++ 6 files changed, 125 insertions(+), 26 deletions(-) create mode 100644 src/vmm/build.rs create mode 100644 src/vmm/src/service.rs diff --git a/src/vmm/Cargo.toml b/src/vmm/Cargo.toml index 134a717..ef68bd7 100644 --- a/src/vmm/Cargo.toml +++ b/src/vmm/Cargo.toml @@ -20,6 +20,8 @@ linux-loader = { version = "0.11.0", features = ["bzimage", "elf"] } log = "0.4.20" nix = { version = "0.28.0", features = ["term"] } openpty = "0.2.0" +prost = "0.11" +tonic = "0.9" tracing = "0.1.40" tracing-subscriber = "0.3.18" virtio-bindings = "0.2.2" @@ -27,3 +29,7 @@ vm-device = "0.1.0" vm-memory = { version = "0.14.0", features = ["backend-mmap"] } vm-superio = "0.7.0" vmm-sys-util = "0.12.1" +tokio = { version= "1.37.0", features= ["full"]} + +[build-dependencies] +tonic-build = "0.9" \ No newline at end of file diff --git a/src/vmm/build.rs b/src/vmm/build.rs new file mode 100644 index 0000000..c53d705 --- /dev/null +++ b/src/vmm/build.rs @@ -0,0 +1,4 @@ +fn main() -> Result<(), Box> { + tonic_build::compile_protos("../../proto/vmm.proto")?; + Ok(()) +} diff --git a/src/vmm/src/args.rs b/src/vmm/src/args.rs index fcfca2d..e9a532d 100644 --- a/src/vmm/src/args.rs +++ b/src/vmm/src/args.rs @@ -5,6 +5,24 @@ use clap::Parser; use clap_verbosity_flag::{InfoLevel, Verbosity}; use tracing::level_filters; +#[derive(Parser, Debug)] +#[command(version, about, long_about = None)] +pub struct CliArgs { + #[command(subcommand)] + pub command: Commands, +} + +#[derive(Parser, Debug)] +pub enum Commands { + Grpc, + cli(CliArguments), +} + +#[derive(Parser, Debug)] +pub struct GrpcArgs { + // Add any necessary fields for gRPC configuration +} + /// The Virtual Machine Manager for the Cloudlet serverless runtime. #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] diff --git a/src/vmm/src/lib.rs b/src/vmm/src/lib.rs index 5a7ca06..48ffa47 100644 --- a/src/vmm/src/lib.rs +++ b/src/vmm/src/lib.rs @@ -1 +1,9 @@ pub mod core; +pub mod service; + +#[derive(Debug)] +pub enum VmmErrors { + VmmNew(core::Error), + VmmConfigure(core::Error), + VmmRun(core::Error), +} \ No newline at end of file diff --git a/src/vmm/src/main.rs b/src/vmm/src/main.rs index c0f008d..a1ec04d 100644 --- a/src/vmm/src/main.rs +++ b/src/vmm/src/main.rs @@ -1,24 +1,14 @@ -use crate::args::CliArguments; +use crate::args::{CliArgs, CliArguments, Commands}; use clap::Parser; use tracing::info; -use vmm::core::{self, vmm::VMM}; - +use vmm::{core::{self, vmm::VMM}, service::{vmmorchestrator, VmmService}, VmmErrors}; +use tonic::transport::Server; mod args; -#[derive(Debug)] -pub enum Error { - VmmNew(core::Error), - VmmConfigure(core::Error), - VmmRun(core::Error), -} - -/// The application entry point. -fn main() -> Result<(), Error> { +#[tokio::main] +async fn main() -> Result<(), Box> { // Parse the configuration and configure logger verbosity - let args = CliArguments::parse(); - tracing_subscriber::fmt() - .with_max_level(args.convert_log_to_tracing()) - .init(); + let args = CliArgs::parse(); info!( app_name = env!("CARGO_PKG_NAME"), @@ -26,15 +16,37 @@ fn main() -> Result<(), Error> { "Starting application", ); - // Create a new VMM - let mut vmm = - VMM::new(args.network_host_ip, args.network_host_netmask).map_err(Error::VmmNew)?; - - vmm.configure(args.cpus, args.memory, &args.kernel, &args.initramfs) - .map_err(Error::VmmConfigure)?; - - // Run the VMM - vmm.run().map_err(Error::VmmRun)?; - + let addr = "127.0.0.1:50051".parse().unwrap(); + let vmm_service = VmmService::default(); + + // check if the args is grpc or command + + match args.command { + Commands::Grpc => { + Server::builder() + .add_service(vmmorchestrator::vmm_service_server::VmmServiceServer::new(vmm_service)) + .serve(addr) + .await?; + + } + Commands::cli(CliArguments) => { + let cli_args = CliArguments::parse(); + + tracing_subscriber::fmt() + .with_max_level(cli_args.convert_log_to_tracing()) + .init(); + // Create a new VMM + let mut vmm = + VMM::new(cli_args.network_host_ip, cli_args.network_host_netmask).map_err(VmmErrors::VmmNew).unwrap(); + + vmm.configure(cli_args.cpus, cli_args.memory, &cli_args.kernel, &cli_args.initramfs) + .map_err(VmmErrors::VmmConfigure).unwrap(); + + // Run the VMM + vmm.run().map_err(VmmErrors::VmmRun).unwrap(); + + } + } + Ok(()) } diff --git a/src/vmm/src/service.rs b/src/vmm/src/service.rs new file mode 100644 index 0000000..5ff12b7 --- /dev/null +++ b/src/vmm/src/service.rs @@ -0,0 +1,51 @@ +use tonic::{transport::Server, Request, Response, Status}; +use crate::core::vmm::{self, VMM}; +use std::{convert::From, net::Ipv4Addr, path::{Path, PathBuf}}; +use crate::VmmErrors; +use self::vmmorchestrator::{vmm_service_server::VmmService as VmmServiceTrait, RunVmmRequest, RunVmmResponse}; + +pub mod vmmorchestrator { + tonic::include_proto!("vmmorchestrator"); +} + +// Implement the From trait for VmmErrors into Status +impl From for Status { + fn from(error: VmmErrors) -> Self { + // You can create a custom Status variant based on the error + match error { + VmmErrors::VmmNew(_) => Status::internal("Error creating VMM"), + VmmErrors::VmmConfigure(_) => Status::internal("Error configuring VMM"), + VmmErrors::VmmRun(_) => Status::internal("Error running VMM"), + } + } +} + +#[derive(Default)] +pub struct VmmService; + +#[tonic::async_trait] +impl VmmServiceTrait for VmmService { + async fn run( + &self, + request: Request, + ) -> Result, Status> { + let response = vmmorchestrator::RunVmmResponse {}; + + const host_ip: Ipv4Addr = Ipv4Addr::new(172, 29, 0, 1); + const host_netmask: Ipv4Addr = Ipv4Addr::new(255, 255, 0, 0); + // Check if the kernel is on the system, else download it + + let kernel_path: &Path = &Path::new("../../../initramfs.img"); + let initramfs_path: PathBuf = PathBuf::new(); // Create an owned PathBuf + // // Create a new VMM + let mut vmm = + VMM::new(host_ip, host_netmask).map_err(VmmErrors::VmmNew)?; + + vmm.configure(1, 512, &kernel_path, &Some(initramfs_path)) + .map_err(VmmErrors::VmmConfigure)?; + // Run the VMM + vmm.run().map_err(VmmErrors::VmmRun)?; + + Ok(Response::new(response)) + } +} From dc6196ae9ddfd844abd3a486a92dc11e17909c4d Mon Sep 17 00:00:00 2001 From: Mauran Date: Sun, 21 Apr 2024 20:25:01 +0200 Subject: [PATCH 2/5] chore: scripts to create kernel plugged in the service Signed-off-by: Mauran --- src/vmm/src/main.rs | 2 +- src/vmm/src/service.rs | 39 ++++++++++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/vmm/src/main.rs b/src/vmm/src/main.rs index a1ec04d..64934db 100644 --- a/src/vmm/src/main.rs +++ b/src/vmm/src/main.rs @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "Starting application", ); - let addr = "127.0.0.1:50051".parse().unwrap(); + let addr = "[::1]:50051".parse().unwrap(); let vmm_service = VmmService::default(); // check if the args is grpc or command diff --git a/src/vmm/src/service.rs b/src/vmm/src/service.rs index 5ff12b7..3f03427 100644 --- a/src/vmm/src/service.rs +++ b/src/vmm/src/service.rs @@ -1,8 +1,9 @@ use tonic::{transport::Server, Request, Response, Status}; use crate::core::vmm::{self, VMM}; -use std::{convert::From, net::Ipv4Addr, path::{Path, PathBuf}}; +use std::{convert::From, net::Ipv4Addr, path::{Path, PathBuf}, process::{Command, Stdio}}; use crate::VmmErrors; use self::vmmorchestrator::{vmm_service_server::VmmService as VmmServiceTrait, RunVmmRequest, RunVmmResponse}; +use tracing::info; pub mod vmmorchestrator { tonic::include_proto!("vmmorchestrator"); @@ -31,15 +32,39 @@ impl VmmServiceTrait for VmmService { ) -> Result, Status> { let response = vmmorchestrator::RunVmmResponse {}; - const host_ip: Ipv4Addr = Ipv4Addr::new(172, 29, 0, 1); - const host_netmask: Ipv4Addr = Ipv4Addr::new(255, 255, 0, 0); - // Check if the kernel is on the system, else download it + const HOST_IP: Ipv4Addr = Ipv4Addr::new(172, 29, 0, 1); + const HOST_NETMASK: Ipv4Addr = Ipv4Addr::new(255, 255, 0, 0); + + // Check if the kernel is on the system, else build it + println!("BEFORE"); + + if !Path::new("./tools/kernel/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin").exists() { + info!("Kernel not found, building kernel"); + // Execute the script using sh and capture output and error streams + let output = Command::new("sh") + .arg("./tools/kernel/mkkernel.sh") + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("Failed to execute the kernel build script"); + + // Print output and error streams + println!("Script output: {}", String::from_utf8_lossy(&output.stdout)); + println!("Script errors: {}", String::from_utf8_lossy(&output.stderr)); + + }; + + let kernel_path = &Path::new("./tools/kernel/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin"); + let mut initramfs_path: PathBuf = PathBuf::new(); + + // Todo - Check if the initramfs for the specified language is on the system, else build it + initramfs_path.push("./initramfs.img"); // Append the path to the PathBuf + + println!("Kernel path: {:?}", kernel_path); - let kernel_path: &Path = &Path::new("../../../initramfs.img"); - let initramfs_path: PathBuf = PathBuf::new(); // Create an owned PathBuf // // Create a new VMM let mut vmm = - VMM::new(host_ip, host_netmask).map_err(VmmErrors::VmmNew)?; + VMM::new(HOST_IP, HOST_NETMASK).map_err(VmmErrors::VmmNew)?; vmm.configure(1, 512, &kernel_path, &Some(initramfs_path)) .map_err(VmmErrors::VmmConfigure)?; From 73efe4b9578e3d0666726461deea7149c6269d21 Mon Sep 17 00:00:00 2001 From: Mauran Date: Mon, 22 Apr 2024 21:02:26 +0200 Subject: [PATCH 3/5] fix: vmm clap cli Signed-off-by: Mauran --- src/vmm/src/args.rs | 25 +++++++++++-------------- src/vmm/src/main.rs | 11 ++++------- src/vmm/src/service.rs | 12 +++++------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/vmm/src/args.rs b/src/vmm/src/args.rs index e9a532d..05978c0 100644 --- a/src/vmm/src/args.rs +++ b/src/vmm/src/args.rs @@ -6,7 +6,7 @@ use clap_verbosity_flag::{InfoLevel, Verbosity}; use tracing::level_filters; #[derive(Parser, Debug)] -#[command(version, about, long_about = None)] +#[command(version, about)] pub struct CliArgs { #[command(subcommand)] pub command: Commands, @@ -14,25 +14,22 @@ pub struct CliArgs { #[derive(Parser, Debug)] pub enum Commands { + #[command(about = "Run a VMM instance.")] + Cli(CliArguments), + #[command(about = "Run a GRPC server listening for incoming requests.")] Grpc, - cli(CliArguments), -} - -#[derive(Parser, Debug)] -pub struct GrpcArgs { - // Add any necessary fields for gRPC configuration -} +} -/// The Virtual Machine Manager for the Cloudlet serverless runtime. +/// Run a VMM instance. #[derive(Parser, Debug)] -#[command(author, version, about, long_about = None)] +#[command(author, version, about)] pub struct CliArguments { /// Path to the image of the Linux kernel to boot. - #[arg(short, long, env)] + #[arg(short, long, env, required = true)] pub kernel: PathBuf, /// Path to the cpio archive to use as the initramfs. - #[arg(short, long, env)] + #[arg(short, long, env, required = true)] pub initramfs: Option, /// Number of virtual CPUs assigned to the guest. @@ -44,11 +41,11 @@ pub struct CliArguments { pub memory: u32, /// IPv4 address of the host tap interface. - #[clap(long, env)] + #[clap(long, env, required = true)] pub network_host_ip: Ipv4Addr, /// Subnet mask of the host tap interface. - #[clap(long, env)] + #[clap(long, env, required = true)] pub network_host_netmask: Ipv4Addr, /// Verbosity level. diff --git a/src/vmm/src/main.rs b/src/vmm/src/main.rs index 64934db..d003d90 100644 --- a/src/vmm/src/main.rs +++ b/src/vmm/src/main.rs @@ -1,7 +1,7 @@ -use crate::args::{CliArgs, CliArguments, Commands}; +use crate::args::{CliArgs, Commands}; use clap::Parser; use tracing::info; -use vmm::{core::{self, vmm::VMM}, service::{vmmorchestrator, VmmService}, VmmErrors}; +use vmm::{core::{vmm::VMM}, service::{vmmorchestrator, VmmService}, VmmErrors}; use tonic::transport::Server; mod args; @@ -17,10 +17,9 @@ async fn main() -> Result<(), Box> { ); let addr = "[::1]:50051".parse().unwrap(); - let vmm_service = VmmService::default(); + let vmm_service = VmmService; // check if the args is grpc or command - match args.command { Commands::Grpc => { Server::builder() @@ -29,8 +28,7 @@ async fn main() -> Result<(), Box> { .await?; } - Commands::cli(CliArguments) => { - let cli_args = CliArguments::parse(); + Commands::Cli(cli_args) => { tracing_subscriber::fmt() .with_max_level(cli_args.convert_log_to_tracing()) @@ -44,7 +42,6 @@ async fn main() -> Result<(), Box> { // Run the VMM vmm.run().map_err(VmmErrors::VmmRun).unwrap(); - } } diff --git a/src/vmm/src/service.rs b/src/vmm/src/service.rs index 3f03427..dce0c31 100644 --- a/src/vmm/src/service.rs +++ b/src/vmm/src/service.rs @@ -3,7 +3,7 @@ use crate::core::vmm::{self, VMM}; use std::{convert::From, net::Ipv4Addr, path::{Path, PathBuf}, process::{Command, Stdio}}; use crate::VmmErrors; use self::vmmorchestrator::{vmm_service_server::VmmService as VmmServiceTrait, RunVmmRequest, RunVmmResponse}; -use tracing::info; +use tracing::{error, info}; pub mod vmmorchestrator { tonic::include_proto!("vmmorchestrator"); @@ -36,8 +36,6 @@ impl VmmServiceTrait for VmmService { const HOST_NETMASK: Ipv4Addr = Ipv4Addr::new(255, 255, 0, 0); // Check if the kernel is on the system, else build it - println!("BEFORE"); - if !Path::new("./tools/kernel/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin").exists() { info!("Kernel not found, building kernel"); // Execute the script using sh and capture output and error streams @@ -49,16 +47,15 @@ impl VmmServiceTrait for VmmService { .expect("Failed to execute the kernel build script"); // Print output and error streams - println!("Script output: {}", String::from_utf8_lossy(&output.stdout)); - println!("Script errors: {}", String::from_utf8_lossy(&output.stderr)); - + error!("Script output: {}", String::from_utf8_lossy(&output.stdout)); + error!("Script errors: {}", String::from_utf8_lossy(&output.stderr)); }; let kernel_path = &Path::new("./tools/kernel/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin"); let mut initramfs_path: PathBuf = PathBuf::new(); // Todo - Check if the initramfs for the specified language is on the system, else build it - initramfs_path.push("./initramfs.img"); // Append the path to the PathBuf + initramfs_path.push("./tools/rootfs/initramfs.img"); println!("Kernel path: {:?}", kernel_path); @@ -66,6 +63,7 @@ impl VmmServiceTrait for VmmService { let mut vmm = VMM::new(HOST_IP, HOST_NETMASK).map_err(VmmErrors::VmmNew)?; + // Configure the VMM parameters might need to be calculated rather than hardcoded vmm.configure(1, 512, &kernel_path, &Some(initramfs_path)) .map_err(VmmErrors::VmmConfigure)?; // Run the VMM From 572dfaf3ed25eeecc9711d0bda984ff095ba0790 Mon Sep 17 00:00:00 2001 From: Mauran Date: Mon, 22 Apr 2024 21:18:07 +0200 Subject: [PATCH 4/5] chore: remove println Signed-off-by: Mauran --- src/vmm/src/service.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/vmm/src/service.rs b/src/vmm/src/service.rs index dce0c31..705f194 100644 --- a/src/vmm/src/service.rs +++ b/src/vmm/src/service.rs @@ -57,8 +57,6 @@ impl VmmServiceTrait for VmmService { // Todo - Check if the initramfs for the specified language is on the system, else build it initramfs_path.push("./tools/rootfs/initramfs.img"); - println!("Kernel path: {:?}", kernel_path); - // // Create a new VMM let mut vmm = VMM::new(HOST_IP, HOST_NETMASK).map_err(VmmErrors::VmmNew)?; From 9a0f75d39bdbda1b56c9c460d07bd14cbe9429e4 Mon Sep 17 00:00:00 2001 From: Mauran Date: Mon, 22 Apr 2024 23:27:30 +0200 Subject: [PATCH 5/5] chore: lint Signed-off-by: Mauran --- src/vmm/src/args.rs | 2 +- src/vmm/src/lib.rs | 2 +- src/vmm/src/main.rs | 43 ++++++++++++++++++++++++++---------------- src/vmm/src/service.rs | 34 +++++++++++++++++++++------------ 4 files changed, 51 insertions(+), 30 deletions(-) diff --git a/src/vmm/src/args.rs b/src/vmm/src/args.rs index 05978c0..d4e9bcc 100644 --- a/src/vmm/src/args.rs +++ b/src/vmm/src/args.rs @@ -18,7 +18,7 @@ pub enum Commands { Cli(CliArguments), #[command(about = "Run a GRPC server listening for incoming requests.")] Grpc, -} +} /// Run a VMM instance. #[derive(Parser, Debug)] diff --git a/src/vmm/src/lib.rs b/src/vmm/src/lib.rs index 48ffa47..f5df684 100644 --- a/src/vmm/src/lib.rs +++ b/src/vmm/src/lib.rs @@ -6,4 +6,4 @@ pub enum VmmErrors { VmmNew(core::Error), VmmConfigure(core::Error), VmmRun(core::Error), -} \ No newline at end of file +} diff --git a/src/vmm/src/main.rs b/src/vmm/src/main.rs index d003d90..3662646 100644 --- a/src/vmm/src/main.rs +++ b/src/vmm/src/main.rs @@ -1,8 +1,12 @@ use crate::args::{CliArgs, Commands}; use clap::Parser; -use tracing::info; -use vmm::{core::{vmm::VMM}, service::{vmmorchestrator, VmmService}, VmmErrors}; use tonic::transport::Server; +use tracing::info; +use vmm::{ + core::vmm::VMM, + service::{vmmorchestrator, VmmService}, + VmmErrors, +}; mod args; #[tokio::main] @@ -23,27 +27,34 @@ async fn main() -> Result<(), Box> { match args.command { Commands::Grpc => { Server::builder() - .add_service(vmmorchestrator::vmm_service_server::VmmServiceServer::new(vmm_service)) - .serve(addr) - .await?; - + .add_service(vmmorchestrator::vmm_service_server::VmmServiceServer::new( + vmm_service, + )) + .serve(addr) + .await?; } Commands::Cli(cli_args) => { - tracing_subscriber::fmt() - .with_max_level(cli_args.convert_log_to_tracing()) - .init(); + .with_max_level(cli_args.convert_log_to_tracing()) + .init(); // Create a new VMM - let mut vmm = - VMM::new(cli_args.network_host_ip, cli_args.network_host_netmask).map_err(VmmErrors::VmmNew).unwrap(); - - vmm.configure(cli_args.cpus, cli_args.memory, &cli_args.kernel, &cli_args.initramfs) - .map_err(VmmErrors::VmmConfigure).unwrap(); - + let mut vmm = VMM::new(cli_args.network_host_ip, cli_args.network_host_netmask) + .map_err(VmmErrors::VmmNew) + .unwrap(); + + vmm.configure( + cli_args.cpus, + cli_args.memory, + &cli_args.kernel, + &cli_args.initramfs, + ) + .map_err(VmmErrors::VmmConfigure) + .unwrap(); + // Run the VMM vmm.run().map_err(VmmErrors::VmmRun).unwrap(); } } - + Ok(()) } diff --git a/src/vmm/src/service.rs b/src/vmm/src/service.rs index 705f194..bd1dfac 100644 --- a/src/vmm/src/service.rs +++ b/src/vmm/src/service.rs @@ -1,8 +1,15 @@ -use tonic::{transport::Server, Request, Response, Status}; -use crate::core::vmm::{self, VMM}; -use std::{convert::From, net::Ipv4Addr, path::{Path, PathBuf}, process::{Command, Stdio}}; +use self::vmmorchestrator::{ + vmm_service_server::VmmService as VmmServiceTrait, RunVmmRequest, RunVmmResponse, +}; +use crate::core::vmm::VMM; use crate::VmmErrors; -use self::vmmorchestrator::{vmm_service_server::VmmService as VmmServiceTrait, RunVmmRequest, RunVmmResponse}; +use std::{ + convert::From, + net::Ipv4Addr, + path::{Path, PathBuf}, + process::{Command, Stdio}, +}; +use tonic::{Request, Response, Status}; use tracing::{error, info}; pub mod vmmorchestrator { @@ -28,15 +35,17 @@ pub struct VmmService; impl VmmServiceTrait for VmmService { async fn run( &self, - request: Request, + _request: Request, ) -> Result, Status> { let response = vmmorchestrator::RunVmmResponse {}; const HOST_IP: Ipv4Addr = Ipv4Addr::new(172, 29, 0, 1); const HOST_NETMASK: Ipv4Addr = Ipv4Addr::new(255, 255, 0, 0); - + // Check if the kernel is on the system, else build it - if !Path::new("./tools/kernel/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin").exists() { + if !Path::new("./tools/kernel/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin") + .exists() + { info!("Kernel not found, building kernel"); // Execute the script using sh and capture output and error streams let output = Command::new("sh") @@ -51,18 +60,19 @@ impl VmmServiceTrait for VmmService { error!("Script errors: {}", String::from_utf8_lossy(&output.stderr)); }; - let kernel_path = &Path::new("./tools/kernel/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin"); - let mut initramfs_path: PathBuf = PathBuf::new(); + let kernel_path = &Path::new( + "./tools/kernel/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin", + ); + let mut initramfs_path: PathBuf = PathBuf::new(); // Todo - Check if the initramfs for the specified language is on the system, else build it initramfs_path.push("./tools/rootfs/initramfs.img"); // // Create a new VMM - let mut vmm = - VMM::new(HOST_IP, HOST_NETMASK).map_err(VmmErrors::VmmNew)?; + let mut vmm = VMM::new(HOST_IP, HOST_NETMASK).map_err(VmmErrors::VmmNew)?; // Configure the VMM parameters might need to be calculated rather than hardcoded - vmm.configure(1, 512, &kernel_path, &Some(initramfs_path)) + vmm.configure(1, 512, kernel_path, &Some(initramfs_path)) .map_err(VmmErrors::VmmConfigure)?; // Run the VMM vmm.run().map_err(VmmErrors::VmmRun)?;