[pve-devel] [PATCH qemu-server v2 16/18] machine: rename machine_version() function to machine_version_at_least()

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jan 17 13:39:06 CET 2025


Am 16.01.25 um 12:50 schrieb Fiona Ebner:
> The old name does not make it clear what exactly the function does.
> 
> Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
> ---
>  PVE/QemuServer.pm         | 4 ++--
>  PVE/QemuServer/Machine.pm | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 6f2a9aed..58d23533 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -4532,7 +4532,7 @@ sub qemu_cpu_hotplug {
>  
>      if ($vcpus < $currentvcpus) {
>  
> -	if (PVE::QemuServer::Machine::machine_version($machine_type, 2, 7)) {
> +	if (PVE::QemuServer::Machine::machine_version_at_least($machine_type, 2, 7)) {
>  
>  	    for (my $i = $currentvcpus; $i > $vcpus; $i--) {
>  		qemu_devicedel($vmid, "cpu$i");
> @@ -4560,7 +4560,7 @@ sub qemu_cpu_hotplug {
>      die "vcpus in running vm does not match its configuration\n"
>  	if scalar(@{$currentrunningvcpus}) != $currentvcpus;
>  
> -    if (PVE::QemuServer::Machine::machine_version($machine_type, 2, 7)) {
> +    if (PVE::QemuServer::Machine::machine_version_at_least($machine_type, 2, 7)) {
>  	my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
>  
>  	for (my $i = $currentvcpus+1; $i <= $vcpus; $i++) {
> diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
> index 9b18cf6e..6398e756 100644
> --- a/PVE/QemuServer/Machine.pm
> +++ b/PVE/QemuServer/Machine.pm
> @@ -136,7 +136,7 @@ sub extract_version {
>      return;
>  }
>  
> -sub machine_version {
> +sub machine_version_at_least {

maybe use the chance and prefix with is_ to make this even more clear, i.e.
is_version_at_least or to be very verbose: is_version_greater_or_equal (no
hard feelings there though).


>      my ($machine_type, $major, $minor, $pve) = @_;
>  
>      return PVE::QemuServer::Helpers::min_version(





More information about the pve-devel mailing list