]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: raise an error when trying to use readonly ide disks
authorGiuseppe Scrivano <gscrivan@redhat.com>
Mon, 30 Jun 2014 10:05:06 +0000 (12:05 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 2 Jul 2014 06:17:23 +0000 (08:17 +0200)
The IDE bus doesn't support readonly disks, so inform the user with an
error message instead of let qemu fail with a more obscure "Device
'ide-hd' could not be initialized" error message.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1112939
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
src/qemu/qemu_command.c

index 63f322a41265a1f6cb1345e34c22ebe19d79d05f..48291760bff33f57627375b4bd868fd84a324229 100644 (file)
@@ -3385,8 +3385,15 @@ qemuBuildDriveStr(virConnectPtr conn,
         disk->bus != VIR_DOMAIN_DISK_BUS_IDE)
         virBufferAddLit(&opt, ",boot=on");
     if (disk->readonly &&
-        virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY))
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) {
+        if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE &&
+            disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("readonly ide disks are not supported"));
+            goto error;
+        }
         virBufferAddLit(&opt, ",readonly=on");
+    }
     if (disk->transient) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("transient disks not supported yet"));