Skip to content

Commit 29f5ada

Browse files
authored
Merge pull request #14 from tylerfanelli/vcpu_max
context: Add max vCPU check
2 parents 2d3599d + 377c032 commit 29f5ada

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "krunkit"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
authors = ["Tyler Fanelli <tfanelli@redhat.com>"]
55
edition = "2021"
66
description = "CLI tool to start VMs with libkrun"

src/context.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ impl TryFrom<Args> for KrunContext {
4646
let id = u32::try_from(id).unwrap();
4747

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

5357
if args.memory == 0 {

0 commit comments

Comments
 (0)