[pve-devel] [PATCH pve-storage 1/2] common: add qemu_img_create an preallocation_cmd_option
Fiona Ebner
f.ebner at proxmox.com
Tue May 27 10:49:02 CEST 2025
Yes, this is a better place for such helpers :)
Am 22.05.25 um 15:53 schrieb Alexandre Derumier via pve-devel:
> Signed-off-by: Alexandre Derumier <alexandre.derumier at groupe-cyllene.com>
> ---
> src/PVE/Storage/Common.pm | 53 ++++++++++++++++++++++++++++++
> src/PVE/Storage/GlusterfsPlugin.pm | 2 +-
> src/PVE/Storage/Plugin.pm | 47 +-------------------------
> 3 files changed, 55 insertions(+), 47 deletions(-)
>
> diff --git a/src/PVE/Storage/Common.pm b/src/PVE/Storage/Common.pm
> index bd9c951..0770d70 100644
> --- a/src/PVE/Storage/Common.pm
> +++ b/src/PVE/Storage/Common.pm
> @@ -5,12 +5,26 @@ use warnings;
>
> use PVE::JSONSchema;
> use PVE::Syscall;
> +use PVE::Tools qw(run_command);
>
> use constant {
> FALLOC_FL_KEEP_SIZE => 0x01, # see linux/falloc.h
> FALLOC_FL_PUNCH_HOLE => 0x02, # see linux/falloc.h
> };
>
> +our $QCOW2_PREALLOCATION = {
Should be made private with 'my' instead of 'our', as it's not (intended
to be) used anywhere else.
> + off => 1,
> + metadata => 1,
> + falloc => 1,
> + full => 1,
> +};
> +
> +our $RAW_PREALLOCATION = {
Same.
> + off => 1,
> + falloc => 1,
> + full => 1,
> +};
> +
> =pod
>
> =head1 NAME
> @@ -107,4 +121,43 @@ sub deallocate : prototype($$$) {
> }
> }
>
> +
> +sub preallocation_cmd_option {
All functions added to the common module should have a documentation
with POD, see existing functions in the module.
More information about the pve-devel
mailing list