summaryrefslogtreecommitdiff
path: root/usr/src/lib/mpapi
diff options
context:
space:
mode:
authordh142964 <David.Hollister@Sun.COM>2009-09-30 13:40:27 -0600
committerdh142964 <David.Hollister@Sun.COM>2009-09-30 13:40:27 -0600
commit4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6 (patch)
tree17ba947a21901975bb128b8c535cb0575d4c9a4a /usr/src/lib/mpapi
parent7b57f05abb8796d3c91c8d4d4c75dcafb5af6b69 (diff)
downloadillumos-gate-4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6.tar.gz
PSARC 2008/672 thebe SAS/SATA driver
PSARC 2008/755 ddi_ssoft_state(9F) and ddi_isoft_state(9F) PSARC 2008/764 Cfgadm SCSI-Plugin MPxIO Support PSARC 2009/125 scsi_device property interfaces 6726110 pmcs driver (driver for thebe) 6726867 SCSAv3
Diffstat (limited to 'usr/src/lib/mpapi')
-rw-r--r--usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c
index b15a807dfa..2f4315fb56 100644
--- a/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c
+++ b/usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMultipathLusPlugin.c
@@ -32,9 +32,40 @@
#include <libdevinfo.h>
+/*
+ * Checks whether there is online path or not.
+ * - no path found returns -1.
+ * - online/standby path found returns 1.
+ * - path exists but no online/standby path found returns 0.
+ */
+static int checkAvailablePath(di_node_t node)
+{
+ di_path_t path;
+ di_path_state_t state;
+
+ if ((path = di_path_client_next_path(node, DI_PATH_NIL))
+ == DI_PATH_NIL) {
+ log(LOG_INFO, "checkAvailalblePath()",
+ " - No path found");
+ return (-1);
+ }
+
+ do {
+ /* ignore the path that is neither online nor standby. */
+ if (((state = di_path_state(path)) == DI_PATH_STATE_ONLINE) ||
+ (state == DI_PATH_STATE_STANDBY)) {
+ return (1);
+ }
+ } while ((path = di_path_client_next_path(node, path)) != DI_PATH_NIL);
+
+ /* return 0 for the case that there is no online path to the node. */
+ log(LOG_INFO, "checkAvailalblePath()", " - No online path found");
+ return (0);
+}
+
static int getOidList(di_node_t root_node, MP_OID_LIST *pOidList)
{
- int numNodes = 0;
+ int numNodes = 0, state;
MP_UINT64 instNum = 0;
@@ -59,8 +90,21 @@ static int getOidList(di_node_t root_node, MP_OID_LIST *pOidList)
while (DI_NODE_NIL != sv_child_node) {
- /* Skip the node which is not online. */
- if (di_state(sv_child_node) != 0) {
+ /* skip the node which is offline, down or detached. */
+ state = di_state(sv_child_node);
+ if ((state & DI_DEVICE_DOWN) ||
+ (state & DI_DEVICE_OFFLINE)) {
+ sv_child_node = di_sibling_node(sv_child_node);
+ continue;
+ }
+
+ /*
+ * skip if the node doesn't have any path avaialble.
+ * If any path is found from the DINFOCACHE snaphost
+ * that means the driver keeps track of the path regadless
+ * of state.
+ */
+ if (checkAvailablePath(sv_child_node) == -1) {
sv_child_node = di_sibling_node(sv_child_node);
continue;
}