summaryrefslogtreecommitdiffstats
path: root/plugins/netapp/netapp-nvme.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--plugins/netapp/netapp-nvme.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/plugins/netapp/netapp-nvme.c b/plugins/netapp/netapp-nvme.c
index 2ecdcc5..99f0a20 100644
--- a/plugins/netapp/netapp-nvme.c
+++ b/plugins/netapp/netapp-nvme.c
@@ -46,12 +46,14 @@ enum {
enum {
ONTAP_C2_LOG_SUPPORTED_LSP = 0x0,
ONTAP_C2_LOG_NSINFO_LSP = 0x1,
+ ONTAP_C2_LOG_PLATFORM_LSP = 0x2,
};
enum {
- ONTAP_VSERVER_TLV = 0x11,
- ONTAP_VOLUME_TLV = 0x12,
- ONTAP_NS_TLV = 0x13,
+ ONTAP_VSERVER_NAME_TLV = 0x11,
+ ONTAP_VOLUME_NAME_TLV = 0x12,
+ ONTAP_NS_NAME_TLV = 0x13,
+ ONTAP_NS_PATH_TLV = 0x14,
};
static const char *dev_path = "/dev/";
@@ -134,8 +136,10 @@ static void netapp_get_ontap_labels(char *vsname, char *nspath,
unsigned char *log_data)
{
int lsp, tlv, label_len;
- char *vserver_name, *volume_name, *namespace_name;
+ char *vserver_name, *volume_name, *namespace_name, *namespace_path;
char vol_name[ONTAP_LABEL_LEN], ns_name[ONTAP_LABEL_LEN];
+ char ns_path[ONTAP_LABEL_LEN];
+ bool nspath_tlv_available = false;
const char *ontap_vol = "/vol/";
int i, j;
@@ -145,9 +149,9 @@ static void netapp_get_ontap_labels(char *vsname, char *nspath,
/* lsp not related to nsinfo */
return;
- /* get the vserver tlv and name */
+ /* get the vserver name tlv */
tlv = *(__u8 *)&log_data[32];
- if (tlv == ONTAP_VSERVER_TLV) {
+ if (tlv == ONTAP_VSERVER_NAME_TLV) {
label_len = (*(__u16 *)&log_data[34]) * 4;
vserver_name = (char *)&log_data[36];
ontap_labels_to_str(vsname, vserver_name, label_len);
@@ -159,9 +163,9 @@ static void netapp_get_ontap_labels(char *vsname, char *nspath,
i = 36 + label_len;
j = i + 2;
- /* get the volume tlv and name */
+ /* get the volume name tlv */
tlv = *(__u8 *)&log_data[i];
- if (tlv == ONTAP_VOLUME_TLV) {
+ if (tlv == ONTAP_VOLUME_NAME_TLV) {
label_len = (*(__u16 *)&log_data[j]) * 4;
volume_name = (char *)&log_data[j + 2];
ontap_labels_to_str(vol_name, volume_name, label_len);
@@ -173,9 +177,9 @@ static void netapp_get_ontap_labels(char *vsname, char *nspath,
i += 4 + label_len;
j += 4 + label_len;
- /* get the namespace tlv and name */
+ /* get the namespace name tlv */
tlv = *(__u8 *)&log_data[i];
- if (tlv == ONTAP_NS_TLV) {
+ if (tlv == ONTAP_NS_NAME_TLV) {
label_len = (*(__u16 *)&log_data[j]) * 4;
namespace_name = (char *)&log_data[j + 2];
ontap_labels_to_str(ns_name, namespace_name, label_len);
@@ -185,8 +189,25 @@ static void netapp_get_ontap_labels(char *vsname, char *nspath,
return;
}
- snprintf(nspath, ONTAP_NS_PATHLEN, "%s%s%s%s", ontap_vol,
+ i += 4 + label_len;
+ j += 4 + label_len;
+ /* get the namespace path tlv if available */
+ tlv = *(__u8 *)&log_data[i];
+ if (tlv == ONTAP_NS_PATH_TLV) {
+ nspath_tlv_available = true;
+ label_len = (*(__u16 *)&log_data[j]) * 4;
+ namespace_path = (char *)&log_data[j + 2];
+ ontap_labels_to_str(ns_path, namespace_path, label_len);
+ }
+
+ if (nspath_tlv_available) {
+ /* set nspath from the corresponding ns_path string */
+ snprintf(nspath, ONTAP_NS_PATHLEN, "%s", ns_path);
+ } else {
+ /* set nspath by concatenating ontap_vol with ns_name */
+ snprintf(nspath, ONTAP_NS_PATHLEN, "%s%s%s%s", ontap_vol,
vol_name, "/", ns_name);
+ }
}
static void netapp_smdevice_json(struct json_object *devices, char *devname,