[pve-devel] [PATCH qemu-server] fix #2862: allow sata/ide template backups

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Apr 26 14:11:03 CEST 2021


for IDE and SATA, setting the whole drive into readonly mode is not
possible. skip the readonly flag for such drives as a workaround until
we find a better solution.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---

Notes:
    tested backing up a template with SATA, IDE, virtio-block and virtio-scsi with a few storages

 PVE/QemuServer.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index e768072..638077c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3647,7 +3647,13 @@ sub config_to_command {
 	}
 
 	my $drive_cmd = print_drive_commandline_full($storecfg, $vmid, $drive, $pbs_name);
-	$drive_cmd .= ',readonly' if PVE::QemuConfig->is_template($conf);
+
+	# extra protection for templates, but SATA and IDE don't support it..
+	my $read_only = PVE::QemuConfig->is_template($conf)
+	    && $drive->{interface} ne 'sata'
+	    && $drive->{interface} ne 'ide';
+
+	$drive_cmd .= ',readonly' if $read_only;
 
 	push @$devices, '-drive',$drive_cmd;
 	push @$devices, '-device', print_drivedevice_full(
-- 
2.20.1





More information about the pve-devel mailing list