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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Eric Farman <farman@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]