From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 932C61FF170
	for <inbox@lore.proxmox.com>; Thu, 12 Jun 2025 16:05:21 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id BB6AA1F7F7;
	Thu, 12 Jun 2025 16:03:31 +0200 (CEST)
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Thu, 12 Jun 2025 16:02:37 +0200
Message-Id: <20250612140253.106555-7-f.ebner@proxmox.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250612140253.106555-1-f.ebner@proxmox.com>
References: <20250612140253.106555-1-f.ebner@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.032 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH qemu-server 06/22] drive: remove geometry
 options gone since QEMU 3.1
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

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 ancient backup with these
options set and they will be automatically dropped.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 PVE/QemuServer.pm       |  2 +-
 PVE/QemuServer/Drive.pm | 30 +++++-------------------------
 2 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 5408ba8a..3803e64e 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1457,7 +1457,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/PVE/QemuServer/Drive.pm b/PVE/QemuServer/Drive.pm
index 297f6bef..c7fd29e3 100644
--- a/PVE/QemuServer/Drive.pm
+++ b/PVE/QemuServer/Drive.pm
@@ -170,27 +170,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."
@@ -700,7 +679,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]
@@ -777,8 +756,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';
     }
 
@@ -791,7 +769,9 @@ sub parse_drive {
 
 sub print_drive {
     my ($drive, $with_alloc) = @_;
-    my $skip = [ 'index', 'interface' ];
+    # clys, heads, secs and trans were removed in QEMU 3.1, but they could still appear in old
+    # backups, so skip them for restore
+    my $skip = [ 'index', 'interface', 'cyls', 'heads', 'secs', 'trans' ];
     my $fmt = $with_alloc ? $alldrive_fmt_with_alloc : $alldrive_fmt;
     return PVE::JSONSchema::print_property_string($drive, $fmt, $skip);
 }
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel