Skip to content

Commit

Permalink
Merge pull request #14 from tylerfanelli/vcpu_max
Browse files Browse the repository at this point in the history
context: Add max vCPU check
  • Loading branch information
slp authored Jul 18, 2024
2 parents 2d3599d + 377c032 commit 29f5ada
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "krunkit"
version = "0.1.1"
version = "0.1.2"
authors = ["Tyler Fanelli <[email protected]>"]
edition = "2021"
description = "CLI tool to start VMs with libkrun"
Expand Down
4 changes: 4 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ impl TryFrom<Args> for KrunContext {
let id = u32::try_from(id).unwrap();

// Set the krun VM's number of vCPUs and amount of memory allocated.
//
// libkrun has a max of 8 vCPUs allowed.
if args.cpus == 0 {
return Err(anyhow!("zero vcpus inputted (invalid)"));
} else if args.cpus > 8 {
return Err(anyhow!("too many vCPUs configured (max 8)"));
}

if args.memory == 0 {
Expand Down

0 comments on commit 29f5ada

Please sign in to comment.