|
|
e71b65 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
e71b65 |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
e71b65 |
Date: Tue, 31 Jan 2023 10:35:10 -0600
|
|
|
e71b65 |
Subject: [PATCH] libmultipath: cleanup ACT_CREATE code in select_action
|
|
|
e71b65 |
|
|
|
e71b65 |
Combine the two separate blocks that set ACT_CREATE into one.
|
|
|
e71b65 |
|
|
|
e71b65 |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
e71b65 |
---
|
|
|
e71b65 |
libmultipath/configure.c | 38 +++++++++++++++++---------------------
|
|
|
e71b65 |
1 file changed, 17 insertions(+), 21 deletions(-)
|
|
|
e71b65 |
|
|
|
e71b65 |
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
|
|
|
e71b65 |
index c91a8139..24d051dd 100644
|
|
|
e71b65 |
--- a/libmultipath/configure.c
|
|
|
e71b65 |
+++ b/libmultipath/configure.c
|
|
|
e71b65 |
@@ -728,33 +728,29 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
|
|
|
e71b65 |
cmpp = find_mp_by_wwid(curmp, mpp->wwid);
|
|
|
e71b65 |
cmpp_by_name = find_mp_by_alias(curmp, mpp->alias);
|
|
|
e71b65 |
|
|
|
e71b65 |
- if (!cmpp_by_name) {
|
|
|
e71b65 |
- if (cmpp) {
|
|
|
e71b65 |
- condlog(2, "%s: rename %s to %s", mpp->wwid,
|
|
|
e71b65 |
- cmpp->alias, mpp->alias);
|
|
|
e71b65 |
- strlcpy(mpp->alias_old, cmpp->alias, WWID_SIZE);
|
|
|
e71b65 |
- mpp->action = ACT_RENAME;
|
|
|
e71b65 |
- if (force_reload) {
|
|
|
e71b65 |
- mpp->force_udev_reload = 1;
|
|
|
e71b65 |
- mpp->action = ACT_FORCERENAME;
|
|
|
e71b65 |
- }
|
|
|
e71b65 |
- return;
|
|
|
e71b65 |
+ if (!cmpp) {
|
|
|
e71b65 |
+ if (cmpp_by_name) {
|
|
|
e71b65 |
+ condlog(1, "%s: can't use alias \"%s\" used by %s, falling back to WWID",
|
|
|
e71b65 |
+ mpp->wwid, mpp->alias, cmpp_by_name->wwid);
|
|
|
e71b65 |
+ /* We can do this because wwid wasn't found */
|
|
|
e71b65 |
+ free(mpp->alias);
|
|
|
e71b65 |
+ mpp->alias = strdup(mpp->wwid);
|
|
|
e71b65 |
}
|
|
|
e71b65 |
mpp->action = ACT_CREATE;
|
|
|
e71b65 |
- condlog(3, "%s: set ACT_CREATE (map does not exist)",
|
|
|
e71b65 |
- mpp->alias);
|
|
|
e71b65 |
+ condlog(3, "%s: set ACT_CREATE (map does not exist%s)",
|
|
|
e71b65 |
+ mpp->alias, cmpp_by_name ? ", name changed" : "");
|
|
|
e71b65 |
return;
|
|
|
e71b65 |
}
|
|
|
e71b65 |
|
|
|
e71b65 |
- if (!cmpp) {
|
|
|
e71b65 |
- condlog(1, "%s: can't use alias \"%s\" used by %s, falling back to WWID",
|
|
|
e71b65 |
- mpp->wwid, mpp->alias, cmpp_by_name->wwid);
|
|
|
e71b65 |
- /* We can do this because wwid wasn't found */
|
|
|
e71b65 |
- free(mpp->alias);
|
|
|
e71b65 |
- mpp->alias = strdup(mpp->wwid);
|
|
|
e71b65 |
- mpp->action = ACT_CREATE;
|
|
|
e71b65 |
- condlog(3, "%s: set ACT_CREATE (map does not exist, name changed)",
|
|
|
e71b65 |
+ if (!cmpp_by_name) {
|
|
|
e71b65 |
+ condlog(2, "%s: rename %s to %s", mpp->wwid, cmpp->alias,
|
|
|
e71b65 |
mpp->alias);
|
|
|
e71b65 |
+ strlcpy(mpp->alias_old, cmpp->alias, WWID_SIZE);
|
|
|
e71b65 |
+ mpp->action = ACT_RENAME;
|
|
|
e71b65 |
+ if (force_reload) {
|
|
|
e71b65 |
+ mpp->force_udev_reload = 1;
|
|
|
e71b65 |
+ mpp->action = ACT_FORCERENAME;
|
|
|
e71b65 |
+ }
|
|
|
e71b65 |
return;
|
|
|
e71b65 |
}
|
|
|
e71b65 |
|