|
|
951ecb |
From 28076181217313c7e33bf88cb70eb16c2f8e737f Mon Sep 17 00:00:00 2001
|
|
|
951ecb |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
951ecb |
Date: Thu, 19 Jul 2018 12:38:08 -0500
|
|
|
951ecb |
Subject: [PATCH 1/4] Low: tools: enable file consolidation in crm_report
|
|
|
951ecb |
|
|
|
951ecb |
Correct a variable misspelling that resulted in file de-duplication being
|
|
|
951ecb |
skipped. Also, remove an unused variable, and avoid the unreliable "-a".
|
|
|
951ecb |
Found by static analysis.
|
|
|
951ecb |
---
|
|
|
951ecb |
tools/crm_report.in | 21 ++++++++++++++-------
|
|
|
951ecb |
1 file changed, 14 insertions(+), 7 deletions(-)
|
|
|
951ecb |
|
|
|
951ecb |
diff --git a/tools/crm_report.in b/tools/crm_report.in
|
|
|
951ecb |
index 43ed646..695c1f1 100755
|
|
|
951ecb |
--- a/tools/crm_report.in
|
|
|
951ecb |
+++ b/tools/crm_report.in
|
|
|
951ecb |
@@ -27,7 +27,6 @@ eval set -- "$TEMP"
|
|
|
951ecb |
|
|
|
951ecb |
progname=$(basename "$0")
|
|
|
951ecb |
rsh="ssh -T"
|
|
|
951ecb |
-times=""
|
|
|
951ecb |
tests=""
|
|
|
951ecb |
nodes=""
|
|
|
951ecb |
compress=1
|
|
|
951ecb |
@@ -243,10 +242,18 @@ EOF
|
|
|
951ecb |
# check if files have same content in the cluster
|
|
|
951ecb |
#
|
|
|
951ecb |
cibdiff() {
|
|
|
951ecb |
- d1=`dirname $1`
|
|
|
951ecb |
- d2=`dirname $2`
|
|
|
951ecb |
- if [ -f $d1/RUNNING -a -f $d2/RUNNING ] ||
|
|
|
951ecb |
- [ -f $d1/STOPPED -a -f $d2/STOPPED ]; then
|
|
|
951ecb |
+ d1=$(dirname $1)
|
|
|
951ecb |
+ d2=$(dirname $2)
|
|
|
951ecb |
+
|
|
|
951ecb |
+ if [ -f "$d1/RUNNING" ] && [ ! -f "$d2/RUNNING" ]; then
|
|
|
951ecb |
+ DIFF_OK=0
|
|
|
951ecb |
+ elif [ -f "$d1/STOPPED" ] && [ ! -f "$d2/STOPPED" ]; then
|
|
|
951ecb |
+ DIFF_OK=0
|
|
|
951ecb |
+ else
|
|
|
951ecb |
+ DIFF_OK=1
|
|
|
951ecb |
+ fi
|
|
|
951ecb |
+
|
|
|
951ecb |
+ if [ $DIFF_OK -eq 1 ]; then
|
|
|
951ecb |
if which crm_diff > /dev/null 2>&1; then
|
|
|
951ecb |
crm_diff -c -n $1 -o $2
|
|
|
951ecb |
else
|
|
|
951ecb |
@@ -277,7 +284,7 @@ esac
|
|
|
951ecb |
# remove duplicates if files are same, make links instead
|
|
|
951ecb |
#
|
|
|
951ecb |
consolidate() {
|
|
|
951ecb |
- for n in $NODES; do
|
|
|
951ecb |
+ for n in $nodes; do
|
|
|
951ecb |
if [ -f $1/$2 ]; then
|
|
|
951ecb |
rm $1/$n/$2
|
|
|
951ecb |
else
|
|
|
951ecb |
@@ -290,7 +297,7 @@ consolidate() {
|
|
|
951ecb |
analyze_one() {
|
|
|
951ecb |
rc=0
|
|
|
951ecb |
node0=""
|
|
|
951ecb |
- for n in $NODES; do
|
|
|
951ecb |
+ for n in $nodes; do
|
|
|
951ecb |
if [ "$node0" ]; then
|
|
|
951ecb |
diffcheck $1/$node0/$2 $1/$n/$2
|
|
|
951ecb |
rc=$(($rc+$?))
|
|
|
951ecb |
--
|
|
|
951ecb |
1.8.3.1
|
|
|
951ecb |
|
|
|
951ecb |
|
|
|
951ecb |
From 2db3895359beb0f577c142c03ac2c8e6f44c67cf Mon Sep 17 00:00:00 2001
|
|
|
951ecb |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
951ecb |
Date: Wed, 4 Apr 2018 15:47:18 -0500
|
|
|
951ecb |
Subject: [PATCH 2/4] Low: tools: get sensor lun in ipmiservicelogd before
|
|
|
951ecb |
using it
|
|
|
951ecb |
|
|
|
951ecb |
---
|
|
|
951ecb |
tools/ipmiservicelogd.c | 4 ++--
|
|
|
951ecb |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
951ecb |
|
|
|
951ecb |
diff --git a/tools/ipmiservicelogd.c b/tools/ipmiservicelogd.c
|
|
|
951ecb |
index 47ff220..1047c9c 100644
|
|
|
951ecb |
--- a/tools/ipmiservicelogd.c
|
|
|
951ecb |
+++ b/tools/ipmiservicelogd.c
|
|
|
951ecb |
@@ -434,14 +434,14 @@ sensor_discrete_event_handler(ipmi_sensor_t * sensor,
|
|
|
951ecb |
instance = ipmi_entity_get_entity_instance(ent);
|
|
|
951ecb |
ipmi_sensor_get_id(sensor, name, sizeof(name));
|
|
|
951ecb |
|
|
|
951ecb |
+ ipmi_sensor_get_num(sensor, &sensor_lun, &sensor_number);
|
|
|
951ecb |
+
|
|
|
951ecb |
sel_id = ipmi_entity_get_entity_id(ent);
|
|
|
951ecb |
sel_type = ipmi_entity_get_type(ent);
|
|
|
951ecb |
generator = ipmi_entity_get_slave_address(ent) | (sensor_lun << 5); /* LUN (2 bits) | SLAVE ADDRESS (5 bits) */
|
|
|
951ecb |
version = 0x04;
|
|
|
951ecb |
sensor_type = ipmi_sensor_get_sensor_type(sensor);
|
|
|
951ecb |
|
|
|
951ecb |
- ipmi_sensor_get_num(sensor, &sensor_lun, &sensor_number);
|
|
|
951ecb |
-
|
|
|
951ecb |
event_class = 0; /* @TBD - where does this come from? */
|
|
|
951ecb |
event_type = ipmi_event_get_type(event);
|
|
|
951ecb |
direction = dir;
|
|
|
951ecb |
--
|
|
|
951ecb |
1.8.3.1
|
|
|
951ecb |
|
|
|
951ecb |
|
|
|
951ecb |
From 7a79e4ef8315842d4d1078475dab287d8f3327de Mon Sep 17 00:00:00 2001
|
|
|
951ecb |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
951ecb |
Date: Wed, 25 Jul 2018 15:15:38 -0500
|
|
|
951ecb |
Subject: [PATCH 3/4] Low: tools: notifyServicelogEvent FTBFS on ppc64le
|
|
|
951ecb |
|
|
|
951ecb |
---
|
|
|
951ecb |
tools/notifyServicelogEvent.c | 24 ++++++++----------------
|
|
|
951ecb |
1 file changed, 8 insertions(+), 16 deletions(-)
|
|
|
951ecb |
|
|
|
951ecb |
diff --git a/tools/notifyServicelogEvent.c b/tools/notifyServicelogEvent.c
|
|
|
951ecb |
index b7f672c..700f068 100644
|
|
|
951ecb |
--- a/tools/notifyServicelogEvent.c
|
|
|
951ecb |
+++ b/tools/notifyServicelogEvent.c
|
|
|
951ecb |
@@ -1,24 +1,15 @@
|
|
|
951ecb |
/*
|
|
|
951ecb |
- * Copyright (C) 2009 International Business Machines, IBM, Mark Hamzy
|
|
|
951ecb |
+ * Copyright 2009-2018 International Business Machines, IBM, Mark Hamzy
|
|
|
951ecb |
*
|
|
|
951ecb |
- * This program is free software; you can redistribute it and/or
|
|
|
951ecb |
- * modify it under the terms of the GNU General Public
|
|
|
951ecb |
- * License as published by the Free Software Foundation; either
|
|
|
951ecb |
- * version 2 of the License, or (at your option) any later version.
|
|
|
951ecb |
- *
|
|
|
951ecb |
- * This software is distributed in the hope that it will be useful,
|
|
|
951ecb |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
951ecb |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
951ecb |
- * General Public License for more details.
|
|
|
951ecb |
- *
|
|
|
951ecb |
- * You should have received a copy of the GNU General Public
|
|
|
951ecb |
- * License along with this library; if not, write to the Free Software
|
|
|
951ecb |
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
951ecb |
+ * This source code is licensed under the GNU General Public License version 2
|
|
|
951ecb |
+ * or later (GPLv2+) WITHOUT ANY WARRANTY.
|
|
|
951ecb |
*/
|
|
|
951ecb |
|
|
|
951ecb |
/* gcc -o notifyServicelogEvent `pkg-config --cflags servicelog-1` `pkg-config --libs servicelog-1` notifyServicelogEvent.c
|
|
|
951ecb |
*/
|
|
|
951ecb |
|
|
|
951ecb |
+#include <crm_internal.h>
|
|
|
951ecb |
+
|
|
|
951ecb |
#include <string.h>
|
|
|
951ecb |
#include <stdio.h>
|
|
|
951ecb |
#include <time.h>
|
|
|
951ecb |
@@ -27,9 +18,10 @@
|
|
|
951ecb |
#include <syslog.h>
|
|
|
951ecb |
#include <unistd.h>
|
|
|
951ecb |
#include <config.h>
|
|
|
951ecb |
+
|
|
|
951ecb |
#include <crm/common/xml.h>
|
|
|
951ecb |
#include <crm/common/util.h>
|
|
|
951ecb |
-#include <crm_internal.h>
|
|
|
951ecb |
+#include <crm/attrd.h>
|
|
|
951ecb |
|
|
|
951ecb |
typedef enum { STATUS_GREEN = 1, STATUS_YELLOW, STATUS_RED } STATUS;
|
|
|
951ecb |
|
|
|
951ecb |
@@ -91,7 +83,7 @@ main(int argc, char *argv[])
|
|
|
951ecb |
struct sl_event *event = NULL;
|
|
|
951ecb |
uint64_t event_id = 0;
|
|
|
951ecb |
|
|
|
951ecb |
- crm_log_init_quiet("notifyServicelogEvent", LOG_INFO, FALSE, TRUE, argc, argv);
|
|
|
951ecb |
+ crm_log_cli_init("notifyServicelogEvent");
|
|
|
951ecb |
crm_set_options(NULL, "event_id ", long_options,
|
|
|
951ecb |
"Gets called upon events written to servicelog database");
|
|
|
951ecb |
|
|
|
951ecb |
--
|
|
|
951ecb |
1.8.3.1
|
|
|
951ecb |
|
|
|
951ecb |
|
|
|
951ecb |
From b408a3ead462c8f02b68a164f24ba1b05bb3cad1 Mon Sep 17 00:00:00 2001
|
|
|
951ecb |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
951ecb |
Date: Wed, 25 Jul 2018 16:07:42 -0500
|
|
|
951ecb |
Subject: [PATCH 4/4] Low: tools: ipmiservicelogd FTBFS on ppc64le
|
|
|
951ecb |
|
|
|
951ecb |
---
|
|
|
951ecb |
tools/ipmiservicelogd.c | 53 +++++++++++++++++++++++--------------------------
|
|
|
951ecb |
1 file changed, 25 insertions(+), 28 deletions(-)
|
|
|
951ecb |
|
|
|
951ecb |
diff --git a/tools/ipmiservicelogd.c b/tools/ipmiservicelogd.c
|
|
|
951ecb |
index 1047c9c..4f52865 100644
|
|
|
951ecb |
--- a/tools/ipmiservicelogd.c
|
|
|
951ecb |
+++ b/tools/ipmiservicelogd.c
|
|
|
951ecb |
@@ -9,13 +9,10 @@
|
|
|
951ecb |
* Author: Intel Corporation
|
|
|
951ecb |
* Jeff Zheng <Jeff.Zheng@Intel.com>
|
|
|
951ecb |
*
|
|
|
951ecb |
- * Copyright 2009 International Business Machines, IBM
|
|
|
951ecb |
- *
|
|
|
951ecb |
- * This program is free software; you can redistribute it and/or
|
|
|
951ecb |
- * modify it under the terms of the GNU Lesser General Public License
|
|
|
951ecb |
- * as published by the Free Software Foundation; either version 2 of
|
|
|
951ecb |
- * the License, or (at your option) any later version.
|
|
|
951ecb |
+ * Copyright 2009-2018 International Business Machines, IBM
|
|
|
951ecb |
*
|
|
|
951ecb |
+ * This source code is licensed under the GNU Lesser General Public License
|
|
|
951ecb |
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
|
|
|
951ecb |
*
|
|
|
951ecb |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
951ecb |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
951ecb |
@@ -27,10 +24,6 @@
|
|
|
951ecb |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
|
951ecb |
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
|
|
951ecb |
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
951ecb |
- *
|
|
|
951ecb |
- * You should have received a copy of the GNU Lesser General Public
|
|
|
951ecb |
- * License along with this program; if not, write to the Free
|
|
|
951ecb |
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
951ecb |
*/
|
|
|
951ecb |
|
|
|
951ecb |
/* gcc -o ipmiservicelogd -g `pkg-config --cflags --libs OpenIPMI OpenIPMIposix servicelog-1` ipmiservicelogd.c
|
|
|
951ecb |
@@ -38,6 +31,12 @@
|
|
|
951ecb |
/* ./ipmiservicelogd smi 0
|
|
|
951ecb |
*/
|
|
|
951ecb |
|
|
|
951ecb |
+#include <crm_internal.h>
|
|
|
951ecb |
+
|
|
|
951ecb |
+#ifndef _GNU_SOURCE
|
|
|
951ecb |
+# define _GNU_SOURCE
|
|
|
951ecb |
+#endif
|
|
|
951ecb |
+
|
|
|
951ecb |
#include <stdio.h>
|
|
|
951ecb |
#include <stdlib.h>
|
|
|
951ecb |
#include <string.h>
|
|
|
951ecb |
@@ -68,7 +67,7 @@
|
|
|
951ecb |
|
|
|
951ecb |
static os_handler_t *os_hnd;
|
|
|
951ecb |
|
|
|
951ecb |
-char *getStringExecOutput(char *args[]);
|
|
|
951ecb |
+char *getStringExecOutput(const char *const args[]);
|
|
|
951ecb |
char *getSerialNumber(void);
|
|
|
951ecb |
char *getProductName(void);
|
|
|
951ecb |
static void con_usage(const char *name, const char *help, void *cb_data);
|
|
|
951ecb |
@@ -91,7 +90,7 @@ void setup_done(ipmi_domain_t * domain, int err, unsigned int conn_num, unsigned
|
|
|
951ecb |
int still_connected, void *user_data);
|
|
|
951ecb |
|
|
|
951ecb |
char *
|
|
|
951ecb |
-getStringExecOutput(char *args[])
|
|
|
951ecb |
+getStringExecOutput(const char *const args[])
|
|
|
951ecb |
{
|
|
|
951ecb |
int rc;
|
|
|
951ecb |
pid_t pid;
|
|
|
951ecb |
@@ -201,7 +200,11 @@ getStringExecOutput(char *args[])
|
|
|
951ecb |
crm_err("Error: child close (pipefd[1]) = %d", errno);
|
|
|
951ecb |
}
|
|
|
951ecb |
|
|
|
951ecb |
- rc = execvp(args[0], args);
|
|
|
951ecb |
+ /* execvp() takes (char *const *) for backward compatibility,
|
|
|
951ecb |
+ * but POSIX guarantees that it will not modify the strings,
|
|
|
951ecb |
+ * so the cast is safe
|
|
|
951ecb |
+ */
|
|
|
951ecb |
+ rc = execvp(args[0], (char *const *) args);
|
|
|
951ecb |
|
|
|
951ecb |
if (rc == -1) {
|
|
|
951ecb |
crm_err("Error: child execvp = %d", errno);
|
|
|
951ecb |
@@ -224,7 +227,7 @@ getStringExecOutput(char *args[])
|
|
|
951ecb |
char *
|
|
|
951ecb |
getSerialNumber(void)
|
|
|
951ecb |
{
|
|
|
951ecb |
- char *dmiArgs[] = {
|
|
|
951ecb |
+ const char *const dmiArgs[] = {
|
|
|
951ecb |
"dmidecode",
|
|
|
951ecb |
"--string",
|
|
|
951ecb |
"system-serial-number",
|
|
|
951ecb |
@@ -237,7 +240,7 @@ getSerialNumber(void)
|
|
|
951ecb |
char *
|
|
|
951ecb |
getProductName(void)
|
|
|
951ecb |
{
|
|
|
951ecb |
- char *dmiArgs[] = {
|
|
|
951ecb |
+ const char *dmiArgs[] = {
|
|
|
951ecb |
"dmidecode",
|
|
|
951ecb |
"--string",
|
|
|
951ecb |
"system-product-name",
|
|
|
951ecb |
@@ -313,8 +316,8 @@ ipmi2servicelog(struct sl_data_bmc *bmc_data)
|
|
|
951ecb |
sl_event.machine_serial = serial_number;
|
|
|
951ecb |
sl_event.machine_model = product_name; /* it may not have the serial # within the first 20 chars */
|
|
|
951ecb |
sl_event.nodename = name.nodename;
|
|
|
951ecb |
- sl_event.refcode = "ipmi";
|
|
|
951ecb |
- sl_event.description = "ipmi event";
|
|
|
951ecb |
+ sl_event.refcode = strdup("ipmi");
|
|
|
951ecb |
+ sl_event.description = strdup("ipmi event");
|
|
|
951ecb |
sl_event.serviceable = 1; /* 1 or 0 */
|
|
|
951ecb |
sl_event.predictive = 0; /* 1 or 0 */
|
|
|
951ecb |
sl_event.disposition = SL_DISP_RECOVERABLE; /* one of SL_DISP_* */
|
|
|
951ecb |
@@ -336,6 +339,8 @@ ipmi2servicelog(struct sl_data_bmc *bmc_data)
|
|
|
951ecb |
crm_debug("Sending to servicelog database");
|
|
|
951ecb |
}
|
|
|
951ecb |
|
|
|
951ecb |
+ free(sl_event.refcode);
|
|
|
951ecb |
+ free(sl_event.description);
|
|
|
951ecb |
free(serial_number);
|
|
|
951ecb |
free(product_name);
|
|
|
951ecb |
|
|
|
951ecb |
@@ -352,7 +357,6 @@ sensor_threshold_event_handler(ipmi_sensor_t * sensor,
|
|
|
951ecb |
double value, void *cb_data, ipmi_event_t * event)
|
|
|
951ecb |
{
|
|
|
951ecb |
ipmi_entity_t *ent = ipmi_sensor_get_entity(sensor);
|
|
|
951ecb |
- int id, instance;
|
|
|
951ecb |
char name[IPMI_ENTITY_NAME_LEN];
|
|
|
951ecb |
struct sl_data_bmc bmc_data;
|
|
|
951ecb |
uint32_t sel_id;
|
|
|
951ecb |
@@ -366,8 +370,6 @@ sensor_threshold_event_handler(ipmi_sensor_t * sensor,
|
|
|
951ecb |
uint8_t event_type;
|
|
|
951ecb |
int direction;
|
|
|
951ecb |
|
|
|
951ecb |
- id = ipmi_entity_get_entity_id(ent);
|
|
|
951ecb |
- instance = ipmi_entity_get_entity_instance(ent);
|
|
|
951ecb |
ipmi_sensor_get_id(sensor, name, sizeof(name));
|
|
|
951ecb |
|
|
|
951ecb |
ipmi_sensor_get_num(sensor, &sensor_lun, &sensor_number);
|
|
|
951ecb |
@@ -416,7 +418,6 @@ sensor_discrete_event_handler(ipmi_sensor_t * sensor,
|
|
|
951ecb |
int severity, int prev_severity, void *cb_data, ipmi_event_t * event)
|
|
|
951ecb |
{
|
|
|
951ecb |
ipmi_entity_t *ent = ipmi_sensor_get_entity(sensor);
|
|
|
951ecb |
- int id, instance;
|
|
|
951ecb |
char name[IPMI_ENTITY_NAME_LEN];
|
|
|
951ecb |
struct sl_data_bmc bmc_data;
|
|
|
951ecb |
uint32_t sel_id;
|
|
|
951ecb |
@@ -430,8 +431,6 @@ sensor_discrete_event_handler(ipmi_sensor_t * sensor,
|
|
|
951ecb |
uint8_t event_type;
|
|
|
951ecb |
int direction;
|
|
|
951ecb |
|
|
|
951ecb |
- id = ipmi_entity_get_entity_id(ent);
|
|
|
951ecb |
- instance = ipmi_entity_get_entity_instance(ent);
|
|
|
951ecb |
ipmi_sensor_get_id(sensor, name, sizeof(name));
|
|
|
951ecb |
|
|
|
951ecb |
ipmi_sensor_get_num(sensor, &sensor_lun, &sensor_number);
|
|
|
951ecb |
@@ -501,10 +500,7 @@ static void
|
|
|
951ecb |
entity_change(enum ipmi_update_e op, ipmi_domain_t * domain, ipmi_entity_t * entity, void *cb_data)
|
|
|
951ecb |
{
|
|
|
951ecb |
int rv;
|
|
|
951ecb |
- int id, instance;
|
|
|
951ecb |
|
|
|
951ecb |
- id = ipmi_entity_get_entity_id(entity);
|
|
|
951ecb |
- instance = ipmi_entity_get_entity_instance(entity);
|
|
|
951ecb |
if (op == IPMI_ADDED) {
|
|
|
951ecb |
/* Register callback so that when the status of a
|
|
|
951ecb |
sensor changes, sensor_change is called */
|
|
|
951ecb |
@@ -564,8 +560,9 @@ main(int argc, char *argv[])
|
|
|
951ecb |
#endif
|
|
|
951ecb |
|
|
|
951ecb |
crm_make_daemon("ipmiservicelogd", TRUE, "/var/run/ipmiservicelogd.pid0");
|
|
|
951ecb |
-
|
|
|
951ecb |
- crm_log_init("ipmiservicelogd", LOG_INFO, FALSE, TRUE, argc, argv);
|
|
|
951ecb |
+ crm_log_cli_init("ipmiservicelogd");
|
|
|
951ecb |
+ // Maybe this should log like a daemon instead?
|
|
|
951ecb |
+ // crm_log_init("ipmiservicelogd", LOG_INFO, TRUE, FALSE, argc, argv, FALSE);
|
|
|
951ecb |
|
|
|
951ecb |
#ifdef COMPLEX
|
|
|
951ecb |
rv = ipmi_args_setup_con(args, os_hnd, NULL, &con);
|
|
|
951ecb |
--
|
|
|
951ecb |
1.8.3.1
|
|
|
951ecb |
|