[libvirt] [PATCH v1 09/19] qemu: Refactor qemuBuildHostdevCommandLine for non-vhost devices

Eric Farman farman at linux.vnet.ibm.com
Mon Jul 25 20:48:10 UTC 2016


Let's adjust some of the indentation in the command line code for the
upcoming vhost-scsi support, so we can keep existing code separate
from the new code that we'll add.

Signed-off-by: Eric Farman <farman at linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
---
 src/qemu/qemu_command.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4558b9f..dd15ff8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4954,18 +4954,20 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
         if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
             subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
             if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCSI_GENERIC)) {
-                char *drvstr;
+                if (hostdev->source.subsys.u.scsi.protocol != VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_VHOST) {
+                    char *drvstr;
 
-                virCommandAddArg(cmd, "-drive");
-                if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev)))
-                    return -1;
-                virCommandAddArg(cmd, drvstr);
-                VIR_FREE(drvstr);
+                    virCommandAddArg(cmd, "-drive");
+                    if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev)))
+                        return -1;
+                    virCommandAddArg(cmd, drvstr);
+                    VIR_FREE(drvstr);
 
-                virCommandAddArg(cmd, "-device");
-                if (!(devstr = qemuBuildSCSIHostdevDevStr(def, hostdev,
-                                                          qemuCaps)))
-                    return -1;
+                    virCommandAddArg(cmd, "-device");
+                    if (!(devstr = qemuBuildSCSIHostdevDevStr(def, hostdev,
+                                                              qemuCaps)))
+                        return -1;
+                }
                 virCommandAddArg(cmd, devstr);
                 VIR_FREE(devstr);
             } else {
-- 
1.9.1




More information about the libvir-list mailing list