Unneeded convert and actual copy of basedisk for every instance when using qcow2 image
- Dominant language
- Go
- Stars
- 21.9k
- Forks
- 957
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 53
Description
### Description
With the current scheme on macOS, each time I create a vz vm from the same cached image, there is a slow convert from qcow2 to raw (#2579) to the instance basedisk. Then we create a fast copy-on-write copy for vz for the diffdisk.
So we end with:
- slow convert
- actual copy of the base disk for every instance
Instead we can convert the qcow2 image once after the download and. Then create basedisk as a fast copy-on-write copy of the cached image.
Suggested layout:
- cache
- ubuntu-xyz.img (converted from ubunti-xyz.qcow2 after download)
- instance1 (vz)
basedisk.img (fast copy of ../_templates/ubuntu-xyz.img)
diffdisk.img (fast copy of basedisk.img)
- instance2 (qemu)
basedisk.img (fast copy of ../_templates/ubuntu-xyz.img)
diffdisk.img (fast qcow2 image using basedisk.img as backing file)
Of course this works only on file systems providing copy-on-write. When we don't have copy-on-write we can do actual copies.
For qemu we can use qcow2 images using a shared template as backing file, but is very hard to managed correctly. You must ensure that template images are never deleted or changed while an instance image used them as a backing file. If we fail, the instance image will be corrupted when you start the instance.
Contributor guide
Assessment
This issue has not been assessed yet.