[libvirt] [PATCH v2 35/39] qemu_monitor_text: Catch IOMMU/VFIO related errors in qemuMonitorTextAddDrive

Michal Privoznik mprivozn at redhat.com
Thu Sep 26 16:12:31 UTC 2019


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 at redhat.com>
---
 src/qemu/qemu_monitor_text.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index b1abcacdd0..39445247a0 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -76,6 +76,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:
-- 
2.21.0




More information about the libvir-list mailing list