Skip to content

Commit 17efcc2

Browse files
committed
[vm/bhyve]: added customizable bhyve arguments
Added extra config argument "bhyve_args" to allow users to add their own bhyve related arguments
1 parent 0bd6db4 commit 17efcc2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

vm/bhyve/bhyve.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ func init() {
2828
}
2929

3030
type Config struct {
31-
Bridge string `json:"bridge"` // name of network bridge device, optional
32-
Count int `json:"count"` // number of VMs to use
33-
CPU int `json:"cpu"` // number of VM vCPU
34-
HostIP string `json:"hostip"` // VM host IP address
35-
Mem string `json:"mem"` // amount of VM memory
36-
Dataset string `json:"dataset"` // ZFS dataset containing VM image
31+
Bridge string `json:"bridge"` // name of network bridge device, optional
32+
Count int `json:"count"` // number of VMs to use
33+
CPU int `json:"cpu"` // number of VM vCPU
34+
HostIP string `json:"hostip"` // VM host IP address
35+
Mem string `json:"mem"` // amount of VM memory
36+
Dataset string `json:"dataset"` // ZFS dataset containing VM image
37+
BhyveArgs string `json:"bhyve_args"` // extra arguments to bhyve
3738
}
3839

3940
type Pool struct {
@@ -185,9 +186,11 @@ func (inst *instance) Boot() error {
185186
"-s", fmt.Sprintf("2:0,virtio-net,%v", netdev),
186187
"-s", fmt.Sprintf("3:0,virtio-blk,%v", inst.image),
187188
"-l", "com1,stdio",
188-
inst.vmName,
189189
}
190190

191+
bhyveArgs = append(bhyveArgs, strings.Split(inst.cfg.BhyveArgs, " ")...)
192+
bhyveArgs = append(bhyveArgs, inst.vmName)
193+
191194
outr, outw, err := osutil.LongPipe()
192195
if err != nil {
193196
return err

0 commit comments

Comments
 (0)