mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 10:31:35 +00:00
linuxkit: Fix qemu run behaviour when file does not exist
This commit fixes an issue reported on Slack where `linuxkit run` will assume that a file that is neither a kernel or iso must be a disk image without first checking that it exists. This would result in `qemu-img` attempting to create a disk with 0 size due to the default behaviour of creating disk images that do not exist. Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
parent
9e5179f11c
commit
94f2d2cd9a
@ -170,6 +170,9 @@ func runQemu(args []string) {
|
||||
|
||||
// user not trying to boot off ISO or kernel, so assume booting from a disk image
|
||||
if !*kernelBoot && !*isoBoot {
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
log.Fatalf("Boot disk image %s does not exist", path)
|
||||
}
|
||||
// currently no way to set format, but autodetect probably works
|
||||
d := Disks{DiskConfig{Path: path}}
|
||||
disks = append(d, disks...)
|
||||
|
Loading…
Reference in New Issue
Block a user