From f1f128c6ddc46543d338c82bfe22de42b131e592 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Fri, 27 Jul 2018 19:28:34 +0200 Subject: [PATCH] Allow `linuxkit run vbox` to use multiple drives VirtualBox hardware (like physical hardware) has only a limited number of IDE device on an IDE Controller. Unfortunately when using an additional drive, it was given the port value of 2, which doesn't exists in VirtualBox IDE controllers (as only 0 and 1 are permitted). This change makes use of the SATA Controller which can host much more drives, to hook the additional drives. Signed-off-by: Brice Figureau --- src/cmd/linuxkit/run_vbox.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cmd/linuxkit/run_vbox.go b/src/cmd/linuxkit/run_vbox.go index 7bc7d5fea..70d2fdeac 100644 --- a/src/cmd/linuxkit/run_vbox.go +++ b/src/cmd/linuxkit/run_vbox.go @@ -171,6 +171,13 @@ func runVbox(args []string) { } } + if len(disks) > 0 { + _, out, err = manage(vboxmanage, "storagectl", name, "--name", "SATA", "--add", "sata") + if err != nil { + log.Fatalf("storagectl error: %v\n%s", err, out) + } + } + for i, d := range disks { id := strconv.Itoa(i) if d.Size != 0 && d.Format == "" { @@ -188,7 +195,7 @@ func runVbox(args []string) { log.Fatalf("Cannot create disk: %v", err) } } - _, out, err = manage(vboxmanage, "storageattach", name, "--storagectl", "IDE Controller", "--port", "2", "--device", id, "--type", "hdd", "--medium", d.Path) + _, out, err = manage(vboxmanage, "storageattach", name, "--storagectl", "SATA", "--port", "0", "--device", id, "--type", "hdd", "--medium", d.Path) if err != nil { log.Fatalf("storageattach error: %v\n%s", err, out) }