machine-drivers / docker-machine-driver-xhyve

docker-machine/minikube/minishift driver plugin for xhyve/hyperkit (native macOS hypervisor.framework)
https://godoc.org/github.com/machine-drivers/docker-machine-driver-xhyve
BSD 3-Clause "New" or "Revised" License
888 stars 74 forks source link

disk size create is only 1/10 of the original size when using qcow2 format #191

Open ek9852 opened 6 years ago

ek9852 commented 6 years ago

When create a machine with raw disk, the disk size is correct (in terms of MB) But when using qcow2 format, the disk size is only 1/10 of the expected size. In the code:

func (d *Driver) generateQcow2Image(size int64) error {
        diskPath := filepath.Join(d.ResolveStorePath("."), d.MachineName+".qcow2")
        opts := &qcow2.Opts{
                Filename:      diskPath,
                Size:          d.DiskSize * 107374,
                Fmt:           qcow2.DriverQCow2,
                ClusterSize:   65536,
                Preallocation: qcow2.PREALLOC_MODE_OFF,
                Encryption:    false,
                LazyRefcounts: true,
        }

It magically multiply by 107374 instead of 1048576.

zchee commented 6 years ago

@ek9852 Ah, maybe good catch. Thanks. I'll see that related code and fix it.