aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authortigergao99 <tigergao1999@outlook.com>2020-10-26 15:53:19 -0400
committerDmitry Vyukov <dvyukov@google.com>2020-10-27 07:58:38 +0100
commit94942294277bf7550b12322d282159551521258b (patch)
tree90280d067d8befbdcf43dc5984c29f7bc5973dfd /vm
parent4ad9d45c6b9ab2ddc1666a2989dd71e2a0629d07 (diff)
vm/bhyve: add config variable cpu
Add a new configuration variable to specify number of bhyve VM vCPUs
Diffstat (limited to 'vm')
-rw-r--r--vm/bhyve/bhyve.go4
1 files changed, 3 insertions, 1 deletions
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",