Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions go/hyperkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ type Socket9P struct {

// DiskConfig contains the path to a disk image and an optional size if the image needs to be created.
type DiskConfig struct {
Path string `json:"path"`
Size int `json:"size"`
Path string `json:"path"`
Size int `json:"size"`
Format string `json:"format"`
Driver string `json:"driver"`
}

// HyperKit contains the configuration of the hyperkit VM
Expand Down Expand Up @@ -428,7 +430,18 @@ func (h *HyperKit) buildArgs(cmdline string) {
}

for _, p := range h.Disks {
a = append(a, "-s", fmt.Sprintf("%d:0,virtio-blk,%s", nextSlot, p.Path))
// Default the driver to virtio-blk
driver := "virtio-blk"
if p.Driver != "" {
driver = p.Driver
}
arg := fmt.Sprintf("%d:0,%s,%s", nextSlot, driver, p.Path)

// Add on a format instruction if specified.
if p.Format != "" {
arg += ",format=" + p.Format
}
a = append(a, "-s", arg)
nextSlot++
}

Expand Down