[PATCH v1 15/19] conf: Create vhost-scsi hostdev protocol in dumpxml

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

 



When issuing virsh dumpxml and parsing a hostdev element,
the vhost-scsi protocol needs to be handled separately from
the existing options, to create valid XML.

Signed-off-by: Eric Farman <farman@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
---
 src/conf/domain_conf.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b67d0ea..79087b2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20441,6 +20441,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
     virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
     virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
     virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
+    virDomainHostdevSubsysSCSIVhostPtr vhostsrc = &scsisrc->u.vhost;
 
     if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
         pcisrc->backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
@@ -20470,13 +20471,22 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
             virBufferAddLit(buf, " missing='yes'");
     }
 
-    if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
-        scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
+    if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
         const char *protocol =
             virDomainHostdevSubsysSCSIProtocolTypeToString(scsisrc->protocol);
 
-        virBufferAsprintf(buf, " protocol='%s' name='%s'",
-                          protocol, iscsisrc->path);
+        switch (scsisrc->protocol) {
+        case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI:
+            virBufferAsprintf(buf, " protocol='%s' name='%s'",
+                              protocol, iscsisrc->path);
+            break;
+        case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_VHOST:
+            virBufferAsprintf(buf, " protocol='%s' wwpn='%s'",
+                              protocol, vhostsrc->wwpn);
+            break;
+        default:
+            break;
+        }
     }
 
     virBufferAddLit(buf, ">\n");
@@ -20522,6 +20532,8 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
             virBufferEscapeString(buf, " name='%s'", iscsisrc->hosts[0].name);
             virBufferEscapeString(buf, " port='%s'", iscsisrc->hosts[0].port);
             virBufferAddLit(buf, "/>\n");
+        } else if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_VHOST) {
+            /* Nothing to do here */
         } else {
             virBufferAsprintf(buf, "<adapter name='%s'/>\n",
                               scsihostsrc->adapter);
-- 
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]