From 94942294277bf7550b12322d282159551521258b Mon Sep 17 00:00:00 2001 From: tigergao99 Date: Mon, 26 Oct 2020 15:53:19 -0400 Subject: vm/bhyve: add config variable cpu Add a new configuration variable to specify number of bhyve VM vCPUs --- vm/bhyve/bhyve.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vm/bhyve') diff --git a/vm/bhyve/bhyve.go b/vm/bhyve/bhyve.go index a40676418..b4004aef2 100644 --- a/vm/bhyve/bhyve.go +++ b/vm/bhyve/bhyve.go @@ -26,6 +26,7 @@ func init() { type Config struct { Bridge string `json:"bridge"` // name of network bridge device Count int `json:"count"` // number of VMs to use + CPU int `json:"cpu"` // number of VM vCPU HostIP string `json:"hostip"` // VM host IP address Mem string `json:"mem"` // amount of VM memory Dataset string `json:"dataset"` // ZFS dataset containing VM image @@ -58,6 +59,7 @@ var tapRegex = regexp.MustCompile(`^tap[0-9]+`) func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { cfg := &Config{ Count: 1, + CPU: 1, Mem: "512M", } if err := config.LoadData(env.Config, cfg); err != nil { @@ -164,7 +166,7 @@ func (inst *instance) Boot() error { bhyveArgs := []string{ "-H", "-A", "-P", - "-c", "1", + "-c", fmt.Sprintf("%d", inst.cfg.CPU), "-m", inst.cfg.Mem, "-s", "0:0,hostbridge", "-s", "1:0,lpc", -- cgit mrf-deployment