[libvirt] [PATCH v1 07/19] conf: Prevent use of shareable on vhost-scsi devices

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


Starting two guests using the same vhost-scsi target results
in an error when opening /dev/vhost-scsi.  Since "shareable"
suggests there's a way around this, let's disallow this tag
when using vhost-scsi protocol for our hostdev device.

Suggested-by: Marc Hartmayer <mhartmay at linux.vnet.ibm.com>
Signed-off-by: Eric Farman <farman at linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
---
 src/conf/domain_conf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d6b9c42..b67d0ea 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12840,6 +12840,14 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
                 def->readonly = true;
             if (virXPathBoolean("boolean(./shareable)", ctxt))
                 def->shareable = true;
+            if (def->source.subsys.u.scsi.protocol ==
+                VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_VHOST &&
+                def->shareable) {
+                virReportError(VIR_ERR_XML_ERROR, "%s",
+                               _("Devices connected with vhost-scsi protocol "
+                                 "cannot be marked shareable"));
+                goto error;
+            }
             break;
         }
     }
-- 
1.9.1




More information about the libvir-list mailing list