forked from pool/multipath-tools
846 lines
23 KiB
Plaintext
846 lines
23 KiB
Plaintext
diff --git a/devmap_name/Makefile b/devmap_name/Makefile
|
|
index d8d8b09..57051d9 100644
|
|
--- a/devmap_name/Makefile
|
|
+++ b/devmap_name/Makefile
|
|
@@ -18,25 +18,22 @@ EXEC = devmap_name
|
|
all: $(BUILD)
|
|
|
|
prepare:
|
|
- rm -f core *.o *.gz
|
|
+ rm -f core *.o
|
|
|
|
glibc: prepare $(OBJS)
|
|
$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
|
|
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
|
|
|
|
klibc: prepare $(OBJS)
|
|
$(CC) -static -o $(EXEC) $(OBJS)
|
|
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
|
|
|
|
install: $(EXEC) $(EXEC).8
|
|
install -d $(DESTDIR)$(bindir)
|
|
install -m 755 $(EXEC) $(DESTDIR)$(bindir)/
|
|
install -d $(DESTDIR)$(mandir)
|
|
- install -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
|
+ install -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
|
|
|
|
uninstall:
|
|
rm $(DESTDIR)$(bindir)/$(EXEC)
|
|
- rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
|
|
|
clean:
|
|
- rm -f core *.o $(EXEC) *.gz
|
|
+ rm -f core *.o $(EXEC)
|
|
diff --git a/kpartx/Makefile b/kpartx/Makefile
|
|
index b4cca6c..d970d29 100644
|
|
--- a/kpartx/Makefile
|
|
+++ b/kpartx/Makefile
|
|
@@ -23,32 +23,29 @@ EXEC = kpartx
|
|
all: $(BUILD)
|
|
|
|
prepare:
|
|
- rm -f core *.o *.gz
|
|
+ rm -f core *.o
|
|
|
|
glibc: prepare $(OBJS)
|
|
$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
|
|
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
|
|
-
|
|
+
|
|
klibc: prepare $(OBJS)
|
|
$(CC) -static -o $(EXEC) $(CRT0) $(OBJS) $(KLIBC) $(LIBGCC)
|
|
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
|
|
|
|
$(MULTIPATHLIB)-$(BUILD).a:
|
|
make -C $(multipathdir) BUILD=$(BUILD)
|
|
|
|
-install: $(EXEC) $(EXEC).8
|
|
+install: $(EXEC) kpartx_id $(EXEC).8
|
|
install -d $(DESTDIR)$(bindir)
|
|
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
|
|
install -d $(DESTDIR)$(libudevdir)
|
|
install -m 755 kpartx_id $(DESTDIR)$(libudevdir)
|
|
install -d $(DESTDIR)/etc/udev/rules.d
|
|
- install -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/
|
|
+ install -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/70-kpartx.rules
|
|
install -d $(DESTDIR)$(mandir)
|
|
- install -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
|
+ install -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
|
|
|
|
uninstall:
|
|
rm -f $(DESTDIR)$(bindir)/$(EXEC)
|
|
- rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
|
|
|
clean:
|
|
- rm -f core *.o $(EXEC) *.gz
|
|
+ rm -f core *.o $(EXEC)
|
|
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
|
|
index dbe2ee2..f60e5f4 100644
|
|
--- a/kpartx/kpartx.c
|
|
+++ b/kpartx/kpartx.c
|
|
@@ -265,7 +265,7 @@ main(int argc, char **argv){
|
|
}
|
|
|
|
if (dm_prereq(DM_TARGET, 0, 0, 0) && (what == ADD || what == DELETE)) {
|
|
- fprintf(stderr, "device mapper prerequisites not met\n");
|
|
+ fprintf(stderr, "device mapper prerequisites not met\n");
|
|
exit(1);
|
|
}
|
|
|
|
@@ -387,10 +387,10 @@ main(int argc, char **argv){
|
|
slices[j].minor = m++;
|
|
|
|
start = slices[j].start - slices[k].start;
|
|
- printf("%s%s%d : 0 %lu /dev/dm-%d %lu\n",
|
|
+ printf("%s%s%d : 0 %lu %s%s%d %lu\n",
|
|
mapname, delim, j+1,
|
|
(unsigned long) slices[j].size,
|
|
- slices[k].minor, start);
|
|
+ mapname, delim, k, start);
|
|
c--;
|
|
}
|
|
/* Terminate loop if nothing more to resolve */
|
|
@@ -431,7 +431,7 @@ main(int argc, char **argv){
|
|
break;
|
|
|
|
case ADD:
|
|
- for (j=0, c = 0; j<n; j++) {
|
|
+ for (j = 0, c = 0; j < n; j++) {
|
|
if (slices[j].size == 0)
|
|
continue;
|
|
|
|
@@ -477,6 +477,7 @@ main(int argc, char **argv){
|
|
d = c;
|
|
while (c) {
|
|
for (j = 0; j < n; j++) {
|
|
+ unsigned long start;
|
|
int k = slices[j].container - 1;
|
|
|
|
if (slices[j].size == 0)
|
|
@@ -487,7 +488,7 @@ main(int argc, char **argv){
|
|
continue;
|
|
|
|
/* Skip all simple slices */
|
|
- if (k < 0)
|
|
+ if (slices[j].container == 0)
|
|
continue;
|
|
|
|
/* Check container slice */
|
|
@@ -502,10 +503,11 @@ main(int argc, char **argv){
|
|
}
|
|
strip_slash(partname);
|
|
|
|
+ start = slices[j].start - slices[k].start;
|
|
if (safe_sprintf(params, "%d:%d %lu",
|
|
slices[k].major,
|
|
slices[k].minor,
|
|
- (unsigned long)slices[j].start)) {
|
|
+ start)) {
|
|
fprintf(stderr, "params too small\n");
|
|
exit(1);
|
|
}
|
|
@@ -524,9 +526,12 @@ main(int argc, char **argv){
|
|
&slices[j].minor);
|
|
|
|
if (verbose)
|
|
- printf("add map %s : 0 %lu %s %s\n",
|
|
- partname, slices[j].size,
|
|
- DM_TARGET, params);
|
|
+ printf("add map %s (%d:%d): 0 %lu %s\n",
|
|
+ partname,
|
|
+ slices[j].major,
|
|
+ slices[j].minor,
|
|
+ slices[j].size,
|
|
+ params);
|
|
c--;
|
|
}
|
|
/* Terminate loop */
|
|
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
|
|
index f32c718..9ab9a49 100644
|
|
--- a/kpartx/kpartx.rules
|
|
+++ b/kpartx/kpartx.rules
|
|
@@ -9,7 +9,7 @@ ACTION=="remove", GOTO="kpartx_end"
|
|
|
|
ENV{DM_TABLE_STATE}!="LIVE", GOTO="kpartx_end"
|
|
|
|
-ENV{DM_UUID}=="?*", IMPORT{program}=="/lib/udev/kpartx_id %M %m $env{DM_UUID}"
|
|
+ENV{DM_UUID}=="?*", IMPORT{program}=="kpartx_id %M %m $env{DM_UUID}"
|
|
|
|
OPTIONS="link_priority=50"
|
|
|
|
@@ -18,7 +18,7 @@ ENV{DM_UUID}=="mpath-*", \
|
|
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
|
|
|
|
# Create persistent links for dmraid tables
|
|
-ENV{DM_UUID}=="mpath-*", \
|
|
+ENV{DM_UUID}=="dmraid-*", \
|
|
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
|
|
|
|
# Create persistent links for partitions
|
|
@@ -27,9 +27,9 @@ ENV{DM_PART}=="?*", \
|
|
|
|
# Create dm tables for partitions
|
|
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="mpath-*", \
|
|
- RUN+="/sbin/kpartx -a -p -part /dev/$kernel"
|
|
+ RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
|
|
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="dmraid-*", \
|
|
- RUN+="/sbin/kpartx -a -p -part /dev/$kernel"
|
|
+ RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
|
|
|
|
LABEL="kpartx_end"
|
|
|
|
diff --git a/libcheckers/Makefile b/libcheckers/Makefile
|
|
index 6340a68..bdd423f 100644
|
|
--- a/libcheckers/Makefile
|
|
+++ b/libcheckers/Makefile
|
|
@@ -11,7 +11,7 @@ OBJS = libsg.o checkers.o readsector0.o tur.o directio.o emc_clariion.o hp_sw.o
|
|
all: $(BUILD)
|
|
|
|
prepare:
|
|
- @file *-$(BUILD).a >/dev/null 2>&1 || rm -f core *.o *.gz
|
|
+ @file *-$(BUILD).a >/dev/null 2>&1 || rm -f core *.o
|
|
|
|
klibc: prepare $(OBJS)
|
|
ar rs libcheckers-klibc.a *.o
|
|
@@ -24,4 +24,4 @@ install:
|
|
uninstall:
|
|
|
|
clean:
|
|
- rm -f core *.a *.o *.gz
|
|
+ rm -f core *.a *.o
|
|
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
|
|
index 511f5ad..3ab059a 100644
|
|
--- a/libmultipath/Makefile
|
|
+++ b/libmultipath/Makefile
|
|
@@ -25,7 +25,7 @@ else
|
|
CLEAN = $(shell if [ ! "x$(PREVBUILD)" = "x" ]; then echo clean; fi)
|
|
endif
|
|
|
|
-LIBDM_API_FLUSH = $(shell objdump -T /lib/libdevmapper.so.* | grep -c dm_task_no_flush)
|
|
+LIBDM_API_FLUSH = $(shell /sbin/ldconfig -p | grep devmapper.so.1 | cut -d ' ' -f 4 | xargs objdump -T | grep -c dm_task_no_flush)
|
|
|
|
ifeq ($(strip $(LIBDM_API_FLUSH)),1)
|
|
CFLAGS += -DLIBDM_API_FLUSH
|
|
@@ -34,7 +34,7 @@ endif
|
|
all: $(BUILD)
|
|
|
|
prepare: $(CLEAN)
|
|
- @file *-$(BUILD).a >/dev/null 2>&1 || rm -f core *.o *.gz
|
|
+ @file *-$(BUILD).a >/dev/null 2>&1 || rm -f core *.o
|
|
@rm -f *-$(BUILD).a
|
|
|
|
klibc: $(OBJS)
|
|
@@ -48,4 +48,4 @@ install:
|
|
uninstall:
|
|
|
|
clean:
|
|
- rm -f core *.a *.o *.gz
|
|
+ rm -f core *.a *.o
|
|
diff --git a/libmultipath/config.c b/libmultipath/config.c
|
|
index a39af8a..1dfc18c 100644
|
|
--- a/libmultipath/config.c
|
|
+++ b/libmultipath/config.c
|
|
@@ -366,12 +366,15 @@ load_config (char * file)
|
|
/*
|
|
* read the config file
|
|
*/
|
|
+ set_current_keywords(&conf->keywords);
|
|
+ alloc_keywords();
|
|
if (filepresent(file)) {
|
|
- set_current_keywords(&conf->keywords);
|
|
if (init_data(file, init_keywords)) {
|
|
condlog(0, "error parsing config file");
|
|
goto out;
|
|
}
|
|
+ } else {
|
|
+ init_keywords();
|
|
}
|
|
|
|
/*
|
|
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
|
|
index f9c555e..5302970 100644
|
|
--- a/libmultipath/parser.c
|
|
+++ b/libmultipath/parser.c
|
|
@@ -455,16 +455,23 @@ process_stream(vector keywords)
|
|
return r;
|
|
}
|
|
|
|
+int alloc_keywords(void)
|
|
+{
|
|
+ if (!keywords)
|
|
+ keywords = vector_alloc();
|
|
+
|
|
+ if (!keywords)
|
|
+ return 1;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
/* Data initialization */
|
|
int
|
|
init_data(char *conf_file, void (*init_keywords) (void))
|
|
{
|
|
int r;
|
|
|
|
- if (!keywords)
|
|
- keywords = vector_alloc();
|
|
- if (!keywords)
|
|
- return 1;
|
|
stream = fopen(conf_file, "r");
|
|
if (!stream) {
|
|
syslog(LOG_WARNING, "Configuration file open problem");
|
|
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
|
|
index 95d4e6f..8496684 100644
|
|
--- a/libmultipath/parser.h
|
|
+++ b/libmultipath/parser.h
|
|
@@ -74,6 +74,7 @@ extern vector read_value_block(void);
|
|
extern int alloc_value_block(vector strvec, void (*alloc_func) (vector));
|
|
extern void *set_value(vector strvec);
|
|
extern int process_stream(vector keywords);
|
|
+extern int alloc_keywords(void);
|
|
extern int init_data(char *conf_file, void (*init_keywords) (void));
|
|
extern struct keyword * find_keyword(vector v, char * name);
|
|
void set_current_keywords (vector *k);
|
|
diff --git a/libmultipath/print.c b/libmultipath/print.c
|
|
index 01a157a..489bc2b 100644
|
|
--- a/libmultipath/print.c
|
|
+++ b/libmultipath/print.c
|
|
@@ -738,7 +738,7 @@ snprint_hwentry (char * buff, int len, struct hwentry * hwe)
|
|
if (fwd > len)
|
|
return len;
|
|
iterate_sub_keywords(rootkw, kw, i) {
|
|
- fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k %v\n",
|
|
+ fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k \"%v\"\n",
|
|
kw, hwe);
|
|
if (fwd > len)
|
|
return len;
|
|
diff --git a/multipath/Makefile b/multipath/Makefile
|
|
index 4923b2f..bad9da7 100644
|
|
--- a/multipath/Makefile
|
|
+++ b/multipath/Makefile
|
|
@@ -22,9 +22,7 @@ all: $(BUILD)
|
|
|
|
prepare:
|
|
make -C $(multipathdir) prepare
|
|
- rm -f core *.o *.gz
|
|
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
|
|
- $(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz
|
|
+ rm -f core *.o
|
|
|
|
glibc: prepare $(OBJS)
|
|
$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
|
|
@@ -42,17 +40,15 @@ install:
|
|
install -d $(DESTDIR)$(bindir)
|
|
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
|
|
install -d $(DESTDIR)/etc/udev/rules.d
|
|
- install -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/
|
|
+ install -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/71-multipath.rules
|
|
install -d $(DESTDIR)$(mandir)
|
|
- install -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
|
+ install -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
|
|
install -d $(DESTDIR)$(man5dir)
|
|
- install -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir)
|
|
+ install -m 644 multipath.conf.5 $(DESTDIR)$(man5dir)
|
|
|
|
uninstall:
|
|
rm $(DESTDIR)/etc/udev/rules.d/multipath.rules
|
|
rm $(DESTDIR)$(bindir)/$(EXEC)
|
|
- rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
|
- rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
|
|
|
|
clean:
|
|
- rm -f core *.o $(EXEC) *.gz
|
|
+ rm -f core *.o $(EXEC)
|
|
diff --git a/multipath/main.c b/multipath/main.c
|
|
index 815c307..e2d7f41 100644
|
|
--- a/multipath/main.c
|
|
+++ b/multipath/main.c
|
|
@@ -72,7 +72,7 @@ static void
|
|
usage (char * progname)
|
|
{
|
|
fprintf (stderr, VERSION_STRING);
|
|
- fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F]\n",
|
|
+ fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F|-t]\n",
|
|
progname);
|
|
fprintf (stderr,
|
|
"\t\t\t[-p failover|multibus|group_by_serial|group_by_prio]\n" \
|
|
@@ -90,6 +90,7 @@ usage (char * progname)
|
|
"\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-t\t\tprint internal hardware table\n" \
|
|
"\t-p policy\tforce all maps to specified policy :\n" \
|
|
"\t failover\t\t1 path per priority group\n" \
|
|
"\t multibus\t\tall paths in 1 priority group\n" \
|
|
@@ -307,6 +308,55 @@ out:
|
|
return r;
|
|
}
|
|
|
|
+static int
|
|
+dump_config (void)
|
|
+{
|
|
+ char * c;
|
|
+ char * reply;
|
|
+ unsigned int maxlen = 256;
|
|
+ int again = 1;
|
|
+
|
|
+ reply = MALLOC(maxlen);
|
|
+
|
|
+ while (again) {
|
|
+ if (!reply)
|
|
+ return 1;
|
|
+ c = reply;
|
|
+ c += snprint_defaults(c, reply + maxlen - c);
|
|
+ again = ((c - reply) == maxlen);
|
|
+ if (again) {
|
|
+ reply = REALLOC(reply, maxlen *= 2);
|
|
+ continue;
|
|
+ }
|
|
+ c += snprint_blacklist(c, reply + maxlen - c);
|
|
+ again = ((c - reply) == maxlen);
|
|
+ if (again) {
|
|
+ reply = REALLOC(reply, maxlen *= 2);
|
|
+ continue;
|
|
+ }
|
|
+ c += snprint_blacklist_except(c, reply + maxlen - c);
|
|
+ again = ((c - reply) == maxlen);
|
|
+ if (again) {
|
|
+ reply = REALLOC(reply, maxlen *= 2);
|
|
+ continue;
|
|
+ }
|
|
+ c += snprint_hwtable(c, reply + maxlen - c, conf->hwtable);
|
|
+ again = ((c - reply) == maxlen);
|
|
+ if (again) {
|
|
+ reply = REALLOC(reply, maxlen *= 2);
|
|
+ continue;
|
|
+ }
|
|
+ c += snprint_mptable(c, reply + maxlen - c, conf->mptable);
|
|
+ again = ((c - reply) == maxlen);
|
|
+ if (again)
|
|
+ reply = REALLOC(reply, maxlen *= 2);
|
|
+ }
|
|
+
|
|
+ printf("%s", reply);
|
|
+ FREE(reply);
|
|
+ return 0;
|
|
+}
|
|
+
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
@@ -330,7 +380,7 @@ main (int argc, char *argv[])
|
|
condlog(0, "multipath tools need sysfs mounted");
|
|
exit(1);
|
|
}
|
|
- while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:")) != EOF ) {
|
|
+ while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:t")) != EOF ) {
|
|
switch(arg) {
|
|
case 1: printf("optarg : %s\n",optarg);
|
|
break;
|
|
@@ -373,6 +423,9 @@ main (int argc, char *argv[])
|
|
usage(argv[0]);
|
|
}
|
|
break;
|
|
+ case 't':
|
|
+ dump_config();
|
|
+ goto out;
|
|
case 'h':
|
|
usage(argv[0]);
|
|
case ':':
|
|
diff --git a/multipath/multipath.8 b/multipath/multipath.8
|
|
index 693872b..e72cc45 100644
|
|
--- a/multipath/multipath.8
|
|
+++ b/multipath/multipath.8
|
|
@@ -6,7 +6,7 @@ multipath \- Device mapper target autoconfig
|
|
.RB [\| \-v\ \c
|
|
.IR verbosity \|]
|
|
.RB [\| \-d \|]
|
|
-.RB [\| \-h | \-l | \-ll | \-f | \-F \|]
|
|
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F \|]
|
|
.RB [\| \-p\ \c
|
|
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
|
|
.RB [\| device \|]
|
|
@@ -47,6 +47,9 @@ flush a multipath device map specified as parameter, if unused
|
|
.B \-F
|
|
flush all unused multipath device maps
|
|
.TP
|
|
+.B \-t
|
|
+print internal hardware table to stdout
|
|
+.TP
|
|
.BI \-p " policy"
|
|
force maps to specified policy:
|
|
.RS 1.2i
|
|
@@ -76,6 +79,9 @@ is in the /dev/sdb (as shown by udev in the $DEVNAME variable) or major:minor fo
|
|
.I device
|
|
may alternatively be a multipath mapname
|
|
.SH "SEE ALSO"
|
|
+.BR multipathd (8),
|
|
+.BR multipath.conf (5),
|
|
+.BR kpartx (8),
|
|
.BR udev (8),
|
|
.BR dmsetup (8)
|
|
.BR hotplug (8)
|
|
diff --git a/multipath/multipath.init.suse b/multipath/multipath.init.suse
|
|
new file mode 100755
|
|
index 0000000..daea61f
|
|
--- /dev/null
|
|
+++ b/multipath/multipath.init.suse
|
|
@@ -0,0 +1,130 @@
|
|
+#! /bin/sh
|
|
+# Copyright (c) 2005 SuSE GmbH Nuernberg, Germany.
|
|
+#
|
|
+# Author: Hannes Reinecke <feedback@suse.de>
|
|
+#
|
|
+# init.d/boot.multipath
|
|
+#
|
|
+### BEGIN INIT INFO
|
|
+# Provides: boot.multipath
|
|
+# Required-Start: boot.device-mapper boot.udev
|
|
+# Required-Stop:
|
|
+# Default-Start: B
|
|
+# Default-Stop:
|
|
+# Short-Description: Create multipath device targets
|
|
+# Description: Setup initial multipath device-mapper targets
|
|
+### END INIT INFO
|
|
+
|
|
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
+PROGRAM=/sbin/multipath
|
|
+
|
|
+# Set the maximum number of open files
|
|
+MAX_OPEN_FDS=4096
|
|
+
|
|
+test -x $PROGRAM || exit 5
|
|
+
|
|
+# Shell functions sourced from /etc/rc.status:
|
|
+# rc_check check and set local and overall rc status
|
|
+# rc_status check and set local and overall rc status
|
|
+# rc_status -v ditto but be verbose in local rc status
|
|
+# rc_status -v -r ditto and clear the local rc status
|
|
+# rc_failed set local and overall rc status to failed
|
|
+# rc_reset clear local rc status (overall remains)
|
|
+# rc_exit exit appropriate to overall rc status
|
|
+. /etc/rc.status
|
|
+
|
|
+# First reset status of this service
|
|
+rc_reset
|
|
+
|
|
+# Return values acc. to LSB for all commands but status:
|
|
+# 0 - success
|
|
+# 1 - misc error
|
|
+# 2 - invalid or excess args
|
|
+# 3 - unimplemented feature (e.g. reload)
|
|
+# 4 - insufficient privilege
|
|
+# 5 - program not installed
|
|
+# 6 - program not configured
|
|
+# 7 - program is not running
|
|
+#
|
|
+# Note that starting an already running service, stopping
|
|
+# or restarting a not-running service as well as the restart
|
|
+# with force-reload (in case signalling is not supported) are
|
|
+# considered a success.
|
|
+
|
|
+maplist=$(/sbin/dmsetup ls --target multipath | sed '/No devices/d' | cut -f 1)
|
|
+
|
|
+case "$1" in
|
|
+ start)
|
|
+ echo -n "Creating multipath targets:"
|
|
+ # Check whether multipath daemon is already running
|
|
+ if /sbin/multipathd -k"list paths" > /dev/null 2>&1 ; then
|
|
+ echo -n " (multipathd running)"
|
|
+ rc_status -v
|
|
+ rc_exit
|
|
+ fi
|
|
+
|
|
+ # Load prerequisite module
|
|
+ modprobe dm-multipath
|
|
+
|
|
+ # Be a chicken and flush all existing maps
|
|
+ for map in $maplist ; do
|
|
+ $PROGRAM -f $map
|
|
+ done
|
|
+
|
|
+ # Clear /dev/disk/by-name/ prior to start-up; multipath will
|
|
+ # recreate them.
|
|
+ rm -f /dev/disk/by-name/* 2>&1 >/dev/null
|
|
+
|
|
+ # Set the maximum number of open files
|
|
+ if [ -n "$MAX_OPEN_FDS" ] ; then
|
|
+ ulimit -n $MAX_OPEN_FDS
|
|
+ fi
|
|
+
|
|
+ # Start the program directly as checkproc doesn't work here
|
|
+ $PROGRAM -v 0
|
|
+
|
|
+ # Create all partitions which might have been missing
|
|
+ /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p -part"
|
|
+
|
|
+ # Remember status and be verbose
|
|
+ rc_status -v
|
|
+ sleep 1
|
|
+ ;;
|
|
+ stop)
|
|
+ echo -n "Removing multipath targets:"
|
|
+
|
|
+ # Remove all partition mappings
|
|
+ if /sbin/dmsetup ls | sed '/No devices/d' | grep -q -- -part; then
|
|
+ /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -d -p -part" 2> /dev/null
|
|
+ fi
|
|
+
|
|
+ # Flush all existing maps
|
|
+ for map in $maplist ; do
|
|
+ $PROGRAM -f $map
|
|
+ done
|
|
+
|
|
+ rc_failed 0
|
|
+ rc_status -v
|
|
+ ;;
|
|
+ status)
|
|
+ echo -n "Checking multipath targets: "
|
|
+ # Display active multipath tables
|
|
+ tblnum=$(/sbin/dmsetup ls --target multipath | sed '/No devices/d' | wc --lines)
|
|
+ if [ "$tblnum" ] && [ $tblnum -gt 0 ] ; then
|
|
+ echo -n "($tblnum multipath devices) "
|
|
+ rc_failed 0
|
|
+ else
|
|
+ rc_failed 3
|
|
+ fi
|
|
+ rc_status -v
|
|
+ ;;
|
|
+ reload)
|
|
+ $0 stop
|
|
+ $0 start
|
|
+ ;;
|
|
+ *)
|
|
+ echo "Usage: $0 {start|stop|status}"
|
|
+ exit 1
|
|
+ ;;
|
|
+esac
|
|
+rc_exit
|
|
diff --git a/multipathd/Makefile b/multipathd/Makefile
|
|
index b430b94..e076d56 100644
|
|
--- a/multipathd/Makefile
|
|
+++ b/multipathd/Makefile
|
|
@@ -35,7 +35,6 @@ klibc:
|
|
|
|
$(EXEC): clean $(OBJS)
|
|
$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
|
|
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
|
|
|
|
$(CHECKERSLIB)-glibc.a:
|
|
$(MAKE) -C $(checkersdir) BUILD=glibc glibc
|
|
@@ -48,14 +47,13 @@ install:
|
|
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
|
|
install -d $(DESTDIR)$(rcdir)
|
|
install -d $(DESTDIR)$(mandir)
|
|
- install -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
|
+ install -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
|
|
|
|
uninstall:
|
|
rm -f $(DESTDIR)$(bindir)/$(EXEC)
|
|
rm -f $(DESTDIR)$(rcdir)/$(EXEC)
|
|
- rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
|
|
|
clean:
|
|
$(MAKE) -C $(multipathdir) prepare DAEMON=1
|
|
- rm -f core *.o $(EXEC) *.gz
|
|
+ rm -f core *.o $(EXEC)
|
|
|
|
diff --git a/multipathd/multipathd.init.suse b/multipathd/multipathd.init.suse
|
|
new file mode 100755
|
|
index 0000000..c850896
|
|
--- /dev/null
|
|
+++ b/multipathd/multipathd.init.suse
|
|
@@ -0,0 +1,133 @@
|
|
+#! /bin/sh
|
|
+# Copyright (c) 1995-2001 SuSE GmbH Nuernberg, Germany.
|
|
+#
|
|
+# Author: Hannes Reinecke <feedback@suse.de>
|
|
+#
|
|
+# init.d/routed
|
|
+#
|
|
+# and symbolic its link
|
|
+#
|
|
+# /usr/sbin/rcrouted
|
|
+#
|
|
+### BEGIN INIT INFO
|
|
+# Provides: multipathd
|
|
+# Required-Start: $syslog
|
|
+# Required-Stop:
|
|
+# Default-Start: 3 5
|
|
+# Default-Stop: 0 1 2 4 6
|
|
+# Short-Description: Starts multipath daemon
|
|
+# Description: Starts the multipath daemon
|
|
+### END INIT INFO
|
|
+
|
|
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
+DAEMON=/sbin/multipathd
|
|
+PIDFILE=/var/run/multipathd.pid
|
|
+
|
|
+# Set the maximum number of open files
|
|
+MAX_OPEN_FDS=4096
|
|
+
|
|
+test -x $DAEMON || exit 5
|
|
+
|
|
+. /etc/rc.status
|
|
+
|
|
+# First reset status of this service
|
|
+rc_reset
|
|
+
|
|
+case "$1" in
|
|
+ start)
|
|
+ echo -n "Starting multipathd"
|
|
+
|
|
+ modprobe dm-multipath
|
|
+
|
|
+ # Set the maximum number of open files
|
|
+ if [ -n "$MAX_OPEN_FDS" ] ; then
|
|
+ ulimit -n $MAX_OPEN_FDS
|
|
+ fi
|
|
+
|
|
+ if [ -f $PIDFILE ]; then
|
|
+ PID="$(cat $PIDFILE)"
|
|
+ PROCNAME="$(ps -o cmd --no-headers $PID)"
|
|
+ fi
|
|
+
|
|
+ if [ "$PROCNAME" != "$DAEMON" ]; then
|
|
+ $DAEMON
|
|
+ fi
|
|
+
|
|
+ # Remember status and be verbose
|
|
+ rc_status -v
|
|
+ sleep 1
|
|
+ ;;
|
|
+ stop)
|
|
+ echo -n "Shutting down multipathd"
|
|
+ # Because of the way how multipathd sets up its own namespace
|
|
+ # and chroots to it, killproc cannot be used with this process.
|
|
+ # So implement a cruder version:
|
|
+ if [ -f $PIDFILE ]; then
|
|
+ PID="$(cat $PIDFILE)"
|
|
+ PROCNAME="$(ps -o cmd --no-headers $PID)"
|
|
+ fi
|
|
+
|
|
+ if [ "$PROCNAME" == "$DAEMON" ]; then
|
|
+ kill -TERM $PID
|
|
+ fi
|
|
+
|
|
+ # Remember status and be verbose
|
|
+ rc_status -v
|
|
+ ;;
|
|
+ try-restart)
|
|
+ ## Stop the service and if this succeeds (i.e. the
|
|
+ ## service was running before), start it again.
|
|
+ $0 status >/dev/null && $0 restart
|
|
+
|
|
+ # Remember status and be quiet
|
|
+ rc_status
|
|
+ ;;
|
|
+ restart|force-reload)
|
|
+ ## Stop the service and regardless of whether it was
|
|
+ ## running or not, start it again.
|
|
+ $0 stop
|
|
+ $0 start
|
|
+
|
|
+ # Remember status and be quiet
|
|
+ rc_status
|
|
+ ;;
|
|
+ reload)
|
|
+ ## Like force-reload, but if daemon does not support
|
|
+ ## signalling, do nothing (!)
|
|
+
|
|
+ # If it does not support reload:
|
|
+ exit 3
|
|
+ ;;
|
|
+ status)
|
|
+ echo -n "Checking for multipathd: "
|
|
+
|
|
+ # Status has a slightly different for the status command:
|
|
+ # 0 - service running
|
|
+ # 1 - service dead, but /var/run/ pid file exists
|
|
+ # 2 - service dead, but /var/lock/ lock file exists
|
|
+ # 3 - service not running
|
|
+
|
|
+ if [ -f $PIDFILE ]; then
|
|
+ PID="$(cat $PIDFILE)"
|
|
+ PROCNAME="$(ps -o cmd --no-headers $PID)"
|
|
+ if [ "$PROCNAME" == "$DAEMON" ]; then
|
|
+ (exit 0)
|
|
+ else
|
|
+ (exit 1)
|
|
+ fi
|
|
+ else
|
|
+ (exit 3)
|
|
+ fi
|
|
+
|
|
+ rc_status -v
|
|
+ ;;
|
|
+ probe)
|
|
+ ## Optional: Probe for the necessity of a reload,
|
|
+ ## give out the argument which is required for a reload.
|
|
+ ;;
|
|
+ *)
|
|
+ echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|
|
+ exit 1
|
|
+ ;;
|
|
+esac
|
|
+rc_exit
|
|
diff --git a/path_priority/pp_alua/Makefile b/path_priority/pp_alua/Makefile
|
|
index 6f356a1..ce78455 100644
|
|
--- a/path_priority/pp_alua/Makefile
|
|
+++ b/path_priority/pp_alua/Makefile
|
|
@@ -35,19 +35,15 @@ glibc: $(OBJS)
|
|
klibc: $(OBJS)
|
|
$(CC) -static -o $(EXEC) $(OBJS)
|
|
|
|
-install: $(EXEC) $(EXEC).8.gz
|
|
+install: $(EXEC) $(EXEC).8
|
|
$(INSTALL) -s -m 755 $(EXEC) $(DESTDIR)$(bindir)/$(EXEC)
|
|
- $(INSTALL) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
|
+ $(INSTALL) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/$(EXEC).8
|
|
|
|
uninstall:
|
|
rm $(DESTDIR)$(bindir)/$(EXEC)
|
|
- rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
|
|
|
clean:
|
|
- rm -f *.o *.gz $(EXEC)
|
|
-
|
|
-$(EXEC).8.gz: $(EXEC).8
|
|
- $(GZIP) $< >$@
|
|
+ rm -f *.o $(EXEC)
|
|
|
|
main.o: main.c rtpg.h spc3.h
|
|
|
|
diff --git a/path_priority/pp_balance_units/Makefile b/path_priority/pp_balance_units/Makefile
|
|
index cb1e6c6..43a0fc2 100644
|
|
--- a/path_priority/pp_balance_units/Makefile
|
|
+++ b/path_priority/pp_balance_units/Makefile
|
|
@@ -22,7 +22,7 @@ EXEC = mpath_prio_balance_units
|
|
all: $(BUILD)
|
|
|
|
prepare:
|
|
- rm -f core *.o *.gz
|
|
+ rm -f core *.o
|
|
|
|
glibc: prepare $(OBJS)
|
|
$(CC) -o $(EXEC) $(OBJS) $(LDFLAGS)
|
|
@@ -41,4 +41,4 @@ uninstall:
|
|
rm $(DESTDIR)$(bindir)/$(EXEC)
|
|
|
|
clean:
|
|
- rm -f core *.o $(EXEC) *.gz
|
|
+ rm -f core *.o $(EXEC)
|
|
diff --git a/path_priority/pp_hds_modular/pp_hds_modular.c b/path_priority/pp_hds_modular/pp_hds_modular.c
|
|
index 7411508..10b28b8 100644
|
|
--- a/path_priority/pp_hds_modular/pp_hds_modular.c
|
|
+++ b/path_priority/pp_hds_modular/pp_hds_modular.c
|
|
@@ -120,7 +120,7 @@ int main (int argc, char **argv)
|
|
int hds_modular_prio (const char *dev)
|
|
{
|
|
int sg_fd, k;
|
|
- char vendor[8];
|
|
+ char vendor[9];
|
|
char product[32];
|
|
char serial[32];
|
|
char ldev[32];
|