]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_monitor_text: Catch IOMMU/VFIO related errors in qemuMonitorTextAddDrive
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 26 Sep 2019 06:25:50 +0000 (08:25 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 17 Dec 2019 09:04:44 +0000 (10:04 +0100)
Because this is a HMP we're dealing with, there is nothing like
class of reply message, so we have to do some string comparison
to guess if the command fails. Well, with NVMe disks whole new
class of errors comes to play because qemu needs to initialize
IOMMU and VFIO for them. You can see all the messages it may
produce in qemu_vfio_init_pci().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
src/qemu/qemu_monitor_text.c

index b38723582148b794fc7749ccc1400e54bf8d7313..70ecd2281b60431bd34f76cfc0ed8ebad2b6576c 100644 (file)
@@ -75,6 +75,13 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
         goto cleanup;
     }
 
+    if (strstr(reply, "IOMMU") ||
+        strstr(reply, "VFIO")) {
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                       reply);
+        goto cleanup;
+    }
+
     ret = 0;
 
  cleanup: