[pve-devel] [PATCH qemu-server 03/10] config: memory: add 'max' option

Fiona Ebner f.ebner at proxmox.com
Fri Dec 16 14:38:51 CET 2022


Am 09.12.22 um 20:27 schrieb Alexandre Derumier:
> max can be multiple of 64GB only.
> 

Some quick rationale as to why would be nice to have.

> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>  PVE/QemuServer.pm | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index ad69b76..0d5b550 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -267,6 +267,9 @@ my $rng_fmt = {
>      },
>  };
>  
> +
> +my @max_memory_list = map 65536*$_, 1..64;
> +
>  my $memory_fmt = {
>      current => {
>          description => "Current amount of online RAM for the VM in MB. This is the maximum available memory when"
> @@ -276,7 +279,12 @@ my $memory_fmt = {
>          optional => 1,
>          minimum => 16,
>          default => 512,
> -    }
> +    },
> +    max => {
> +        type => 'integer',
> +        optional => 1,

Style nit: wrong indentations

Missing description. Even if it's just something like "Maximum amount of
memory that can be hotplugged", it's better to have something than nothing.

> +	enum => [@max_memory_list],

This feels like an abuse of enum to me. Instead, you could attach a
verifier function to the format and die there with an appropriate error
message.

Or it will be this ;)

memory.max: value '1' does not have a value in the enumeration '65536,
131072, 196608, 262144, 327680, 393216, 458752, 524288, 589824, 655360,
720896, 786432, 851968, 917504, 983040, 1048576, 1114112, 1179648,
1245184, 1310720, 1376256, 1441792, 1507328, 1572864, 1638400, 1703936,
1769472, 1835008, 1900544, 1966080, 2031616, 2097152, 2162688, 2228224,
2293760, 2359296, 2424832, 2490368, 2555904, 2621440, 2686976, 2752512,
2818048, 2883584, 2949120, 3014656, 3080192, 3145728, 3211264, 3276800,
3342336, 3407872, 3473408, 3538944, 3604480, 3670016, 3735552, 3801088,
3866624, 3932160, 3997696, 4063232, 4128768, 4194304'





More information about the pve-devel mailing list