]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Add createVHBAByNodeDevice-parent-fabric-wwn to fchosttest
authorJohn Ferlan <jferlan@redhat.com>
Tue, 24 Jan 2017 18:53:08 +0000 (13:53 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Sun, 19 Feb 2017 11:45:09 +0000 (06:45 -0500)
Add a test that allows providing the parent fabric_wwn in the input XML
in order to create the vHBA.

This also fixes a mixed setting of the fabric_wwn field from the read
test driver XML strings.

src/conf/node_device_conf.c
tests/fchosttest.c

index 31ca45646ca06b7ad9de8f28b12cb41e933bf4f7..1c81b48053f3304bb97fc06368d9427ea72dbf43 100644 (file)
 #include "virbuffer.h"
 #include "viruuid.h"
 #include "virrandom.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_NODEDEV
 
+VIR_LOG_INIT("conf.node_device_conf");
+
 VIR_ENUM_IMPL(virNodeDevDevnode, VIR_NODE_DEV_DEVNODE_LAST,
               "dev",
               "link")
@@ -1086,6 +1089,11 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt,
                 }
             }
 
+            if (virNodeDevCapsDefParseString("string(./fabric_wwn[1])",
+                                             ctxt,
+                                             &data->scsi_host.fabric_wwn) < 0)
+                VIR_DEBUG("No fabric_wwn defined for '%s'", def->name);
+
             ctxt->node = orignode2;
 
         } else {
index d083104dcb70d42d9644d2dc85038ee92ca9f7ec..51fdcbd47878833e0613a834179a2ae2b903b5b9 100644 (file)
@@ -64,6 +64,17 @@ static const char test9_xml[] =
 "  </capability>"
 "</device>";
 
+/* virNodeDeviceCreateXML using "<parent fabric_wwn='%s'/>" to find the
+ * vport capable HBA */
+static const char test10_xml[] =
+"<device>"
+"  <parent fabric_wwn='2000000043214321'/>"
+"  <capability type='scsi_host'>"
+"    <capability type='fc_host'>"
+"    </capability>"
+"  </capability>"
+"</device>";
+
 /* Test virIsVHBACapable */
 static int
 test1(const void *data ATTRIBUTE_UNUSED)
@@ -296,6 +307,9 @@ mymain(void)
     if (virTestRun("manageVHBAByNodeDevice-parent-wwn", manageVHBAByNodeDevice,
                    test9_xml) < 0)
         ret = -1;
+    if (virTestRun("manageVHBAByNodeDevice-parent-fabric-wwn",
+                   manageVHBAByNodeDevice, test10_xml) < 0)
+        ret = -1;
 
  cleanup:
     VIR_FREE(fchost_prefix);