|
|
4728c8 |
From 3ed9a923904887e41c774c71232ae2a1ff6fc3fb Mon Sep 17 00:00:00 2001
|
|
|
4728c8 |
From: Mike Christie <mchristi@redhat.com>
|
|
|
4728c8 |
Date: Wed, 31 Aug 2016 15:59:53 -0500
|
|
|
4728c8 |
Subject: [PATCH 11/11] rbd: fixup log messages
|
|
|
4728c8 |
|
|
|
4728c8 |
Add rbd device prefix to condlog messages that was missing it, and drop
|
|
|
4728c8 |
it in RBD_MSG because it is already added by caller.
|
|
|
4728c8 |
|
|
|
4728c8 |
Signed-off-by: Mike Christie <mchristi@redhat.com>
|
|
|
4728c8 |
---
|
|
|
4728c8 |
libmultipath/checkers/rbd.c | 67 +++++++++++++++++++++++----------------------
|
|
|
4728c8 |
1 file changed, 35 insertions(+), 32 deletions(-)
|
|
|
4728c8 |
|
|
|
4728c8 |
diff --git a/libmultipath/checkers/rbd.c b/libmultipath/checkers/rbd.c
|
|
|
4728c8 |
index e34bf53..8e6cd3c 100644
|
|
|
4728c8 |
--- a/libmultipath/checkers/rbd.c
|
|
|
4728c8 |
+++ b/libmultipath/checkers/rbd.c
|
|
|
4728c8 |
@@ -113,8 +113,8 @@ int libcheck_init(struct checker * c)
|
|
|
4728c8 |
|
|
|
4728c8 |
addr = udev_device_get_sysattr_value(bus_dev, "client_addr");
|
|
|
4728c8 |
if (!addr) {
|
|
|
4728c8 |
- condlog(0, "Could not find client_addr in rbd sysfs. Try "
|
|
|
4728c8 |
- "updating kernel");
|
|
|
4728c8 |
+ condlog(0, "rbd%d: Could not find client_addr in rbd sysfs. "
|
|
|
4728c8 |
+ "Try updating kernel", ct->rbd_bus_id);
|
|
|
4728c8 |
goto free_dev;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
@@ -127,7 +127,7 @@ int libcheck_init(struct checker * c)
|
|
|
4728c8 |
goto free_addr;
|
|
|
4728c8 |
features = strtoll(features_str, NULL, 16);
|
|
|
4728c8 |
if (!(features & RBD_FEATURE_EXCLUSIVE_LOCK)) {
|
|
|
4728c8 |
- condlog(3, "Exclusive lock not set.");
|
|
|
4728c8 |
+ condlog(3, "rbd%d: Exclusive lock not set.", ct->rbd_bus_id);
|
|
|
4728c8 |
goto free_addr;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
@@ -136,7 +136,8 @@ int libcheck_init(struct checker * c)
|
|
|
4728c8 |
goto free_addr;
|
|
|
4728c8 |
|
|
|
4728c8 |
if (!strstr(config_info, "noshare")) {
|
|
|
4728c8 |
- condlog(3, "Only nonshared clients supported.");
|
|
|
4728c8 |
+ condlog(3, "rbd%d: Only nonshared clients supported.",
|
|
|
4728c8 |
+ ct->rbd_bus_id);
|
|
|
4728c8 |
goto free_addr;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
@@ -189,18 +190,20 @@ int libcheck_init(struct checker * c)
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
if (rados_create(&ct->cluster, NULL) < 0) {
|
|
|
4728c8 |
- condlog(0, "Could not create rados cluster");
|
|
|
4728c8 |
+ condlog(0, "rbd%d: Could not create rados cluster",
|
|
|
4728c8 |
+ ct->rbd_bus_id);
|
|
|
4728c8 |
goto free_snap;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
if (rados_conf_read_file(ct->cluster, NULL) < 0) {
|
|
|
4728c8 |
- condlog(0, "Could not read rados conf");
|
|
|
4728c8 |
+ condlog(0, "rbd%d: Could not read rados conf", ct->rbd_bus_id);
|
|
|
4728c8 |
goto shutdown_rados;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
ret = rados_connect(ct->cluster);
|
|
|
4728c8 |
if (ret < 0) {
|
|
|
4728c8 |
- condlog(0, "Could not connect to rados cluster");
|
|
|
4728c8 |
+ condlog(0, "rbd%d: Could not connect to rados cluster",
|
|
|
4728c8 |
+ ct->rbd_bus_id);
|
|
|
4728c8 |
goto shutdown_rados;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
@@ -291,8 +294,7 @@ static int rbd_is_blacklisted(struct rbd_checker_context *ct, char *msg)
|
|
|
4728c8 |
ret = rados_mon_command(ct->cluster, (const char **)cmd, 1, "", 0,
|
|
|
4728c8 |
&blklist, &blklist_len, &stat, &stat_len);
|
|
|
4728c8 |
if (ret < 0) {
|
|
|
4728c8 |
- RBD_MSG(msg, "rbd checker failed: mon command failed %d",
|
|
|
4728c8 |
- ret);
|
|
|
4728c8 |
+ RBD_MSG(msg, "checker failed: mon command failed %d", ret);
|
|
|
4728c8 |
return ret;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
@@ -313,16 +315,15 @@ static int rbd_is_blacklisted(struct rbd_checker_context *ct, char *msg)
|
|
|
4728c8 |
|
|
|
4728c8 |
end = strchr(addr_tok, ' ');
|
|
|
4728c8 |
if (!end) {
|
|
|
4728c8 |
- RBD_MSG(msg, "rbd%d checker failed: invalid blacklist %s",
|
|
|
4728c8 |
- ct->rbd_bus_id, addr_tok);
|
|
|
4728c8 |
+ RBD_MSG(msg, "checker failed: invalid blacklist %s",
|
|
|
4728c8 |
+ addr_tok);
|
|
|
4728c8 |
break;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
*end = '\0';
|
|
|
4728c8 |
|
|
|
4728c8 |
if (!strcmp(addr_tok, ct->client_addr)) {
|
|
|
4728c8 |
ct->blacklisted = 1;
|
|
|
4728c8 |
- RBD_MSG(msg, "rbd%d checker: %s is blacklisted",
|
|
|
4728c8 |
- ct->rbd_bus_id, ct->client_addr);
|
|
|
4728c8 |
+ RBD_MSG(msg, "%s is blacklisted", ct->client_addr);
|
|
|
4728c8 |
ret = 1;
|
|
|
4728c8 |
break;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
@@ -339,7 +340,7 @@ int rbd_check(struct rbd_checker_context *ct, char *msg)
|
|
|
4728c8 |
if (ct->blacklisted || rbd_is_blacklisted(ct, msg) == 1)
|
|
|
4728c8 |
return PATH_DOWN;
|
|
|
4728c8 |
|
|
|
4728c8 |
- RBD_MSG(msg, "rbd checker reports path is up");
|
|
|
4728c8 |
+ RBD_MSG(msg, "checker reports path is up");
|
|
|
4728c8 |
/*
|
|
|
4728c8 |
* Path may have issues, but the ceph cluster is at least
|
|
|
4728c8 |
* accepting IO, so we can attempt to do IO.
|
|
|
4728c8 |
@@ -411,10 +412,12 @@ static int rbd_remap(struct rbd_checker_context *ct)
|
|
|
4728c8 |
argv[i] = NULL;
|
|
|
4728c8 |
|
|
|
4728c8 |
ret = execvp(argv[0], argv);
|
|
|
4728c8 |
- condlog(0, "Error executing rbd: %s", strerror(errno));
|
|
|
4728c8 |
+ condlog(0, "rbd%d: Error executing rbd: %s", ct->rbd_bus_id,
|
|
|
4728c8 |
+ strerror(errno));
|
|
|
4728c8 |
exit(-1);
|
|
|
4728c8 |
case -1:
|
|
|
4728c8 |
- condlog(0, "fork failed: %s", strerror(errno));
|
|
|
4728c8 |
+ condlog(0, "rbd%d: fork failed: %s", ct->rbd_bus_id,
|
|
|
4728c8 |
+ strerror(errno));
|
|
|
4728c8 |
return -1;
|
|
|
4728c8 |
default:
|
|
|
4728c8 |
ret = -1;
|
|
|
4728c8 |
@@ -424,7 +427,8 @@ static int rbd_remap(struct rbd_checker_context *ct)
|
|
|
4728c8 |
if (status == 0)
|
|
|
4728c8 |
ret = 0;
|
|
|
4728c8 |
else
|
|
|
4728c8 |
- condlog(0, "rbd failed with %d", status);
|
|
|
4728c8 |
+ condlog(0, "rbd%d: failed with %d",
|
|
|
4728c8 |
+ ct->rbd_bus_id, status);
|
|
|
4728c8 |
}
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
@@ -454,12 +458,12 @@ static int rbd_rm_blacklist(struct rbd_checker_context *ct)
|
|
|
4728c8 |
ret = rados_mon_command(ct->cluster, (const char **)cmd, 1, "", 0,
|
|
|
4728c8 |
NULL, 0, &stat, &stat_len);
|
|
|
4728c8 |
if (ret < 0) {
|
|
|
4728c8 |
- condlog(1, "rbd%d repair failed to remove blacklist for %s %d",
|
|
|
4728c8 |
+ condlog(1, "rbd%d: repair failed to remove blacklist for %s %d",
|
|
|
4728c8 |
ct->rbd_bus_id, ct->client_addr, ret);
|
|
|
4728c8 |
goto free_cmd;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
- condlog(1, "rbd%d repair rm blacklist for %s",
|
|
|
4728c8 |
+ condlog(1, "rbd%d: repair rm blacklist for %s",
|
|
|
4728c8 |
ct->rbd_bus_id, ct->client_addr);
|
|
|
4728c8 |
free(stat);
|
|
|
4728c8 |
free_cmd:
|
|
|
4728c8 |
@@ -478,8 +482,7 @@ static int rbd_repair(struct rbd_checker_context *ct, char *msg)
|
|
|
4728c8 |
if (!ct->remapped) {
|
|
|
4728c8 |
ret = rbd_remap(ct);
|
|
|
4728c8 |
if (ret) {
|
|
|
4728c8 |
- RBD_MSG(msg, "rbd%d repair failed to remap. Err %d",
|
|
|
4728c8 |
- ct->rbd_bus_id, ret);
|
|
|
4728c8 |
+ RBD_MSG(msg, "repair failed to remap. Err %d", ret);
|
|
|
4728c8 |
return PATH_DOWN;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
}
|
|
|
4728c8 |
@@ -488,22 +491,21 @@ static int rbd_repair(struct rbd_checker_context *ct, char *msg)
|
|
|
4728c8 |
snprintf(del, sizeof(del), "%d force", ct->rbd_bus_id);
|
|
|
4728c8 |
ret = sysfs_write_rbd_remove(del, strlen(del) + 1);
|
|
|
4728c8 |
if (ret) {
|
|
|
4728c8 |
- RBD_MSG(msg, "rbd%d repair failed to clean up. Err %d",
|
|
|
4728c8 |
- ct->rbd_bus_id, ret);
|
|
|
4728c8 |
+ RBD_MSG(msg, "repair failed to clean up. Err %d", ret);
|
|
|
4728c8 |
return PATH_DOWN;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
ret = rbd_rm_blacklist(ct);
|
|
|
4728c8 |
if (ret) {
|
|
|
4728c8 |
- RBD_MSG(msg, "rbd%d repair could not remove blacklist entry. Err %d",
|
|
|
4728c8 |
- ct->rbd_bus_id, ret);
|
|
|
4728c8 |
+ RBD_MSG(msg, "repair could not remove blacklist entry. Err %d",
|
|
|
4728c8 |
+ ret);
|
|
|
4728c8 |
return PATH_DOWN;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
ct->remapped = 0;
|
|
|
4728c8 |
ct->blacklisted = 0;
|
|
|
4728c8 |
|
|
|
4728c8 |
- RBD_MSG(msg, "rbd%d has been repaired", ct->rbd_bus_id);
|
|
|
4728c8 |
+ RBD_MSG(msg, "has been repaired");
|
|
|
4728c8 |
return PATH_UP;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
@@ -528,7 +530,7 @@ void *rbd_thread(void *ctx)
|
|
|
4728c8 |
struct rbd_checker_context *ct = ctx;
|
|
|
4728c8 |
int state;
|
|
|
4728c8 |
|
|
|
4728c8 |
- condlog(3, "rbd%d thread starting up", ct->rbd_bus_id);
|
|
|
4728c8 |
+ condlog(3, "rbd%d: thread starting up", ct->rbd_bus_id);
|
|
|
4728c8 |
|
|
|
4728c8 |
ct->message[0] = '\0';
|
|
|
4728c8 |
/* This thread can be canceled, so setup clean up */
|
|
|
4728c8 |
@@ -547,7 +549,7 @@ void *rbd_thread(void *ctx)
|
|
|
4728c8 |
pthread_mutex_unlock(&ct->lock);
|
|
|
4728c8 |
pthread_cond_signal(&ct->active);
|
|
|
4728c8 |
|
|
|
4728c8 |
- condlog(3, "rbd%d thead finished, state %s", ct->rbd_bus_id,
|
|
|
4728c8 |
+ condlog(3, "rbd%d: thead finished, state %s", ct->rbd_bus_id,
|
|
|
4728c8 |
checker_state_name(state));
|
|
|
4728c8 |
rbd_thread_cleanup_pop(ct);
|
|
|
4728c8 |
return ((void *)0);
|
|
|
4728c8 |
@@ -577,16 +579,17 @@ static int rbd_exec_fn(struct checker *c, thread_fn *fn)
|
|
|
4728c8 |
*/
|
|
|
4728c8 |
r = pthread_mutex_lock(&ct->lock);
|
|
|
4728c8 |
if (r != 0) {
|
|
|
4728c8 |
- condlog(2, "rbd%d mutex lock failed with %d", ct->rbd_bus_id,
|
|
|
4728c8 |
+ condlog(2, "rbd%d: mutex lock failed with %d", ct->rbd_bus_id,
|
|
|
4728c8 |
r);
|
|
|
4728c8 |
- MSG(c, "rbd%d thread failed to initialize", ct->rbd_bus_id);
|
|
|
4728c8 |
+ MSG(c, "rbd%d: thread failed to initialize", ct->rbd_bus_id);
|
|
|
4728c8 |
return PATH_WILD;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
if (ct->running) {
|
|
|
4728c8 |
/* Check if checker is still running */
|
|
|
4728c8 |
if (ct->thread) {
|
|
|
4728c8 |
- condlog(3, "rbd%d thread not finished", ct->rbd_bus_id);
|
|
|
4728c8 |
+ condlog(3, "rbd%d: thread not finished",
|
|
|
4728c8 |
+ ct->rbd_bus_id);
|
|
|
4728c8 |
rbd_status = PATH_PENDING;
|
|
|
4728c8 |
} else {
|
|
|
4728c8 |
/* checker done */
|
|
|
4728c8 |
@@ -623,7 +626,7 @@ static int rbd_exec_fn(struct checker *c, thread_fn *fn)
|
|
|
4728c8 |
|
|
|
4728c8 |
if (ct->thread &&
|
|
|
4728c8 |
(rbd_status == PATH_PENDING || rbd_status == PATH_UNCHECKED)) {
|
|
|
4728c8 |
- condlog(3, "rbd%d thread still running",
|
|
|
4728c8 |
+ condlog(3, "rbd%d: thread still running",
|
|
|
4728c8 |
ct->rbd_bus_id);
|
|
|
4728c8 |
ct->running = 1;
|
|
|
4728c8 |
rbd_status = PATH_PENDING;
|
|
|
4728c8 |
--
|
|
|
4728c8 |
1.8.3.1
|
|
|
4728c8 |
|