Re: [PATCH 03/11] nodedev: Add ability to find a vport capable vHBA

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

 



On Fri, Nov 18, 2016 at 09:26:29AM -0500, John Ferlan wrote:
If a <parent> is not supplied in the XML used to create a non-persistent
vHBA, then instead of failing, let's try to find a "vports" capable node
device and use that.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
src/conf/node_device_conf.c          | 39 ++++++++++++++++++++++++++++++++++++
src/conf/node_device_conf.h          |  3 +++
src/libvirt_private.syms             |  1 +
src/node_device/node_device_driver.c | 15 +++++++++-----
4 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 5396681..3aa77cf 100644
+
+int
+virNodeDeviceFindVportParentHost(virNodeDeviceObjListPtr devs,
+                                 int *parent_host)
+{
+    virNodeDeviceObjPtr parent = NULL;
+    int ret;
+
+    if (!(parent = virNodeDeviceFindByCap(devs, "vports"))) {

Why do we pass the capability as a string?

+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Could not find any vport capable device"));
+        return -1;
+    }
+

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 91bb142..0e091fe 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -584,11 +584,16 @@ nodeDeviceCreateXML(virConnectPtr conn,
    if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
        goto cleanup;

-    if (virNodeDeviceGetParentHost(&driver->devs,
-                                   def->name,
-                                   def->parent,
-                                   &parent_host) == -1) {
-        goto cleanup;
+    if (def->parent) {
+        if (virNodeDeviceGetParentHost(&driver->devs,
+                                       def->name,
+                                       def->parent,
+                                       &parent_host) < 0)
+            goto cleanup;
+    } else {
+        /* Try to find "a" vport capable scsi_host when no parent supplied */

The quotes make me nervous.

+        if (virNodeDeviceFindVportParentHost(&driver->devs, &parent_host) < 0)
+            goto cleanup;
    }

ACK

Jan

Attachment: signature.asc
Description: Digital signature

--
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]
  Powered by Linux