mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-04-25 14:50:10 +03:00
[PATCH] multipath update
This commit is contained in:
parent
534c853df5
commit
cbd2ea21e4
@ -1,3 +1,13 @@
|
|||||||
|
2004-02-21 multipath-018
|
||||||
|
* From the Debian SID inclusion review (Philipp Matthias Hahn)
|
||||||
|
* use DESTDIR install prefix in the Makefile
|
||||||
|
* add man pages for devmap_name & multipath
|
||||||
|
* correct libsysfs.h includes
|
||||||
|
* fork the hotplug script in its own shell
|
||||||
|
* Sync with the kernel device mapper code as of 2.6.3-udm3
|
||||||
|
ie. Remove the test interval parameter and its uses
|
||||||
|
* Remove superfluous scsi parameter passed from hotplug
|
||||||
|
* Add the man pages to the [un]install targets
|
||||||
2004-02-17 multipath-017
|
2004-02-17 multipath-017
|
||||||
* remove the restrictive -f flag.
|
* remove the restrictive -f flag.
|
||||||
Introduce a more generic "-m iopolicy" one.
|
Introduce a more generic "-m iopolicy" one.
|
||||||
|
@ -10,8 +10,11 @@ bindir = ${exec_prefix}/sbin
|
|||||||
udevdir = ../..
|
udevdir = ../..
|
||||||
klibcdir = $(udevdir)/klibc
|
klibcdir = $(udevdir)/klibc
|
||||||
sysfsdir = $(udevdir)/libsysfs
|
sysfsdir = $(udevdir)/libsysfs
|
||||||
|
mandir = /usr/share/man/man8
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
GZIP = /bin/gzip -c
|
||||||
|
|
||||||
GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"}
|
GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"}
|
||||||
KERNEL_DIR = /lib/modules/${shell uname -r}/build
|
KERNEL_DIR = /lib/modules/${shell uname -r}/build
|
||||||
CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \
|
CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \
|
||||||
@ -45,26 +48,33 @@ all: recurse
|
|||||||
$(EXEC): $(OBJS)
|
$(EXEC): $(OBJS)
|
||||||
$(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC)
|
$(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC)
|
||||||
strip $(EXEC)
|
strip $(EXEC)
|
||||||
|
$(GZIP) $(EXEC).8 > $(EXEC).8.gz
|
||||||
|
|
||||||
devmap_name: devmap_name.o
|
devmap_name: devmap_name.o
|
||||||
$(LD) -o devmap_name $(CRT0) devmap_name.o $(DMOBJS) $(LIB) $(LIBGCC)
|
$(LD) -o devmap_name $(CRT0) devmap_name.o $(DMOBJS) $(LIB) $(LIBGCC)
|
||||||
strip devmap_name
|
strip devmap_name
|
||||||
|
$(GZIP) devmap_name.8 > devmap_name.8.gz
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f core *.o $(EXEC) devmap_name
|
rm -f core *.o $(EXEC) devmap_name *.gz
|
||||||
$(MAKE) -C libdevmapper clean
|
$(MAKE) -C libdevmapper clean
|
||||||
|
|
||||||
install:
|
install:
|
||||||
install -d $(bindir)
|
install -d $(DESTDIR)$(bindir)
|
||||||
install -m 755 $(EXEC) $(bindir)/
|
install -m 755 $(EXEC) $(DESTDIR)$(bindir)/
|
||||||
install -m 755 devmap_name $(bindir)/
|
install -m 755 devmap_name $(DESTDIR)$(bindir)/
|
||||||
install -d /etc/hotplug.d/scsi/
|
install -d $(DESTDIR)/etc/hotplug.d/scsi/
|
||||||
install -m 755 multipath.hotplug /etc/hotplug.d/scsi/
|
install -m 755 multipath.hotplug $(DESTDIR)/etc/hotplug.d/scsi/
|
||||||
|
install -d $(DESTDIR)$(mandir)
|
||||||
|
install -m 644 devmap_name.8.gz $(DESTDIR)$(mandir)
|
||||||
|
install -m 644 multipath.8.gz $(DESTDIR)$(mandir)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm /etc/hotplug.d/scsi/multipath.hotplug
|
rm $(DESTDIR)/etc/hotplug.d/scsi/multipath.hotplug
|
||||||
rm $(bindir)/$(EXEC)
|
rm $(DESTDIR)$(bindir)/$(EXEC)
|
||||||
rm $(bindir)/devmap_name
|
rm $(DESTDIR)$(bindir)/devmap_name
|
||||||
|
rm $(DESTDIR)$(mandir)/devmap_name.8.gz
|
||||||
|
rm $(DESTDIR)$(mandir)/multipath.8.gz
|
||||||
|
|
||||||
# Code dependencies
|
# Code dependencies
|
||||||
main.o: main.c main.h sg_include.h devinfo.h
|
main.o: main.c main.h sg_include.h devinfo.h
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <libsysfs.h>
|
#include <sysfs/libsysfs.h>
|
||||||
#include "devinfo.h"
|
#include "devinfo.h"
|
||||||
#include "sg_include.h"
|
#include "sg_include.h"
|
||||||
|
|
||||||
|
30
extras/multipath/devmap_name.8
Normal file
30
extras/multipath/devmap_name.8
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
.TH DEVMAP_NAME 8 "February 2004" "" "Linux Administrator's Manual"
|
||||||
|
.SH NAME
|
||||||
|
devmap_name \- Query device-mapper name
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.BI devmap_name " major minor"
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B devmap_name
|
||||||
|
queries the device-mapper for the name for the device
|
||||||
|
specified by
|
||||||
|
.I major
|
||||||
|
and
|
||||||
|
.I minor
|
||||||
|
number.
|
||||||
|
.br
|
||||||
|
.B devmap_name
|
||||||
|
can be called from
|
||||||
|
.B udev
|
||||||
|
by the following rule in
|
||||||
|
.IR /etc/udev/udev.rules :
|
||||||
|
.sp
|
||||||
|
.nf
|
||||||
|
KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \\
|
||||||
|
NAME="%k", SYMLINK="%c"
|
||||||
|
.fi
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR udev (8),
|
||||||
|
.BR dmsetup (8)
|
||||||
|
.SH AUTHORS
|
||||||
|
.B devmap_name
|
||||||
|
was developed by Christophe Varoqui, <christophe.varoqui@free.fr> and others.
|
@ -25,7 +25,7 @@
|
|||||||
#include <linux/kdev_t.h>
|
#include <linux/kdev_t.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <libsysfs.h>
|
#include <sysfs/libsysfs.h>
|
||||||
#include "libdevmapper/libdevmapper.h"
|
#include "libdevmapper/libdevmapper.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "devinfo.h"
|
#include "devinfo.h"
|
||||||
@ -110,7 +110,7 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths)
|
|||||||
char path[FILE_NAME_SIZE];
|
char path[FILE_NAME_SIZE];
|
||||||
struct path curpath;
|
struct path curpath;
|
||||||
|
|
||||||
/* if called from hotplug, only consider the paths that relate to */
|
/* if called from hotplug, only consider the paths that relate */
|
||||||
/* to the device pointed by conf.hotplugdev */
|
/* to the device pointed by conf.hotplugdev */
|
||||||
memset(empty_buff, 0, WWID_SIZE);
|
memset(empty_buff, 0, WWID_SIZE);
|
||||||
memset(refwwid, 0, WWID_SIZE);
|
memset(refwwid, 0, WWID_SIZE);
|
||||||
@ -442,6 +442,7 @@ group_by_serial(struct multipath * mp, struct path * all_paths, char * str) {
|
|||||||
path_count, path_buff);
|
path_count, path_buff);
|
||||||
}
|
}
|
||||||
sprintf(str, " %i%s", pg_count, pg_buff);
|
sprintf(str, " %i%s", pg_count, pg_buff);
|
||||||
|
free(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -507,8 +508,6 @@ setup_map(struct env * conf, struct path * all_paths,
|
|||||||
if (np < 1)
|
if (np < 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
params_p += sprintf(params_p, "%i", conf->dm_path_test_int);
|
|
||||||
|
|
||||||
if ((all_paths[PINDEX(index,0)].iopolicy == MULTIBUS &&
|
if ((all_paths[PINDEX(index,0)].iopolicy == MULTIBUS &&
|
||||||
conf->iopolicy == -1) || conf->iopolicy == MULTIBUS) {
|
conf->iopolicy == -1) || conf->iopolicy == MULTIBUS) {
|
||||||
params_p += sprintf(params_p, " 1 %i %s %i %i",
|
params_p += sprintf(params_p, " 1 %i %s %i %i",
|
||||||
@ -602,18 +601,19 @@ static void
|
|||||||
usage(char * progname)
|
usage(char * progname)
|
||||||
{
|
{
|
||||||
fprintf(stderr, VERSION_STRING);
|
fprintf(stderr, VERSION_STRING);
|
||||||
fprintf(stderr, "Usage: %s [-v|-q] [-d] [-i int] [-m max_devs] ",
|
fprintf(stderr, "Usage: %s [-v|-q] [-d] [-m max_devs]",
|
||||||
progname);
|
progname);
|
||||||
fprintf(stderr, "[-p failover|multibus|group_by_serial]\n");
|
fprintf(stderr, "[-p failover|multibus|group_by_serial] [device]\n");
|
||||||
fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n");
|
fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n");
|
||||||
fprintf(stderr, "\t-q\t\tquiet, no output at all\n");
|
fprintf(stderr, "\t-q\t\tquiet, no output at all\n");
|
||||||
fprintf(stderr, "\t-d\t\tdry run, do not create or update devmaps\n");
|
fprintf(stderr, "\t-d\t\tdry run, do not create or update devmaps\n");
|
||||||
fprintf(stderr, "\t-i\t\tmultipath target param : polling interval\n");
|
|
||||||
fprintf(stderr, "\t-m max_devs\tscan {max_devs} devices at most\n");
|
fprintf(stderr, "\t-m max_devs\tscan {max_devs} devices at most\n");
|
||||||
fprintf(stderr, "\t-p policy\tforce maps to specified policy :\n");
|
fprintf(stderr, "\t-p policy\tforce maps to specified policy :\n");
|
||||||
fprintf(stderr, "\t\t\tfailover\t1 path per priority group\n");
|
fprintf(stderr, "\t failover\t\t- 1 path per priority group\n");
|
||||||
fprintf(stderr, "\t\t\tmultibus\tall paths in 1 priority group\n");
|
fprintf(stderr, "\t multibus\t\t- all paths in 1 priority group\n");
|
||||||
fprintf(stderr, "\t\t\tgroup_by_serial\t1 priority group per serial\n");
|
fprintf(stderr, "\t group_by_serial\t- 1 priority group per serial\n");
|
||||||
|
fprintf(stderr, "\tdevice\t\tlimit scope to the device's multipath\n");
|
||||||
|
fprintf(stderr, "\t\t\t(hotplug-style $DEVPATH reference)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +632,6 @@ main(int argc, char *argv[])
|
|||||||
conf.verbose = 0; /* 1 == Print all_paths and mp */
|
conf.verbose = 0; /* 1 == Print all_paths and mp */
|
||||||
conf.quiet = 0; /* 1 == Do not even print devmaps */
|
conf.quiet = 0; /* 1 == Do not even print devmaps */
|
||||||
conf.iopolicy = -1; /* Apply the defaults in get_unique_id() */
|
conf.iopolicy = -1; /* Apply the defaults in get_unique_id() */
|
||||||
conf.dm_path_test_int = 10;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; ++i) {
|
for (i = 1; i < argc; ++i) {
|
||||||
if (0 == strcmp("-v", argv[i])) {
|
if (0 == strcmp("-v", argv[i])) {
|
||||||
@ -649,25 +648,19 @@ main(int argc, char *argv[])
|
|||||||
conf.quiet = 1;
|
conf.quiet = 1;
|
||||||
} else if (0 == strcmp("-d", argv[i]))
|
} else if (0 == strcmp("-d", argv[i]))
|
||||||
conf.dry_run = 1;
|
conf.dry_run = 1;
|
||||||
else if (0 == strcmp("-i", argv[i]))
|
else if (0 == strcmp("-p", argv[i])) {
|
||||||
conf.dm_path_test_int = atoi(argv[++i]);
|
i++;
|
||||||
else if (0 == strcmp("-p", argv[i++])) {
|
|
||||||
if (!strcmp(argv[i], "failover"))
|
if (!strcmp(argv[i], "failover"))
|
||||||
conf.iopolicy = FAILOVER;
|
conf.iopolicy = FAILOVER;
|
||||||
if (!strcmp(argv[i], "multibus"))
|
if (!strcmp(argv[i], "multibus"))
|
||||||
conf.iopolicy = MULTIBUS;
|
conf.iopolicy = MULTIBUS;
|
||||||
if (!strcmp(argv[i], "group_by_serial"))
|
if (!strcmp(argv[i], "group_by_serial"))
|
||||||
conf.iopolicy = GROUP_BY_SERIAL;
|
conf.iopolicy = GROUP_BY_SERIAL;
|
||||||
} else if (0 == strcmp("scsi", argv[i]))
|
} else if (*argv[i] == '-') {
|
||||||
strcpy(conf.hotplugdev, argv[++i]);
|
|
||||||
else if (*argv[i] == '-') {
|
|
||||||
fprintf(stderr, "Unknown switch: %s\n", argv[i]);
|
fprintf(stderr, "Unknown switch: %s\n", argv[i]);
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
} else if (*argv[i] != '-') {
|
} else
|
||||||
fprintf(stderr, "Unknown argument\n");
|
strncpy(conf.hotplugdev, argv[i], FILE_NAME_SIZE);
|
||||||
usage(argv[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dynamic allocations */
|
/* dynamic allocations */
|
||||||
|
@ -102,7 +102,6 @@ struct env {
|
|||||||
int dry_run;
|
int dry_run;
|
||||||
int iopolicy;
|
int iopolicy;
|
||||||
int with_sysfs;
|
int with_sysfs;
|
||||||
int dm_path_test_int;
|
|
||||||
char sysfs_path[FILE_NAME_SIZE];
|
char sysfs_path[FILE_NAME_SIZE];
|
||||||
char hotplugdev[FILE_NAME_SIZE];
|
char hotplugdev[FILE_NAME_SIZE];
|
||||||
};
|
};
|
||||||
@ -110,8 +109,8 @@ struct env {
|
|||||||
/* Build version */
|
/* Build version */
|
||||||
#define PROG "multipath"
|
#define PROG "multipath"
|
||||||
|
|
||||||
#define VERSION_CODE 0x000010
|
#define VERSION_CODE 0x000012
|
||||||
#define DATE_CODE 0x0C1503
|
#define DATE_CODE 0x021504
|
||||||
|
|
||||||
#define MULTIPATH_VERSION(version) \
|
#define MULTIPATH_VERSION(version) \
|
||||||
(version >> 16) & 0xFF, \
|
(version >> 16) & 0xFF, \
|
||||||
|
53
extras/multipath/multipath.8
Normal file
53
extras/multipath/multipath.8
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
.TH MULTIPATH 8 "February 2004" "" "Linux Administrator's Manual"
|
||||||
|
.SH NAME
|
||||||
|
multipath \- Device mapper target autoconfig
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B multipath
|
||||||
|
.RB [\| \-v | \-q \|]
|
||||||
|
.RB [\| \-d \|]
|
||||||
|
.RB [\| \-m\ \c
|
||||||
|
.IR max_devs \|]
|
||||||
|
.RB [\| \-p\ \c
|
||||||
|
.BR failover | multibus | group_by_serial \|]
|
||||||
|
.RB [\| device \|]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B multipath
|
||||||
|
is used to detect multiple paths to devices for fail-over or performance reasons and coalesces them.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
.B \-v
|
||||||
|
verbose, print all paths and multipaths
|
||||||
|
.TP
|
||||||
|
.B \-q
|
||||||
|
quiet, no output at all
|
||||||
|
.TP
|
||||||
|
.B \-d
|
||||||
|
dry run, do not create or update devmaps
|
||||||
|
.TP
|
||||||
|
.BI \-m " max_devs"
|
||||||
|
scan
|
||||||
|
.I max_devs
|
||||||
|
devices at most
|
||||||
|
.TP
|
||||||
|
.BI \-p " policy"
|
||||||
|
force maps to specified policy:
|
||||||
|
.RS 1.2i
|
||||||
|
.TP 1.2i
|
||||||
|
.B failover
|
||||||
|
1 path per priority group
|
||||||
|
.TP
|
||||||
|
.B multibus
|
||||||
|
all paths in 1 priority group
|
||||||
|
.TP
|
||||||
|
.B group_by_serial
|
||||||
|
1 priority group per serial
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
.B device
|
||||||
|
limit the [re]configuration to the specified device's multipath scope. device is given in its hotplug $DEVPATH form like /devices/pci0000:03/0000:03:01.0/host0/0:0:5:1
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR udev (8),
|
||||||
|
.BR dmsetup (8)
|
||||||
|
.SH AUTHORS
|
||||||
|
.B multipath
|
||||||
|
was developed by Christophe Varoqui, <christophe.varoqui@free.fr> and others.
|
@ -1,6 +1,7 @@
|
|||||||
|
#!bin/sh
|
||||||
. /etc/hotplug/hotplug.functions
|
. /etc/hotplug/hotplug.functions
|
||||||
|
|
||||||
# wait for sysfs
|
# wait for sysfs
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
mesg `/sbin/multipath scsi $DEVPATH`
|
mesg `/sbin/multipath $DEVPATH`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user