summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libvirt/libvirt.h.in5
-rw-r--r--src/driver.h6
-rw-r--r--src/libvirt.c46
-rw-r--r--src/libvirt_public.syms5
4 files changed, 62 insertions, 0 deletions
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 30762b1be9..ad30cd04c2 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -3257,6 +3257,11 @@ int virConnectListAllNodeDevices (virConnectPtr conn,
virNodeDevicePtr virNodeDeviceLookupByName (virConnectPtr conn,
const char *name);
+virNodeDevicePtr virNodeDeviceLookupSCSIHostByWWN (virConnectPtr conn,
+ const char *wwnn,
+ const char *wwpn,
+ unsigned int flags);
+
const char * virNodeDeviceGetName (virNodeDevicePtr dev);
const char * virNodeDeviceGetParent (virNodeDevicePtr dev);
diff --git a/src/driver.h b/src/driver.h
index 02ddd83d11..8d0f0a56e1 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -1553,6 +1553,11 @@ typedef int (*virDevMonListAllNodeDevices)(virConnectPtr conn,
typedef virNodeDevicePtr (*virDevMonDeviceLookupByName)(virConnectPtr conn,
const char *name);
+typedef virNodeDevicePtr (*virDevMonDeviceLookupSCSIHostByWWN)(virConnectPtr conn,
+ const char *wwnn,
+ const char *wwpn,
+ unsigned int flags);
+
typedef char * (*virDevMonDeviceGetXMLDesc)(virNodeDevicePtr dev,
unsigned int flags);
@@ -1584,6 +1589,7 @@ struct _virDeviceMonitor {
virDevMonListDevices listDevices;
virDevMonListAllNodeDevices listAllNodeDevices;
virDevMonDeviceLookupByName deviceLookupByName;
+ virDevMonDeviceLookupSCSIHostByWWN deviceLookupSCSIHostByWWN;
virDevMonDeviceGetXMLDesc deviceGetXMLDesc;
virDevMonDeviceGetParent deviceGetParent;
virDevMonDeviceNumOfCaps deviceNumOfCaps;
diff --git a/src/libvirt.c b/src/libvirt.c
index f81a3de76b..1e78500c19 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -14334,6 +14334,52 @@ error:
return NULL;
}
+/**
+ * virNodeDeviceLookupSCSIHostByWWN:
+ * @conn: pointer to the hypervisor connection
+ * @wwnn: WWNN of the SCSI Host.
+ * @wwpn: WWPN of the SCSI Host.
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Lookup SCSI Host which is capable with 'fc_host' by its WWNN and WWPN.
+ *
+ * Returns a virNodeDevicePtr if found, NULL otherwise.
+ */
+virNodeDevicePtr
+virNodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
+ const char *wwnn,
+ const char *wwpn,
+ unsigned int flags)
+{
+ VIR_DEBUG("conn=%p, wwnn=%p, wwpn=%p, flags=%x", conn, wwnn, wwpn, flags);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virDispatchError(NULL);
+ return NULL;
+ }
+
+ virCheckNonNullArgGoto(wwnn, error);
+ virCheckNonNullArgGoto(wwpn, error);
+
+ if (conn->deviceMonitor &&
+ conn->deviceMonitor->deviceLookupSCSIHostByWWN) {
+ virNodeDevicePtr ret;
+ ret = conn->deviceMonitor->deviceLookupSCSIHostByWWN(conn, wwnn,
+ wwpn, flags);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(conn);
+ return NULL;
+}
/**
* virNodeDeviceGetXMLDesc:
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 9777703a91..3bdfd57dcf 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -603,4 +603,9 @@ LIBVIRT_1.0.2 {
virTypedParamsGetULLong;
} LIBVIRT_1.0.1;
+LIBVIRT_1.0.3 {
+ global:
+ virNodeDeviceLookupSCSIHostByWWN;
+} LIBVIRT_1.0.2;
+
# .... define new API here using predicted next version number ....