}
extern int
+dm_flush_map (char * mapname, char * type)
+{
+ if (!dm_type(mapname, type) || dm_get_opencount(mapname))
+ return 1;
+
+ return dm_simplecmd(DM_DEVICE_REMOVE, mapname);
+}
+
+extern int
dm_flush_maps (char * type)
{
int r = 0;
goto out;
do {
- if (dm_type(names->name, type) &&
- dm_get_opencount(names->name) == 0 &&
- !dm_simplecmd(DM_DEVICE_REMOVE, names->name))
- r++;
-
+ r += dm_flush_map(names->name, type);
next = names->next;
names = (void *) names + next;
} while (next);
usage (char * progname)
{
fprintf (stderr, VERSION_STRING);
- fprintf (stderr, "Usage: %s\t[-v level] [-d] [-l|-ll]\n",
+ fprintf (stderr, "Usage: %s\t[-v level] [-d] [-l|-ll|-f|-F]\n",
progname);
fprintf (stderr,
"\t\t\t[-p failover|multibus|group_by_serial|group_by_prio]\n" \
"\t-d\t\tdry run, do not create or update devmaps\n" \
"\t-l\t\tshow multipath topology (sysfs and DM info)\n" \
"\t-ll\t\tshow multipath topology (maximum info)\n" \
+ "\t-F\t\tflush a multipath device map\n" \
"\t-F\t\tflush all multipath device maps\n" \
"\t-p policy\tforce all maps to specified policy :\n" \
"\t failover\t\t1 path per priority group\n" \
if (load_config(DEFAULT_CONFIGFILE))
exit(1);
- while ((arg = getopt(argc, argv, ":qdl::Fi:M:v:p:")) != EOF ) {
+ while ((arg = getopt(argc, argv, ":qdl::Ffi:M:v:p:")) != EOF ) {
switch(arg) {
case 1: printf("optarg : %s\n",optarg);
break;
case 'd':
conf->dry_run = 1;
break;
+ case 'f':
+ conf->remove = 1;
+ break;
case 'F':
dm_flush_maps(DEFAULT_TARGET);
goto out;
}
+ if (conf->remove) {
+ if (conf->dev_type == DEV_DEVMAP) {
+ condlog(4, "remove %s map", conf->dev);
+ dm_flush_map(conf->dev, DEFAULT_TARGET);
+ }
+ else
+ condlog(0, "must provide a map name to remove");
+
+ goto out;
+ }
+
/*
* allocate core vectors to store paths and multipaths
*/
.RB [\| \-v\ \c
.IR verbosity \|]
.RB [\| \-d \|]
-.RB [\| \-l | \-ll \|]
-.RB [\| \-i\ \c
-.IR int \|]
+.RB [\| \-l | \-ll | \-f | \-F \|]
.RB [\| \-p\ \c
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
.RB [\| device \|]
show the current multipath topology from all available information (sysfs, the device mapper, path checkers ...)
.TP
.TP
-.BI \-i " interval"
-multipath target param: polling interval
-.TP
.BI \-D " major:minor"
update only the devmap the path pointed by
.I major:minor
is in
.TP
+.B \-f
+flush a multipath device map specified as parameter, if unused
+.TP
.B \-F
flush all unused multipath device maps
.TP