fix #3580: plugins: make preallocation mode selectable for qcow2 and raw images
the plugins for file based storages * BTRFS * CIFS * Dir * Glusterfs * NFS now allow the option 'preallocation'. 'preallocation' can have four values: * default * off * metadata * falloc * full see man pages for `qemu-img` for what these mean exactly. [0] the defualt value was chosen to be * qcow2: metadata (as previously) * raw: off when using 'metadata' as preallocation mode, for raw images 'off' is used. [0] https://qemu.readthedocs.io/en/latest/system/images.html#disk-image-file-formats Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com> Reviewed-by: Fabian Ebner <f.ebner@proxmox.com> Tested-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
2caa1194e9
commit
95ff5dbd64
@ -137,6 +137,7 @@ sub options {
|
||||
format => { optional => 1 },
|
||||
mkdir => { optional => 1 },
|
||||
bwlimit => { optional => 1 },
|
||||
preallocation => { optional => 1 },
|
||||
};
|
||||
}
|
||||
|
||||
@ -260,7 +261,8 @@ sub alloc_image {
|
||||
|
||||
my $cmd = ['/usr/bin/qemu-img', 'create'];
|
||||
|
||||
push @$cmd, '-o', 'preallocation=metadata' if $fmt eq 'qcow2';
|
||||
my $prealloc_opt = PVE::Storage::Plugin::preallocation_cmd_option($scfg, $fmt);
|
||||
push @$cmd, '-o', $prealloc_opt if defined($prealloc_opt);
|
||||
|
||||
push @$cmd, '-f', $fmt, $volumepath, "${size}K";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user