Skip to content

Commit cb97c7f

Browse files
committed
pmdainfiniband: remove a leftover diagnostic, fix indendation
1 parent 4594676 commit cb97c7f

File tree

2 files changed

+21
-31
lines changed

2 files changed

+21
-31
lines changed

qa/1996.out

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ QA output created by 1996
33
== Testing InfiniBand PMDA with mock libraries - ib-root-001.tgz ==
44

55
=== HCA (Host Channel Adapter) metrics ===
6-
pminfo[PID] Info: mthca0
76
pminfo[PID] Info: No IB ports found to monitor
87

98
infiniband.hca.numports PMID: 91.0.2 [Number of ports on HCA]
@@ -19,7 +18,6 @@ Help:
1918
Number of protection domains currently allocated on this HCA.
2019

2120
=== Port state metrics ===
22-
pminfo[PID] Info: mthca0
2321
pminfo[PID] Info: No IB ports found to monitor
2422

2523
infiniband.port.state PMID: 91.0.10 [Port's state]
@@ -29,7 +27,6 @@ Help:
2927
Port's state - can be Active, Down, NoChange, Armed or Initialize
3028

3129
=== Port performance counters ===
32-
pminfo[PID] Info: mthca0
3330
pminfo[PID] Info: No IB ports found to monitor
3431

3532
infiniband.port.in.bytes PMID: 91.1.0 [Bytes received]
@@ -59,7 +56,6 @@ counter. When a value of saturated counter reaches predefined threshold,
5956
the counter is reset after its value is copied into internal state.
6057

6158
=== Sysfs-based metrics ===
62-
pminfo[PID] Info: mthca0
6359
pminfo[PID] Info: No IB ports found to monitor
6460

6561
infiniband.hca.board_id PMID: 91.0.17 [HCA board identifier]
@@ -80,7 +76,6 @@ Text description of the node this port belongs to.
8076
== Testing InfiniBand PMDA with mock libraries - ib-root-002.tgz ==
8177

8278
=== HCA (Host Channel Adapter) metrics ===
83-
pminfo[PID] Info: mthca0
8479
pminfo[PID] Info: No IB ports found to monitor
8580

8681
infiniband.hca.numports PMID: 91.0.2 [Number of ports on HCA]
@@ -96,7 +91,6 @@ Help:
9691
Number of protection domains currently allocated on this HCA.
9792

9893
=== Port state metrics ===
99-
pminfo[PID] Info: mthca0
10094
pminfo[PID] Info: No IB ports found to monitor
10195

10296
infiniband.port.state PMID: 91.0.10 [Port's state]
@@ -106,7 +100,6 @@ Help:
106100
Port's state - can be Active, Down, NoChange, Armed or Initialize
107101

108102
=== Port performance counters ===
109-
pminfo[PID] Info: mthca0
110103
pminfo[PID] Info: No IB ports found to monitor
111104

112105
infiniband.port.in.bytes PMID: 91.1.0 [Bytes received]
@@ -136,7 +129,6 @@ counter. When a value of saturated counter reaches predefined threshold,
136129
the counter is reset after its value is copied into internal state.
137130

138131
=== Sysfs-based metrics ===
139-
pminfo[PID] Info: mthca0
140132
pminfo[PID] Info: No IB ports found to monitor
141133

142134
infiniband.hca.board_id PMID: 91.0.17 [HCA board identifier]

src/pmdas/infiniband/ib.c

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -391,25 +391,24 @@ ib_load_config(const char *cp, int writeconf, pmdaIndom *itab, unsigned int nind
391391
/* else no config file: Just monitor local ports */
392392

393393
for (i=0; i < n; i++) {
394-
print(hcas[i]);
395-
if (umad_get_ca(hcas[i], &st[i].ca) == 0) {
396-
int e = pmdaCacheStore(itab[IB_HCA_INDOM].it_indom, PMDA_CACHE_ADD,
397-
st[i].ca.ca_name, &st[i].ca);
398-
399-
if (e < 0) {
400-
pmNotifyErr(LOG_ERR,
401-
"Cannot add instance for %s to the cache - %s\n",
402-
st[i].ca.ca_name, pmErrStr(e));
403-
continue;
404-
}
394+
if (umad_get_ca(hcas[i], &st[i].ca) == 0) {
395+
sts = pmdaCacheStore(itab[IB_HCA_INDOM].it_indom, PMDA_CACHE_ADD,
396+
st[i].ca.ca_name, &st[i].ca);
397+
398+
if (sts < 0) {
399+
pmNotifyErr(LOG_ERR,
400+
"Cannot add instance for %s to the cache - %s\n",
401+
st[i].ca.ca_name, pmErrStr(sts));
402+
continue;
403+
}
405404

406-
foreachport(st+i, openumadport, NULL);
407-
if (fconf == NULL)
408-
/* No config file - monitor local ports */
409-
foreachport(st+i, monitorport, itab);
410-
if (writeconf)
411-
foreachport(st+i, printportconfig, fconf);
412-
}
405+
foreachport(st+i, openumadport, NULL);
406+
if (fconf == NULL)
407+
/* No config file - monitor local ports */
408+
foreachport(st+i, monitorport, itab);
409+
if (writeconf)
410+
foreachport(st+i, printportconfig, fconf);
411+
}
413412
}
414413

415414
if (fconf) {
@@ -441,7 +440,6 @@ ib_load_config(const char *cp, int writeconf, pmdaIndom *itab, unsigned int nind
441440
for (i=0; i < ARRAYSZ(mad_cnt_descriptors); i++) {
442441
itab[IB_CNT_INDOM].it_set[i].i_inst = i;
443442
itab[IB_CNT_INDOM].it_set[i].i_name = mad_cnt_descriptors[i].name;
444-
445443
}
446444

447445
return 0;
@@ -591,13 +589,13 @@ char* read_sysfs_file(const char* filename)
591589
FILE *file;
592590
char *buffer = NULL;
593591
size_t total_size = 0;
594-
size_t buffer_size = 0;
595-
const size_t CHUNK_SIZE = 256;
592+
size_t buffer_size;
593+
const size_t CHUNK_SIZE = 256;
596594
char chunk[CHUNK_SIZE];
597595

598596
file = fopen(filename, "r");
599597
if (file == NULL) {
600-
pmNotifyErr(LOG_INFO, "Failed to open file");
598+
pmNotifyErr(LOG_INFO, "Failed to open file: %s", filename);
601599
return NULL;
602600
}
603601

@@ -631,7 +629,7 @@ char* read_sysfs_file(const char* filename)
631629
buffer[total_size] = '\0';
632630

633631
if (ferror(file)) {
634-
pmNotifyErr(LOG_INFO, "Error reading file");
632+
pmNotifyErr(LOG_INFO, "Error reading sysfs file");
635633
free(buffer);
636634
buffer = NULL;
637635
}

0 commit comments

Comments
 (0)