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

Ján Tomko jtomko at redhat.com
Mon Jan 2 14:18:32 UTC 2017


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 at redhat.com>
>---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170102/bd13c92f/attachment-0001.sig>


More information about the libvir-list mailing list