|
|
785c99 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
785c99 |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
785c99 |
Date: Mon, 15 Jun 2020 23:54:29 -0500
|
|
|
785c99 |
Subject: [PATCH] multipath: make flushing maps work like other commands
|
|
|
785c99 |
|
|
|
785c99 |
The config structure doesn't need a special variable just for removes.
|
|
|
785c99 |
Multipath can just use the cmd variable, like it does for the other
|
|
|
785c99 |
commands.
|
|
|
785c99 |
|
|
|
785c99 |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
785c99 |
---
|
|
|
785c99 |
libmultipath/config.h | 3 ++-
|
|
|
785c99 |
libmultipath/configure.h | 3 ---
|
|
|
785c99 |
multipath/main.c | 20 ++++++++++----------
|
|
|
785c99 |
3 files changed, 12 insertions(+), 14 deletions(-)
|
|
|
785c99 |
|
|
|
785c99 |
diff --git a/libmultipath/config.h b/libmultipath/config.h
|
|
|
785c99 |
index 3368d8c9..4042eba6 100644
|
|
|
785c99 |
--- a/libmultipath/config.h
|
|
|
785c99 |
+++ b/libmultipath/config.h
|
|
|
785c99 |
@@ -39,6 +39,8 @@ enum mpath_cmds {
|
|
|
785c99 |
CMD_ADD_WWID,
|
|
|
785c99 |
CMD_USABLE_PATHS,
|
|
|
785c99 |
CMD_DUMP_CONFIG,
|
|
|
785c99 |
+ CMD_FLUSH_ONE,
|
|
|
785c99 |
+ CMD_FLUSH_ALL,
|
|
|
785c99 |
};
|
|
|
785c99 |
|
|
|
785c99 |
enum force_reload_types {
|
|
|
785c99 |
@@ -143,7 +145,6 @@ struct config {
|
|
|
785c99 |
unsigned int max_checkint;
|
|
|
785c99 |
bool use_watchdog;
|
|
|
785c99 |
int pgfailback;
|
|
|
785c99 |
- int remove;
|
|
|
785c99 |
int rr_weight;
|
|
|
785c99 |
int no_path_retry;
|
|
|
785c99 |
int user_friendly_names;
|
|
|
785c99 |
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
|
|
|
785c99 |
index d7509000..0e33bf40 100644
|
|
|
785c99 |
--- a/libmultipath/configure.h
|
|
|
785c99 |
+++ b/libmultipath/configure.h
|
|
|
785c99 |
@@ -45,9 +45,6 @@ enum {
|
|
|
785c99 |
CP_RETRY,
|
|
|
785c99 |
};
|
|
|
785c99 |
|
|
|
785c99 |
-#define FLUSH_ONE 1
|
|
|
785c99 |
-#define FLUSH_ALL 2
|
|
|
785c99 |
-
|
|
|
785c99 |
struct vectors;
|
|
|
785c99 |
|
|
|
785c99 |
int setup_map (struct multipath * mpp, char * params, int params_size,
|
|
|
785c99 |
diff --git a/multipath/main.c b/multipath/main.c
|
|
|
785c99 |
index 7ab3102f..a2080029 100644
|
|
|
785c99 |
--- a/multipath/main.c
|
|
|
785c99 |
+++ b/multipath/main.c
|
|
|
785c99 |
@@ -942,10 +942,10 @@ main (int argc, char *argv[])
|
|
|
785c99 |
cmd = CMD_DRY_RUN;
|
|
|
785c99 |
break;
|
|
|
785c99 |
case 'f':
|
|
|
785c99 |
- conf->remove = FLUSH_ONE;
|
|
|
785c99 |
+ cmd = CMD_FLUSH_ONE;
|
|
|
785c99 |
break;
|
|
|
785c99 |
case 'F':
|
|
|
785c99 |
- conf->remove = FLUSH_ALL;
|
|
|
785c99 |
+ cmd = CMD_FLUSH_ALL;
|
|
|
785c99 |
break;
|
|
|
785c99 |
case 'l':
|
|
|
785c99 |
if (optarg && !strncmp(optarg, "l", 1))
|
|
|
785c99 |
@@ -1084,6 +1084,10 @@ main (int argc, char *argv[])
|
|
|
785c99 |
condlog(0, "the -w option requires a device");
|
|
|
785c99 |
goto out;
|
|
|
785c99 |
}
|
|
|
785c99 |
+ if (cmd == CMD_FLUSH_ONE && dev_type != DEV_DEVMAP) {
|
|
|
785c99 |
+ condlog(0, "the -f option requires a map name to remove");
|
|
|
785c99 |
+ goto out;
|
|
|
785c99 |
+ }
|
|
|
785c99 |
|
|
|
785c99 |
switch(delegate_to_multipathd(cmd, dev, dev_type, conf)) {
|
|
|
785c99 |
case DELEGATE_OK:
|
|
|
785c99 |
@@ -1117,16 +1121,12 @@ main (int argc, char *argv[])
|
|
|
785c99 |
}
|
|
|
785c99 |
if (retries < 0)
|
|
|
785c99 |
retries = conf->remove_retries;
|
|
|
785c99 |
- if (conf->remove == FLUSH_ONE) {
|
|
|
785c99 |
- if (dev_type == DEV_DEVMAP) {
|
|
|
785c99 |
- r = dm_suspend_and_flush_map(dev, retries) ?
|
|
|
785c99 |
- RTVL_FAIL : RTVL_OK;
|
|
|
785c99 |
- } else
|
|
|
785c99 |
- condlog(0, "must provide a map name to remove");
|
|
|
785c99 |
-
|
|
|
785c99 |
+ if (cmd == CMD_FLUSH_ONE) {
|
|
|
785c99 |
+ r = dm_suspend_and_flush_map(dev, retries) ?
|
|
|
785c99 |
+ RTVL_FAIL : RTVL_OK;
|
|
|
785c99 |
goto out;
|
|
|
785c99 |
}
|
|
|
785c99 |
- else if (conf->remove == FLUSH_ALL) {
|
|
|
785c99 |
+ else if (cmd == CMD_FLUSH_ALL) {
|
|
|
785c99 |
r = dm_flush_maps(1, retries) ? RTVL_FAIL : RTVL_OK;
|
|
|
785c99 |
goto out;
|
|
|
785c99 |
}
|
|
|
785c99 |
--
|
|
|
785c99 |
2.17.2
|
|
|
785c99 |
|