9119d9
From 434be9a2661b53b45d592611d45d81fda8dc4510 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <434be9a2661b53b45d592611d45d81fda8dc4510@dist-git>
9119d9
From: Giuseppe Scrivano <gscrivan@redhat.com>
9119d9
Date: Mon, 22 Sep 2014 17:33:45 +0200
9119d9
Subject: [PATCH] qemu: raise an error when trying to use readonly sata disks
9119d9
9119d9
commit 72f919f558902968bd0cf9f99f25ac62cbfe3ac6 introduced an user
9119d9
friendly error message when trying to use IDE disks as readonly.
9119d9
9119d9
Do the same thing for the SATA bus.
9119d9
9119d9
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1112939
9119d9
9119d9
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
9119d9
(cherry picked from commit 75d6f42f427506a97be086e986d00778f46671d1)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_command.c | 16 +++++++++++-----
9119d9
 1 file changed, 11 insertions(+), 5 deletions(-)
9119d9
9119d9
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
9119d9
index 82ee58b..05f328a 100644
9119d9
--- a/src/qemu/qemu_command.c
9119d9
+++ b/src/qemu/qemu_command.c
9119d9
@@ -3507,11 +3507,17 @@ qemuBuildDriveStr(virConnectPtr conn,
9119d9
         virBufferAddLit(&opt, ",boot=on");
9119d9
     if (disk->src->readonly &&
9119d9
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) {
9119d9
-        if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE &&
9119d9
-            disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
9119d9
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
9119d9
-                           _("readonly ide disks are not supported"));
9119d9
-            goto error;
9119d9
+        if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
9119d9
+            if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) {
9119d9
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
9119d9
+                               _("readonly ide disks are not supported"));
9119d9
+                goto error;
9119d9
+            }
9119d9
+            if (disk->bus == VIR_DOMAIN_DISK_BUS_SATA) {
9119d9
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
9119d9
+                               _("readonly sata disks are not supported"));
9119d9
+                goto error;
9119d9
+            }
9119d9
         }
9119d9
         virBufferAddLit(&opt, ",readonly=on");
9119d9
     }
9119d9
-- 
9119d9
2.1.1
9119d9