[pve-devel] [PATCH qemu-server v2 08/32] drive: remove geometry options gone since QEMU 3.1

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Jun 20 13:03:32 CEST 2025


On June 18, 2025 3:01 pm, Fiona Ebner wrote:
> It was not possible to start a QEMU instance with these options set
> since QEMU version 3.1, QEMU commit b24ec3c462 ("block: Remove
> deprecated -drive geometry options") and thus also not to take a
> backup. It is still possible to restore an old backup with these
> options set.

we could do this unconditionally on parsing a drive line, it doesn't
really matter whether the context is regular parsing or restore parsing,
it's better to just drop the offending properties rather than the whole
drive in both cases.

while it is not very likely such old configs are still around, it would
also allow us to drop the previous two patches and keep the interface
simpler..

unrelated to this series and thus not high priority - it might be nice
to think whether we have other properties that we could drop from the
schema(s) for 9.0 thanks to this new option..

> Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
> ---
> 
> Changes in v2:
> * Different approach, skip dropped keys, rather than allowing all
>   additional properties.
> 
>  src/PVE/QemuServer.pm       |  2 +-
>  src/PVE/QemuServer/Drive.pm | 28 +++-------------------------
>  2 files changed, 4 insertions(+), 26 deletions(-)
> 
> diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
> index cfeb8949..95a84c56 100644
> --- a/src/PVE/QemuServer.pm
> +++ b/src/PVE/QemuServer.pm
> @@ -1543,7 +1543,7 @@ sub print_drive_commandline_full {
>      my $is_rbd = $path =~ m/^rbd:/;
>  
>      my $opts = '';
> -    my @qemu_drive_options = qw(heads secs cyls trans media cache rerror werror aio discard);
> +    my @qemu_drive_options = qw(media cache rerror werror aio discard);
>      foreach my $o (@qemu_drive_options) {
>          $opts .= ",$o=$drive->{$o}" if defined($drive->{$o});
>      }
> diff --git a/src/PVE/QemuServer/Drive.pm b/src/PVE/QemuServer/Drive.pm
> index 0e99257b..96bb12c4 100644
> --- a/src/PVE/QemuServer/Drive.pm
> +++ b/src/PVE/QemuServer/Drive.pm
> @@ -26,7 +26,7 @@ our @EXPORT_OK = qw(
>      print_drive
>  );
>  
> -my $DROPPED_PROPERTIES = [];
> +my $DROPPED_PROPERTIES = ['cyls', 'heads', 'secs', 'trans'];
>  
>  our $QEMU_FORMAT_RE = qr/raw|qcow|qcow2|qed|vmdk|cloop/;
>  
> @@ -176,27 +176,6 @@ my %drivedesc_base = (
>          default => 'disk',
>          optional => 1,
>      },
> -    cyls => {
> -        type => 'integer',
> -        description => "Force the drive's physical geometry to have a specific cylinder count.",
> -        optional => 1,
> -    },
> -    heads => {
> -        type => 'integer',
> -        description => "Force the drive's physical geometry to have a specific head count.",
> -        optional => 1,
> -    },
> -    secs => {
> -        type => 'integer',
> -        description => "Force the drive's physical geometry to have a specific sector count.",
> -        optional => 1,
> -    },
> -    trans => {
> -        type => 'string',
> -        enum => [qw(none lba auto)],
> -        description => "Force disk geometry bios translation mode.",
> -        optional => 1,
> -    },
>      snapshot => {
>          type => 'boolean',
>          description => "Controls qemu's snapshot mode feature."
> @@ -765,7 +744,7 @@ sub drive_is_read_only {
>      return $drive->{interface} ne 'sata' && $drive->{interface} ne 'ide';
>  }
>  
> -# ideX = [volume=]volume-id[,media=d][,cyls=c,heads=h,secs=s[,trans=t]]
> +# ideX = [volume=]volume-id[,media=d]
>  #        [,snapshot=on|off][,cache=on|off][,format=f][,backup=yes|no]
>  #        [,rerror=ignore|report|stop][,werror=enospc|ignore|report|stop]
>  #        [,aio=native|threads][,discard=ignore|on][,detect_zeroes=on|off]
> @@ -843,8 +822,7 @@ sub parse_drive {
>      return if $res->{iops_wr} && $res->{iops};
>  
>      if ($res->{media} && ($res->{media} eq 'cdrom')) {
> -        return if $res->{snapshot} || $res->{trans} || $res->{format};
> -        return if $res->{heads} || $res->{secs} || $res->{cyls};
> +        return if $res->{snapshot} || $res->{format};
>          return if $res->{interface} eq 'virtio';
>      }
>  
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




More information about the pve-devel mailing list