From b8bd66d10da64b6e885f8576ef279520891e2e99 Mon Sep 17 00:00:00 2001 From: Ammar Ansari Date: Wed, 15 Nov 2017 14:47:46 -0500 Subject: [PATCH] Align virtual disk size for qemu builder When booting from a disk image, the Qemu builder resizes the disk to 40000 which is not a multiple of 1kB. This causes problems while booting from the image. Updating the default disk size to 40960 fixes this issue --- builder/qemu/builder.go | 2 +- builder/qemu/builder_test.go | 2 +- website/source/docs/builders/qemu.html.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index 2b6b206d9..43ec6b4c3 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -144,7 +144,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { warnings := make([]string, 0) if b.config.DiskSize == 0 { - b.config.DiskSize = 40000 + b.config.DiskSize = 40960 } if b.config.DiskCache == "" { diff --git a/builder/qemu/builder_test.go b/builder/qemu/builder_test.go index 24c5dc47e..7ef29034e 100644 --- a/builder/qemu/builder_test.go +++ b/builder/qemu/builder_test.go @@ -208,7 +208,7 @@ func TestBuilderPrepare_DiskSize(t *testing.T) { t.Fatalf("bad err: %s", err) } - if b.config.DiskSize != 40000 { + if b.config.DiskSize != 40960 { t.Fatalf("bad size: %d", b.config.DiskSize) } diff --git a/website/source/docs/builders/qemu.html.md b/website/source/docs/builders/qemu.html.md index e1bff6043..f3de7cf9c 100644 --- a/website/source/docs/builders/qemu.html.md +++ b/website/source/docs/builders/qemu.html.md @@ -157,7 +157,7 @@ Linux server and have not enabled X11 forwarding (`ssh -X`). interface under these circumstances will cause the build to fail. - `disk_size` (number) - The size, in megabytes, of the hard disk to create - for the VM. By default, this is 40000 (about 40 GB). + for the VM. By default, this is 40960 (40 GB). - `floppy_files` (array of strings) - A list of files to place onto a floppy disk that is attached when the VM is booted. This is most useful for