diff options
22 files changed, 1844 insertions, 321 deletions
diff --git a/meta-oe/recipes-support/multipath-tools/files/0001-multipath-attempt-at-common-multipath.rules.patch b/meta-oe/recipes-support/multipath-tools/files/0001-multipath-attempt-at-common-multipath.rules.patch new file mode 100644 index 0000000000..acb4269543 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0001-multipath-attempt-at-common-multipath.rules.patch | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | From 5ab50e0cb888e553a2635bbbf81eea3cdeffee60 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Wed, 12 Apr 2017 09:07:51 -0500 | ||
| 4 | Subject: [PATCH 01/14] multipath: attempt at common multipath.rules | ||
| 5 | |||
| 6 | This is a proposal to try and bring the Redhat and SuSE multipath.rules | ||
| 7 | closer. There are a couple of changes that I'd like some input on. | ||
| 8 | |||
| 9 | The big change is moving the kpartx call into the multipath rules. Half | ||
| 10 | of the current kpartx.rules file is about creating symlinks for multiple | ||
| 11 | types of dm devices. The other half auto-creates kpartx devices on top | ||
| 12 | of multipath devices. Since it is only creating kpartx devices on top of | ||
| 13 | multipath devices, I've moved the these rules into multipath.rules, or | ||
| 14 | rather, I've replaced them with the redhat rules in multipath.rules. The | ||
| 15 | biggest difference is the kpartx isn't run on every reload. It works | ||
| 16 | with the 11-dm-mpath.rules code to not run kpartx on multipathd | ||
| 17 | generated reloads or when there aren't any working paths. It does | ||
| 18 | remember if it didn't get to run kpartx when it was supposed to (because | ||
| 19 | there were no valid paths or the device was suspended) and will make | ||
| 20 | sure to run it on the next possible uevent. | ||
| 21 | |||
| 22 | The other change is the redhat multipath rules remove the partition | ||
| 23 | device nodes for devices claimed by multipath. The udev rule will only | ||
| 24 | do this one time (both to keep from running partx on every event, and so | ||
| 25 | that if users manually reread the partition table, we don't keep | ||
| 26 | removing them when clearly they are wanted). Redhat does this because we | ||
| 27 | had multiple customer issues where they were using the scsi partitions | ||
| 28 | instead of the kpartx devices. Obviously, with setting the partition | ||
| 29 | devices to not ready and clearing their fs_type, this isn't essential, | ||
| 30 | but it has helped make customers do the right thing. | ||
| 31 | |||
| 32 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 33 | --- | ||
| 34 | kpartx/kpartx.rules | 8 -------- | ||
| 35 | multipath/multipath.rules | 27 ++++++++++++++++++++++++--- | ||
| 36 | 2 files changed, 24 insertions(+), 11 deletions(-) | ||
| 37 | |||
| 38 | diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules | ||
| 39 | index a958791..906e320 100644 | ||
| 40 | --- a/kpartx/kpartx.rules | ||
| 41 | +++ b/kpartx/kpartx.rules | ||
| 42 | @@ -34,12 +34,4 @@ ENV{ID_FS_LABEL_ENC}=="?*", IMPORT{db}="ID_FS_LABEL_ENC" | ||
| 43 | ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", \ | ||
| 44 | SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" | ||
| 45 | |||
| 46 | -# Create dm tables for partitions | ||
| 47 | -ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", GOTO="kpartx_end" | ||
| 48 | -ENV{DM_NR_VALID_PATHS}=="0", GOTO="kpartx_end" | ||
| 49 | -ENV{ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1" | ||
| 50 | -ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="kpartx_end" | ||
| 51 | -ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \ | ||
| 52 | - RUN+="/sbin/kpartx -un -p -part /dev/$name" | ||
| 53 | - | ||
| 54 | LABEL="kpartx_end" | ||
| 55 | diff --git a/multipath/multipath.rules b/multipath/multipath.rules | ||
| 56 | index 86defc0..616a04c 100644 | ||
| 57 | --- a/multipath/multipath.rules | ||
| 58 | +++ b/multipath/multipath.rules | ||
| 59 | @@ -1,13 +1,13 @@ | ||
| 60 | # Set DM_MULTIPATH_DEVICE_PATH if the device should be handled by multipath | ||
| 61 | SUBSYSTEM!="block", GOTO="end_mpath" | ||
| 62 | ACTION!="add|change", GOTO="end_mpath" | ||
| 63 | -KERNEL!="sd*|dasd*", GOTO="end_mpath" | ||
| 64 | - | ||
| 65 | +KERNEL!="sd*|dasd*|rbd*|dm-*", GOTO="end_mpath" | ||
| 66 | IMPORT{cmdline}="nompath" | ||
| 67 | ENV{nompath}=="?*", GOTO="end_mpath" | ||
| 68 | IMPORT{cmdline}="multipath" | ||
| 69 | ENV{multipath}=="off", GOTO="end_mpath" | ||
| 70 | |||
| 71 | +KERNEL=="dm-*", GOTO="check_kpartx" | ||
| 72 | ENV{DEVTYPE}!="partition", GOTO="test_dev" | ||
| 73 | IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH" | ||
| 74 | ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{ID_FS_TYPE}="none", \ | ||
| 75 | @@ -21,7 +21,28 @@ TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin" | ||
| 76 | |||
| 77 | ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \ | ||
| 78 | PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -u %k", \ | ||
| 79 | - ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="none", \ | ||
| 80 | + ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="mpath_member", \ | ||
| 81 | ENV{SYSTEMD_READY}="0" | ||
| 82 | |||
| 83 | +ENV{DM_MULTIPATH_DEVICE_PATH}!="1", GOTO="end_mpath" | ||
| 84 | + | ||
| 85 | +IMPORT{db}="DM_MULTIPATH_WIPE_PARTS" | ||
| 86 | +ENV{DM_MULTIPATH_WIPE_PARTS}!="1", ENV{DM_MULTIPATH_WIPE_PARTS}="1", \ | ||
| 87 | + RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" | ||
| 88 | +GOTO="end_mpath" | ||
| 89 | + | ||
| 90 | +LABEL="check_kpartx" | ||
| 91 | + | ||
| 92 | +IMPORT{db}="DM_MULTIPATH_NEED_KPARTX" | ||
| 93 | +ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1" | ||
| 94 | +ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="end_mpath" | ||
| 95 | +ACTION!="change", GOTO="end_mpath" | ||
| 96 | +ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath" | ||
| 97 | +ENV{DM_ACTIVATION}=="1", ENV{DM_MULTIPATH_NEED_KPARTX}="1" | ||
| 98 | +ENV{DM_SUSPENDED}=="1", GOTO="end_mpath" | ||
| 99 | +ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath" | ||
| 100 | +ENV{DM_ACTIVATION}!="1", ENV{DM_MULTIPATH_NEED_KPARTX}!="1", GOTO="end_mpath" | ||
| 101 | +RUN+="/sbin/kpartx -un -p -part /dev/$name" | ||
| 102 | +ENV{DM_MULTIPATH_NEED_KPARTX}="" | ||
| 103 | + | ||
| 104 | LABEL="end_mpath" | ||
| 105 | -- | ||
| 106 | 2.8.1 | ||
| 107 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0001-multipathd.service-Error-fix.patch b/meta-oe/recipes-support/multipath-tools/files/0001-multipathd.service-Error-fix.patch deleted file mode 100644 index 60c3c0aec1..0000000000 --- a/meta-oe/recipes-support/multipath-tools/files/0001-multipathd.service-Error-fix.patch +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | From 630483b9738349c8b3e637a00879b96834a33cdb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li xin <lixin.fnst@cn.fujitsu.com> | ||
| 3 | Date: Tue, 7 Jul 2015 11:34:36 +0900 | ||
| 4 | Subject: [PATCH] multipathd.service: Error fix | ||
| 5 | |||
| 6 | Failed to start Device-Mapper Multipath Device Controller. | ||
| 7 | |||
| 8 | Upstream-Status: pending | ||
| 9 | |||
| 10 | Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com> | ||
| 11 | --- | ||
| 12 | multipathd/multipathd.service | 5 +++-- | ||
| 13 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service | ||
| 16 | index e3d6f91..a7e00b2 100644 | ||
| 17 | --- a/multipathd/multipathd.service | ||
| 18 | +++ b/multipathd/multipathd.service | ||
| 19 | @@ -8,11 +8,12 @@ Wants=local-fs-pre.target multipathd.socket blk-availability.service | ||
| 20 | Conflicts=shutdown.target | ||
| 21 | |||
| 22 | [Service] | ||
| 23 | -Type=notify | ||
| 24 | +Type=forking | ||
| 25 | NotifyAccess=main | ||
| 26 | LimitCORE=infinity | ||
| 27 | +PIDFile=/var/run/multipathd.pid | ||
| 28 | ExecStartPre=/sbin/modprobe -a scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm-multipath | ||
| 29 | -ExecStart=/sbin/multipathd -d -s | ||
| 30 | +ExecStart=/sbin/multipathd | ||
| 31 | ExecReload=/sbin/multipathd reconfigure | ||
| 32 | |||
| 33 | [Install] | ||
| 34 | -- | ||
| 35 | 2.11.0 | ||
| 36 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0002-RH-fixup-udev-rules-for-redhat.patch b/meta-oe/recipes-support/multipath-tools/files/0002-RH-fixup-udev-rules-for-redhat.patch new file mode 100644 index 0000000000..e63d2eb33f --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0002-RH-fixup-udev-rules-for-redhat.patch | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | From 158255383c02d3fb81c82fb9ec6fd36fb234f68e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Thu, 13 Apr 2017 07:22:23 -0500 | ||
| 4 | Subject: [PATCH 02/14] RH: fixup udev rules for redhat | ||
| 5 | |||
| 6 | The multipath rules need to run after scsi_id is run. This means moving | ||
| 7 | them after 60-persistent-storage.rules for redhat. Also, we don't | ||
| 8 | currently set up all the symlinks that SuSE does. If we want them, they | ||
| 9 | should be done in the device-mapper package, since they are for all | ||
| 10 | device-mapper devices. Redhat also uses a different naming scheme for | ||
| 11 | partitions than SuSE. | ||
| 12 | |||
| 13 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 14 | --- | ||
| 15 | Makefile.inc | 2 +- | ||
| 16 | kpartx/Makefile | 14 +++++++------- | ||
| 17 | multipath/Makefile | 4 ++-- | ||
| 18 | multipath/multipath.rules | 3 ++- | ||
| 19 | 4 files changed, 12 insertions(+), 11 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/Makefile.inc b/Makefile.inc | ||
| 22 | index 1815f9a..2591fa9 100644 | ||
| 23 | --- a/Makefile.inc | ||
| 24 | +++ b/Makefile.inc | ||
| 25 | @@ -47,7 +47,7 @@ endif | ||
| 26 | |||
| 27 | prefix = | ||
| 28 | exec_prefix = $(prefix) | ||
| 29 | -bindir = $(exec_prefix)/sbin | ||
| 30 | +bindir = $(exec_prefix)/usr/sbin | ||
| 31 | libudevdir = $(prefix)/$(SYSTEMDPATH)/udev | ||
| 32 | udevrulesdir = $(libudevdir)/rules.d | ||
| 33 | multipathdir = $(TOPDIR)/libmultipath | ||
| 34 | diff --git a/kpartx/Makefile b/kpartx/Makefile | ||
| 35 | index 7b75032..bfa6fe8 100644 | ||
| 36 | --- a/kpartx/Makefile | ||
| 37 | +++ b/kpartx/Makefile | ||
| 38 | @@ -26,19 +26,19 @@ $(EXEC): $(OBJS) | ||
| 39 | install: $(EXEC) $(EXEC).8 | ||
| 40 | $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) | ||
| 41 | $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir) | ||
| 42 | - $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir) | ||
| 43 | - $(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir) | ||
| 44 | - $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)/rules.d | ||
| 45 | - $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules | ||
| 46 | +# $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir) | ||
| 47 | +# $(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir) | ||
| 48 | +# $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)/rules.d | ||
| 49 | +# $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules | ||
| 50 | $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir) | ||
| 51 | $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(man8dir) | ||
| 52 | |||
| 53 | uninstall: | ||
| 54 | $(RM) $(DESTDIR)$(bindir)/$(EXEC) | ||
| 55 | $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz | ||
| 56 | - $(RM) $(DESTDIR)$(libudevdir)/kpartx_id | ||
| 57 | - $(RM) $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules | ||
| 58 | - $(RM) $(DESTDIR)$(libudevdir)/rules.d/67-kpartx-compat.rules | ||
| 59 | +# $(RM) $(DESTDIR)$(libudevdir)/kpartx_id | ||
| 60 | +# $(RM) $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules | ||
| 61 | +# $(RM) $(DESTDIR)$(libudevdir)/rules.d/67-kpartx-compat.rules | ||
| 62 | |||
| 63 | clean: | ||
| 64 | $(RM) core *.o $(EXEC) *.gz | ||
| 65 | diff --git a/multipath/Makefile b/multipath/Makefile | ||
| 66 | index c85314e..1e9ee4b 100644 | ||
| 67 | --- a/multipath/Makefile | ||
| 68 | +++ b/multipath/Makefile | ||
| 69 | @@ -24,7 +24,7 @@ install: | ||
| 70 | $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ | ||
| 71 | $(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir) | ||
| 72 | $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) | ||
| 73 | - $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules | ||
| 74 | + $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules | ||
| 75 | $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir) | ||
| 76 | $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(man8dir) | ||
| 77 | $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) | ||
| 78 | @@ -33,7 +33,7 @@ install: | ||
| 79 | uninstall: | ||
| 80 | $(RM) $(DESTDIR)$(bindir)/$(EXEC) | ||
| 81 | $(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules | ||
| 82 | - $(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules | ||
| 83 | + $(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules | ||
| 84 | $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz | ||
| 85 | $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz | ||
| 86 | |||
| 87 | diff --git a/multipath/multipath.rules b/multipath/multipath.rules | ||
| 88 | index 616a04c..4d78b98 100644 | ||
| 89 | --- a/multipath/multipath.rules | ||
| 90 | +++ b/multipath/multipath.rules | ||
| 91 | @@ -33,6 +33,7 @@ GOTO="end_mpath" | ||
| 92 | |||
| 93 | LABEL="check_kpartx" | ||
| 94 | |||
| 95 | +ENV{DM_UUID}=="mpath-?*|part[0-9]*-mpath-?*", OPTIONS+="link_priority=10" | ||
| 96 | IMPORT{db}="DM_MULTIPATH_NEED_KPARTX" | ||
| 97 | ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1" | ||
| 98 | ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="end_mpath" | ||
| 99 | @@ -42,7 +43,7 @@ ENV{DM_ACTIVATION}=="1", ENV{DM_MULTIPATH_NEED_KPARTX}="1" | ||
| 100 | ENV{DM_SUSPENDED}=="1", GOTO="end_mpath" | ||
| 101 | ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath" | ||
| 102 | ENV{DM_ACTIVATION}!="1", ENV{DM_MULTIPATH_NEED_KPARTX}!="1", GOTO="end_mpath" | ||
| 103 | -RUN+="/sbin/kpartx -un -p -part /dev/$name" | ||
| 104 | +RUN+="/sbin/kpartx -un /dev/$name" | ||
| 105 | ENV{DM_MULTIPATH_NEED_KPARTX}="" | ||
| 106 | |||
| 107 | LABEL="end_mpath" | ||
| 108 | -- | ||
| 109 | 2.8.1 | ||
| 110 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0003-RH-Remove-the-property-blacklist-exception-builtin.patch b/meta-oe/recipes-support/multipath-tools/files/0003-RH-Remove-the-property-blacklist-exception-builtin.patch new file mode 100644 index 0000000000..684e959d66 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0003-RH-Remove-the-property-blacklist-exception-builtin.patch | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | From 69a67c2ed09ae51b53de402966a9f7a4cc737715 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Wed, 2 Jul 2014 12:49:53 -0500 | ||
| 4 | Subject: [PATCH 03/14] RH: Remove the property blacklist exception builtin | ||
| 5 | |||
| 6 | Multipath set the default property blacklist exceptions to | ||
| 7 | (ID_SCSI_VPD|ID_WWN). This has the effect of blacklisting some internal | ||
| 8 | devices. These devices may never have multiple paths, but it is nice | ||
| 9 | to be able to set multipath up on them all the same. This patch simply | ||
| 10 | removes the default, and makes it so that if no property | ||
| 11 | blacklist_exception is given, then devices aren't failed for not matching | ||
| 12 | it. | ||
| 13 | |||
| 14 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 15 | --- | ||
| 16 | libmultipath/blacklist.c | 15 ++++++--------- | ||
| 17 | multipath/multipath.conf.5 | 4 ---- | ||
| 18 | 2 files changed, 6 insertions(+), 13 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c | ||
| 21 | index ee396e2..19d4697 100644 | ||
| 22 | --- a/libmultipath/blacklist.c | ||
| 23 | +++ b/libmultipath/blacklist.c | ||
| 24 | @@ -181,12 +181,6 @@ setup_default_blist (struct config * conf) | ||
| 25 | if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) | ||
| 26 | return 1; | ||
| 27 | |||
| 28 | - str = STRDUP("(SCSI_IDENT_|ID_WWN)"); | ||
| 29 | - if (!str) | ||
| 30 | - return 1; | ||
| 31 | - if (store_ble(conf->elist_property, str, ORIGIN_DEFAULT)) | ||
| 32 | - return 1; | ||
| 33 | - | ||
| 34 | vector_foreach_slot (conf->hwtable, hwe, i) { | ||
| 35 | if (hwe->bl_product) { | ||
| 36 | if (_blacklist_device(conf->blist_device, hwe->vendor, | ||
| 37 | @@ -390,9 +384,12 @@ filter_property(struct config * conf, struct udev_device * udev) | ||
| 38 | * This is the inverse of the 'normal' matching; | ||
| 39 | * the environment variable _has_ to match. | ||
| 40 | */ | ||
| 41 | - log_filter(devname, NULL, NULL, NULL, NULL, | ||
| 42 | - MATCH_PROPERTY_BLIST_MISSING); | ||
| 43 | - return MATCH_PROPERTY_BLIST_MISSING; | ||
| 44 | + if (VECTOR_SIZE(conf->elist_property)) { | ||
| 45 | + log_filter(devname, NULL, NULL, NULL, NULL, | ||
| 46 | + MATCH_PROPERTY_BLIST_MISSING); | ||
| 47 | + return MATCH_PROPERTY_BLIST_MISSING; | ||
| 48 | + } | ||
| 49 | + return 0; | ||
| 50 | } | ||
| 51 | |||
| 52 | void | ||
| 53 | diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 | ||
| 54 | index f04ff19..fbbbb27 100644 | ||
| 55 | --- a/multipath/multipath.conf.5 | ||
| 56 | +++ b/multipath/multipath.conf.5 | ||
| 57 | @@ -1014,10 +1014,6 @@ The \fIWorld Wide Identification\fR of a device. | ||
| 58 | .TP | ||
| 59 | .B property | ||
| 60 | Regular expression of the udev property to be whitelisted. | ||
| 61 | -.RS | ||
| 62 | -.TP | ||
| 63 | -The default is: \fB(SCSI_IDENT_|ID_WWN)\fR | ||
| 64 | -.RE | ||
| 65 | .TP | ||
| 66 | .B device | ||
| 67 | Subsection for the device description. This subsection recognizes the | ||
| 68 | -- | ||
| 69 | 2.8.1 | ||
| 70 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0004-RH-don-t-start-without-a-config-file.patch b/meta-oe/recipes-support/multipath-tools/files/0004-RH-don-t-start-without-a-config-file.patch new file mode 100644 index 0000000000..87a6d3fb65 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0004-RH-don-t-start-without-a-config-file.patch | |||
| @@ -0,0 +1,108 @@ | |||
| 1 | From b2b504fc1959c7a3f0a843c3c204e8e193b675b7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Wed, 15 Oct 2014 10:39:30 -0500 | ||
| 4 | Subject: [PATCH 04/14] RH: don't start without a config file | ||
| 5 | |||
| 6 | If /etc/multipath.conf doesn't exist, don't start multipathd and blacklist | ||
| 7 | all devices when running multipath. A completely blank configuration file | ||
| 8 | is almost never what users want. Also, people may have the multipath | ||
| 9 | packages installed but don't want to use them. This patch provides a | ||
| 10 | simple way to disable multipath. Simply removing or renaming | ||
| 11 | /etc/multipath.conf will keep multipath from doing anything. | ||
| 12 | |||
| 13 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 14 | --- | ||
| 15 | libmultipath/config.c | 17 +++++++++++++++++ | ||
| 16 | libmultipath/config.h | 1 + | ||
| 17 | multipath/multipath.rules | 1 + | ||
| 18 | multipathd/multipathd.8 | 2 ++ | ||
| 19 | multipathd/multipathd.service | 1 + | ||
| 20 | 5 files changed, 22 insertions(+) | ||
| 21 | |||
| 22 | diff --git a/libmultipath/config.c b/libmultipath/config.c | ||
| 23 | index bb6619b..aae69b8 100644 | ||
| 24 | --- a/libmultipath/config.c | ||
| 25 | +++ b/libmultipath/config.c | ||
| 26 | @@ -25,6 +25,7 @@ | ||
| 27 | #include "prio.h" | ||
| 28 | #include "devmapper.h" | ||
| 29 | #include "mpath_cmd.h" | ||
| 30 | +#include "version.h" | ||
| 31 | |||
| 32 | static int | ||
| 33 | hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2) | ||
| 34 | @@ -667,6 +668,22 @@ load_config (char * file) | ||
| 35 | factorize_hwtable(conf->hwtable, builtin_hwtable_size); | ||
| 36 | } | ||
| 37 | |||
| 38 | + } else { | ||
| 39 | + condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); | ||
| 40 | + condlog(0, "A default multipath.conf file is located at"); | ||
| 41 | + condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE)); | ||
| 42 | + if (conf->blist_devnode == NULL) { | ||
| 43 | + conf->blist_devnode = vector_alloc(); | ||
| 44 | + if (!conf->blist_devnode) { | ||
| 45 | + condlog(0, "cannot allocate blacklist\n"); | ||
| 46 | + goto out; | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + if (store_ble(conf->blist_devnode, strdup(".*"), | ||
| 50 | + ORIGIN_NO_CONFIG)) { | ||
| 51 | + condlog(0, "cannot store default no-config blacklist\n"); | ||
| 52 | + goto out; | ||
| 53 | + } | ||
| 54 | } | ||
| 55 | |||
| 56 | conf->processed_main_config = 1; | ||
| 57 | diff --git a/libmultipath/config.h b/libmultipath/config.h | ||
| 58 | index ffc69b5..614331c 100644 | ||
| 59 | --- a/libmultipath/config.h | ||
| 60 | +++ b/libmultipath/config.h | ||
| 61 | @@ -7,6 +7,7 @@ | ||
| 62 | |||
| 63 | #define ORIGIN_DEFAULT 0 | ||
| 64 | #define ORIGIN_CONFIG 1 | ||
| 65 | +#define ORIGIN_NO_CONFIG 2 | ||
| 66 | |||
| 67 | /* | ||
| 68 | * In kernel, fast_io_fail == 0 means immediate failure on rport delete. | ||
| 69 | diff --git a/multipath/multipath.rules b/multipath/multipath.rules | ||
| 70 | index 4d78b98..5753766 100644 | ||
| 71 | --- a/multipath/multipath.rules | ||
| 72 | +++ b/multipath/multipath.rules | ||
| 73 | @@ -6,6 +6,7 @@ IMPORT{cmdline}="nompath" | ||
| 74 | ENV{nompath}=="?*", GOTO="end_mpath" | ||
| 75 | IMPORT{cmdline}="multipath" | ||
| 76 | ENV{multipath}=="off", GOTO="end_mpath" | ||
| 77 | +TEST!="/etc/multipath.conf", GOTO="end_mpath" | ||
| 78 | |||
| 79 | KERNEL=="dm-*", GOTO="check_kpartx" | ||
| 80 | ENV{DEVTYPE}!="partition", GOTO="test_dev" | ||
| 81 | diff --git a/multipathd/multipathd.8 b/multipathd/multipathd.8 | ||
| 82 | index 4c765af..c1499a5 100644 | ||
| 83 | --- a/multipathd/multipathd.8 | ||
| 84 | +++ b/multipathd/multipathd.8 | ||
| 85 | @@ -39,6 +39,8 @@ map regains its maximum performance and redundancy. | ||
| 86 | This daemon executes the external \fBmultipath\fR tool when events occur. | ||
| 87 | In turn, the multipath tool signals the multipathd daemon when it is done with | ||
| 88 | devmap reconfiguration, so that it can refresh its failed path list. | ||
| 89 | + | ||
| 90 | +In this Linux distribution, multipathd does not run unless a /etc/multipath.conffile exists | ||
| 91 | . | ||
| 92 | . | ||
| 93 | .\" ---------------------------------------------------------------------------- | ||
| 94 | diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service | ||
| 95 | index fd66cf6..fafd088 100644 | ||
| 96 | --- a/multipathd/multipathd.service | ||
| 97 | +++ b/multipathd/multipathd.service | ||
| 98 | @@ -4,6 +4,7 @@ Wants=systemd-udev-trigger.service systemd-udev-settle.service | ||
| 99 | Before=iscsi.service iscsid.service lvm2-lvmetad.service lvm2-activation-early.service | ||
| 100 | Before=local-fs-pre.target blk-availability.service | ||
| 101 | After=multipathd.socket systemd-udev-trigger.service systemd-udev-settle.service | ||
| 102 | +ConditionPathExists=/etc/multipath.conf | ||
| 103 | DefaultDependencies=no | ||
| 104 | Conflicts=shutdown.target | ||
| 105 | ConditionKernelCommandLine=!nompath | ||
| 106 | -- | ||
| 107 | 2.8.1 | ||
| 108 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0005-RH-add-mpathconf.patch b/meta-oe/recipes-support/multipath-tools/files/0005-RH-add-mpathconf.patch new file mode 100644 index 0000000000..acef41023b --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0005-RH-add-mpathconf.patch | |||
| @@ -0,0 +1,648 @@ | |||
| 1 | From de44504fe7f7802cd474efd92ac15b5a8857db1f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Thu, 16 Oct 2014 15:49:01 -0500 | ||
| 4 | Subject: [PATCH 05/14] RH: add mpathconf | ||
| 5 | |||
| 6 | mpathconf is a program (largely based on lvmcomf) to help users | ||
| 7 | configure /etc/multipath.conf and enable or disable multipathing. It | ||
| 8 | has a couple of built-in options that can be set directly from the | ||
| 9 | command line. But, mostly it is used to get a multipath.conf file | ||
| 10 | with the OS defaults, and to enable and disable multipathing via | ||
| 11 | a single command. | ||
| 12 | |||
| 13 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 14 | --- | ||
| 15 | libmultipath/config.c | 1 + | ||
| 16 | multipath/Makefile | 5 + | ||
| 17 | multipath/mpathconf | 464 ++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 18 | multipath/mpathconf.8 | 101 +++++++++++ | ||
| 19 | 4 files changed, 571 insertions(+) | ||
| 20 | create mode 100644 multipath/mpathconf | ||
| 21 | create mode 100644 multipath/mpathconf.8 | ||
| 22 | |||
| 23 | diff --git a/libmultipath/config.c b/libmultipath/config.c | ||
| 24 | index aae69b8..c485748 100644 | ||
| 25 | --- a/libmultipath/config.c | ||
| 26 | +++ b/libmultipath/config.c | ||
| 27 | @@ -672,6 +672,7 @@ load_config (char * file) | ||
| 28 | condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); | ||
| 29 | condlog(0, "A default multipath.conf file is located at"); | ||
| 30 | condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE)); | ||
| 31 | + condlog(0, "You can run /sbin/mpathconf to create or modify /etc/multipath.conf"); | ||
| 32 | if (conf->blist_devnode == NULL) { | ||
| 33 | conf->blist_devnode = vector_alloc(); | ||
| 34 | if (!conf->blist_devnode) { | ||
| 35 | diff --git a/multipath/Makefile b/multipath/Makefile | ||
| 36 | index 1e9ee4b..3d4d459 100644 | ||
| 37 | --- a/multipath/Makefile | ||
| 38 | +++ b/multipath/Makefile | ||
| 39 | @@ -18,10 +18,12 @@ $(EXEC): $(OBJS) | ||
| 40 | $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS) | ||
| 41 | $(GZIP) $(EXEC).8 > $(EXEC).8.gz | ||
| 42 | $(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz | ||
| 43 | + $(GZIP) mpathconf.8 > mpathconf.8.gz | ||
| 44 | |||
| 45 | install: | ||
| 46 | $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) | ||
| 47 | $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ | ||
| 48 | + $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ | ||
| 49 | $(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir) | ||
| 50 | $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) | ||
| 51 | $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules | ||
| 52 | @@ -29,13 +31,16 @@ install: | ||
| 53 | $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(man8dir) | ||
| 54 | $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) | ||
| 55 | $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir) | ||
| 56 | + $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(man8dir) | ||
| 57 | |||
| 58 | uninstall: | ||
| 59 | $(RM) $(DESTDIR)$(bindir)/$(EXEC) | ||
| 60 | $(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules | ||
| 61 | $(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules | ||
| 62 | + $(RM) $(DESTDIR)$(bindir)/mpathconf | ||
| 63 | $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz | ||
| 64 | $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz | ||
| 65 | + $(RM) $(DESTDIR)$(man8dir)/mpathconf.8.gz | ||
| 66 | |||
| 67 | clean: | ||
| 68 | $(RM) core *.o $(EXEC) *.gz | ||
| 69 | diff --git a/multipath/mpathconf b/multipath/mpathconf | ||
| 70 | new file mode 100644 | ||
| 71 | index 0000000..e839134 | ||
| 72 | --- /dev/null | ||
| 73 | +++ b/multipath/mpathconf | ||
| 74 | @@ -0,0 +1,464 @@ | ||
| 75 | +#!/bin/bash | ||
| 76 | +# | ||
| 77 | +# Copyright (C) 2010 Red Hat, Inc. All rights reserved. | ||
| 78 | +# | ||
| 79 | +# This file is part of the device-mapper-multipath package. | ||
| 80 | +# | ||
| 81 | +# This copyrighted material is made available to anyone wishing to use, | ||
| 82 | +# modify, copy, or redistribute it subject to the terms and conditions | ||
| 83 | +# of the GNU General Public License v.2. | ||
| 84 | +# | ||
| 85 | +# You should have received a copy of the GNU General Public License | ||
| 86 | +# along with this program; if not, write to the Free Software Foundation, | ||
| 87 | +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 88 | + | ||
| 89 | +# | ||
| 90 | +# Simple editting of /etc/multipath.conf | ||
| 91 | +# This program was largely ripped off from lvmconf | ||
| 92 | +# | ||
| 93 | + | ||
| 94 | +unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST | ||
| 95 | + | ||
| 96 | +DEFAULT_CONFIG="# device-mapper-multipath configuration file | ||
| 97 | + | ||
| 98 | +# For a complete list of the default configuration values, run either: | ||
| 99 | +# # multipath -t | ||
| 100 | +# or | ||
| 101 | +# # multipathd show config | ||
| 102 | + | ||
| 103 | +# For a list of configuration options with descriptions, see the | ||
| 104 | +# multipath.conf man page. | ||
| 105 | + | ||
| 106 | +defaults { | ||
| 107 | + user_friendly_names yes | ||
| 108 | + find_multipaths yes | ||
| 109 | +} | ||
| 110 | + | ||
| 111 | +blacklist_exceptions { | ||
| 112 | + property \"(SCSI_IDENT_|ID_WWN)\" | ||
| 113 | +}" | ||
| 114 | + | ||
| 115 | +CONFIGFILE="/etc/multipath.conf" | ||
| 116 | +OUTPUTFILE="/etc/multipath.conf" | ||
| 117 | +MULTIPATHDIR="/etc/multipath" | ||
| 118 | +TMPFILE="/etc/multipath/.multipath.conf.tmp" | ||
| 119 | +WWIDS=0 | ||
| 120 | + | ||
| 121 | +function usage | ||
| 122 | +{ | ||
| 123 | + echo "usage: $0 <command>" | ||
| 124 | + echo "" | ||
| 125 | + echo "Commands:" | ||
| 126 | + echo "Enable: --enable " | ||
| 127 | + echo "Disable: --disable" | ||
| 128 | + echo "Only allow certain wwids (instead of enable): --allow <WWID>" | ||
| 129 | + echo "Set user_friendly_names (Default y): --user_friendly_names <y|n>" | ||
| 130 | + echo "Set find_multipaths (Default y): --find_multipaths <y|n>" | ||
| 131 | + echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>" | ||
| 132 | + echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>" | ||
| 133 | + echo "select output file (Default /etc/multipath.conf): --outfile <FILE>" | ||
| 134 | + echo "" | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +function add_wwid | ||
| 138 | +{ | ||
| 139 | + INDEX=0 | ||
| 140 | + while [ "$INDEX" -lt "$WWIDS" ] ; do | ||
| 141 | + if [ "$1" = "${WWID_LIST[$INDEX]}" ] ; then | ||
| 142 | + return | ||
| 143 | + fi | ||
| 144 | + ((INDEX++)) | ||
| 145 | + done | ||
| 146 | + WWID_LIST[$WWIDS]="$1" | ||
| 147 | + ((WWIDS++)) | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | +function get_dm_deps | ||
| 151 | +{ | ||
| 152 | + shift 3 | ||
| 153 | + while [ -n "$1" -a -n "$2" ]; do | ||
| 154 | + MAJOR=$(echo $1 | tr -d '(,') | ||
| 155 | + MINOR=$(echo $2 | tr -d ')') | ||
| 156 | + UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR 2> /dev/null` | ||
| 157 | + if [ -n "$UUID" ] ; then | ||
| 158 | + set_dm_wwid $UUID | ||
| 159 | + fi | ||
| 160 | + shift 2 | ||
| 161 | + done | ||
| 162 | +} | ||
| 163 | + | ||
| 164 | +function set_dm_wwid | ||
| 165 | +{ | ||
| 166 | + if [[ "$1" =~ ^part[[:digit:]]+-mpath- ]] ; then | ||
| 167 | + add_wwid "${1##part*-mpath-}" | ||
| 168 | + elif [[ "$1" =~ ^mpath- ]] ; then | ||
| 169 | + add_wwid "${1##mpath-}" | ||
| 170 | + else | ||
| 171 | + get_dm_deps `dmsetup deps -u $1` | ||
| 172 | + fi | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +function set_wwid | ||
| 176 | +{ | ||
| 177 | + UUID="" | ||
| 178 | + if [[ "$1" =~ ^[[:digit:]]+:[[:digit:]]+$ ]] ; then | ||
| 179 | + MAJOR=${1%%:*} | ||
| 180 | + MINOR=${1##*:} | ||
| 181 | + UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR 2> /dev/null` | ||
| 182 | + else | ||
| 183 | + UUID=`dmsetup info -c --noheadings -o uuid $1 2> /dev/null` | ||
| 184 | + fi | ||
| 185 | + if [ -n "$UUID" ] ; then | ||
| 186 | + set_dm_wwid $UUID | ||
| 187 | + else | ||
| 188 | + add_wwid "$1" | ||
| 189 | + fi | ||
| 190 | +} | ||
| 191 | + | ||
| 192 | +function parse_args | ||
| 193 | +{ | ||
| 194 | + while [ -n "$1" ]; do | ||
| 195 | + case $1 in | ||
| 196 | + --enable) | ||
| 197 | + ENABLE=1 | ||
| 198 | + shift | ||
| 199 | + ;; | ||
| 200 | + --disable) | ||
| 201 | + ENABLE=0 | ||
| 202 | + shift | ||
| 203 | + ;; | ||
| 204 | + --allow) | ||
| 205 | + ENABLE=2 | ||
| 206 | + if [ -n "$2" ]; then | ||
| 207 | + set_wwid $2 | ||
| 208 | + shift 2 | ||
| 209 | + else | ||
| 210 | + usage | ||
| 211 | + exit 1 | ||
| 212 | + fi | ||
| 213 | + ;; | ||
| 214 | + --user_friendly_names) | ||
| 215 | + if [ -n "$2" ]; then | ||
| 216 | + FRIENDLY=$2 | ||
| 217 | + shift 2 | ||
| 218 | + else | ||
| 219 | + usage | ||
| 220 | + exit 1 | ||
| 221 | + fi | ||
| 222 | + ;; | ||
| 223 | + --find_multipaths) | ||
| 224 | + if [ -n "$2" ]; then | ||
| 225 | + FIND=$2 | ||
| 226 | + shift 2 | ||
| 227 | + else | ||
| 228 | + usage | ||
| 229 | + exit 1 | ||
| 230 | + fi | ||
| 231 | + ;; | ||
| 232 | + --with_module) | ||
| 233 | + if [ -n "$2" ]; then | ||
| 234 | + MODULE=$2 | ||
| 235 | + shift 2 | ||
| 236 | + else | ||
| 237 | + usage | ||
| 238 | + exit 1 | ||
| 239 | + fi | ||
| 240 | + ;; | ||
| 241 | + --with_multipathd) | ||
| 242 | + if [ -n "$2" ]; then | ||
| 243 | + MULTIPATHD=$2 | ||
| 244 | + shift 2 | ||
| 245 | + else | ||
| 246 | + usage | ||
| 247 | + exit 1 | ||
| 248 | + fi | ||
| 249 | + ;; | ||
| 250 | + --outfile) | ||
| 251 | + if [ -n "$2" ]; then | ||
| 252 | + OUTPUTFILE=$2 | ||
| 253 | + HAVE_OUTFILE=1 | ||
| 254 | + shift 2 | ||
| 255 | + else | ||
| 256 | + usage | ||
| 257 | + exit 1 | ||
| 258 | + fi | ||
| 259 | + ;; | ||
| 260 | + *) | ||
| 261 | + usage | ||
| 262 | + exit | ||
| 263 | + esac | ||
| 264 | + done | ||
| 265 | +} | ||
| 266 | + | ||
| 267 | +function validate_args | ||
| 268 | +{ | ||
| 269 | + if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$MODULE" ]; then | ||
| 270 | + echo "ignoring extra parameters on disable" | ||
| 271 | + FRIENDLY="" | ||
| 272 | + FIND="" | ||
| 273 | + MODULE="" | ||
| 274 | + fi | ||
| 275 | + if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then | ||
| 276 | + echo "--user_friendly_names must be either 'y' or 'n'" | ||
| 277 | + exit 1 | ||
| 278 | + fi | ||
| 279 | + if [ -n "$FIND" ] && [ "$FIND" != "y" -a "$FIND" != "n" ]; then | ||
| 280 | + echo "--find_multipaths must be either 'y' or 'n'" | ||
| 281 | + exit 1 | ||
| 282 | + fi | ||
| 283 | + if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" ]; then | ||
| 284 | + SHOW_STATUS=1 | ||
| 285 | + fi | ||
| 286 | + if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then | ||
| 287 | + echo "--with_module must be either 'y' or 'n'" | ||
| 288 | + exit 1 | ||
| 289 | + fi | ||
| 290 | + if [ -n "$MULTIPATHD" ] && [ "$MULTIPATHD" != "y" -a "$MULTIPATHD" != "n" ]; then | ||
| 291 | + echo "--with_multipathd must be either 'y' or 'n'" | ||
| 292 | + exit 1 | ||
| 293 | + fi | ||
| 294 | + if [ "$ENABLE" = 2 -a -z "$HAVE_OUTFILE" ]; then | ||
| 295 | + echo "Because --allow makes changes that cannot be automatically reversed," | ||
| 296 | + echo "you must set --outfile when you set --allow" | ||
| 297 | + exit 1 | ||
| 298 | + fi | ||
| 299 | +} | ||
| 300 | + | ||
| 301 | +function add_blacklist_exceptions | ||
| 302 | +{ | ||
| 303 | + INDEX=0 | ||
| 304 | + while [ "$INDEX" -lt "$WWIDS" ] ; do | ||
| 305 | + sed -i '/^blacklist_exceptions[[:space:]]*{/ a\ | ||
| 306 | + wwid '"\"${WWID_LIST[$INDEX]}\""' | ||
| 307 | +' $TMPFILE | ||
| 308 | + ((INDEX++)) | ||
| 309 | + done | ||
| 310 | +} | ||
| 311 | + | ||
| 312 | +umask 0077 | ||
| 313 | + | ||
| 314 | +parse_args "$@" | ||
| 315 | + | ||
| 316 | +validate_args | ||
| 317 | + | ||
| 318 | +if [ ! -d "$MULTIPATHDIR" ]; then | ||
| 319 | + echo "/etc/multipath/ does not exist. failing" | ||
| 320 | + exit 1 | ||
| 321 | +fi | ||
| 322 | + | ||
| 323 | +rm $TMPFILE 2> /dev/null | ||
| 324 | +echo "$DEFAULT_CONFIG" > $TMPFILE | ||
| 325 | +if [ -f "$CONFIGFILE" ]; then | ||
| 326 | + cp $CONFIGFILE $TMPFILE | ||
| 327 | +fi | ||
| 328 | + | ||
| 329 | +if grep -q "^blacklist[[:space:]]*{" $TMPFILE ; then | ||
| 330 | + HAVE_BLACKLIST=1 | ||
| 331 | +fi | ||
| 332 | + | ||
| 333 | +if grep -q "^blacklist_exceptions[[:space:]]*{" $TMPFILE ; then | ||
| 334 | + HAVE_EXCEPTIONS=1 | ||
| 335 | +fi | ||
| 336 | + | ||
| 337 | +if grep -q "^defaults[[:space:]]*{" $TMPFILE ; then | ||
| 338 | + HAVE_DEFAULTS=1 | ||
| 339 | +fi | ||
| 340 | + | ||
| 341 | +if [ -z "$MODULE" -o "$MODULE" = "y" ]; then | ||
| 342 | + if lsmod | grep -q "dm_multipath" ; then | ||
| 343 | + HAVE_MODULE=1 | ||
| 344 | + else | ||
| 345 | + HAVE_MODULE=0 | ||
| 346 | + fi | ||
| 347 | +fi | ||
| 348 | + | ||
| 349 | +if [ "$MULTIPATHD" = "y" ]; then | ||
| 350 | + if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then | ||
| 351 | + HAVE_MULTIPATHD=1 | ||
| 352 | + else | ||
| 353 | + HAVE_MULTIPATHD=0 | ||
| 354 | + fi | ||
| 355 | +fi | ||
| 356 | + | ||
| 357 | +if [ "$HAVE_BLACKLIST" = "1" ]; then | ||
| 358 | + if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then | ||
| 359 | + HAVE_DISABLE=1 | ||
| 360 | + elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"" ; then | ||
| 361 | + HAVE_DISABLE=0 | ||
| 362 | + fi | ||
| 363 | +fi | ||
| 364 | + | ||
| 365 | +if [ "$HAVE_BLACKLIST" = "1" ]; then | ||
| 366 | + if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid \"\.\?\*\"" ; then | ||
| 367 | + HAVE_WWID_DISABLE=1 | ||
| 368 | + elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"" ; then | ||
| 369 | + HAVE_WWID_DISABLE=0 | ||
| 370 | + fi | ||
| 371 | +fi | ||
| 372 | + | ||
| 373 | +if [ "$HAVE_DEFAULTS" = "1" ]; then | ||
| 374 | + if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)" ; then | ||
| 375 | + HAVE_FIND=1 | ||
| 376 | + elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)" ; then | ||
| 377 | + HAVE_FIND=0 | ||
| 378 | + fi | ||
| 379 | + if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)" ; then | ||
| 380 | + HAVE_FRIENDLY=1 | ||
| 381 | + elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)" ; then | ||
| 382 | + HAVE_FRIENDLY=0 | ||
| 383 | + fi | ||
| 384 | +fi | ||
| 385 | + | ||
| 386 | +if [ -n "$SHOW_STATUS" ]; then | ||
| 387 | + if [ -z "$HAVE_DISABLE" -o "$HAVE_DISABLE" = 0 ]; then | ||
| 388 | + echo "multipath is enabled" | ||
| 389 | + else | ||
| 390 | + echo "multipath is disabled" | ||
| 391 | + fi | ||
| 392 | + if [ -z "$HAVE_FIND" -o "$HAVE_FIND" = 0 ]; then | ||
| 393 | + echo "find_multipaths is disabled" | ||
| 394 | + else | ||
| 395 | + echo "find_multipaths is enabled" | ||
| 396 | + fi | ||
| 397 | + if [ -z "$HAVE_FRIENDLY" -o "$HAVE_FRIENDLY" = 0 ]; then | ||
| 398 | + echo "user_friendly_names is disabled" | ||
| 399 | + else | ||
| 400 | + echo "user_friendly_names is enabled" | ||
| 401 | + fi | ||
| 402 | + if [ -n "$HAVE_MODULE" ]; then | ||
| 403 | + if [ "$HAVE_MODULE" = 1 ]; then | ||
| 404 | + echo "dm_multipath module is loaded" | ||
| 405 | + else | ||
| 406 | + echo "dm_multipath module is not loaded" | ||
| 407 | + fi | ||
| 408 | + fi | ||
| 409 | + if [ -z "$HAVE_MULTIPATHD" ]; then | ||
| 410 | + if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then | ||
| 411 | + HAVE_MULTIPATHD=1 | ||
| 412 | + else | ||
| 413 | + HAVE_MULTIPATHD=0 | ||
| 414 | + fi | ||
| 415 | + fi | ||
| 416 | + if [ "$HAVE_MULTIPATHD" = 1 ]; then | ||
| 417 | + echo "multipathd is running" | ||
| 418 | + else | ||
| 419 | + echo "multipathd is not running" | ||
| 420 | + fi | ||
| 421 | + exit 0 | ||
| 422 | +fi | ||
| 423 | + | ||
| 424 | +if [ -z "$HAVE_BLACKLIST" ]; then | ||
| 425 | + cat >> $TMPFILE <<- _EOF_ | ||
| 426 | + | ||
| 427 | +blacklist { | ||
| 428 | +} | ||
| 429 | +_EOF_ | ||
| 430 | +fi | ||
| 431 | + | ||
| 432 | +if [ -z "$HAVE_DEFAULTS" ]; then | ||
| 433 | + cat >> $TMPFILE <<- _EOF_ | ||
| 434 | + | ||
| 435 | +defaults { | ||
| 436 | +} | ||
| 437 | +_EOF_ | ||
| 438 | +fi | ||
| 439 | + | ||
| 440 | +if [ "$ENABLE" = 2 ]; then | ||
| 441 | + if [ "$HAVE_DISABLE" = 1 ]; then | ||
| 442 | + sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE | ||
| 443 | + fi | ||
| 444 | + if [ -z "$HAVE_WWID_DISABLE" ]; then | ||
| 445 | + sed -i '/^blacklist[[:space:]]*{/ a\ | ||
| 446 | + wwid ".*" | ||
| 447 | +' $TMPFILE | ||
| 448 | + elif [ "$HAVE_WWID_DISABLE" = 0 ]; then | ||
| 449 | + sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/ wwid ".*"/' $TMPFILE | ||
| 450 | + fi | ||
| 451 | + if [ "$HAVE_EXCEPTIONS" = 1 ]; then | ||
| 452 | + sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ {/^[[:space:]]*wwid/ d}' $TMPFILE | ||
| 453 | + else | ||
| 454 | + cat >> $TMPFILE <<- _EOF_ | ||
| 455 | + | ||
| 456 | +blacklist_exceptions { | ||
| 457 | +} | ||
| 458 | +_EOF_ | ||
| 459 | + fi | ||
| 460 | + add_blacklist_exceptions | ||
| 461 | +elif [ "$ENABLE" = 1 ]; then | ||
| 462 | + if [ "$HAVE_DISABLE" = 1 ]; then | ||
| 463 | + sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE | ||
| 464 | + fi | ||
| 465 | +elif [ "$ENABLE" = 0 ]; then | ||
| 466 | + if [ -z "$HAVE_DISABLE" ]; then | ||
| 467 | + sed -i '/^blacklist[[:space:]]*{/ a\ | ||
| 468 | + devnode ".*" | ||
| 469 | +' $TMPFILE | ||
| 470 | + elif [ "$HAVE_DISABLE" = 0 ]; then | ||
| 471 | + sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE | ||
| 472 | + fi | ||
| 473 | +fi | ||
| 474 | + | ||
| 475 | +if [ "$FIND" = "n" ]; then | ||
| 476 | + if [ "$HAVE_FIND" = 1 ]; then | ||
| 477 | + sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)/ find_multipaths no/' $TMPFILE | ||
| 478 | + CHANGED_CONFIG=1 | ||
| 479 | + fi | ||
| 480 | +elif [ "$FIND" = "y" ]; then | ||
| 481 | + if [ -z "$HAVE_FIND" ]; then | ||
| 482 | + sed -i '/^defaults[[:space:]]*{/ a\ | ||
| 483 | + find_multipaths yes | ||
| 484 | +' $TMPFILE | ||
| 485 | + CHANGED_CONFIG=1 | ||
| 486 | + elif [ "$HAVE_FIND" = 0 ]; then | ||
| 487 | + sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)/ find_multipaths yes/' $TMPFILE | ||
| 488 | + CHANGED_CONFIG=1 | ||
| 489 | + fi | ||
| 490 | +fi | ||
| 491 | + | ||
| 492 | +if [ "$FRIENDLY" = "n" ]; then | ||
| 493 | + if [ "$HAVE_FRIENDLY" = 1 ]; then | ||
| 494 | + sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)/ user_friendly_names no/' $TMPFILE | ||
| 495 | + CHANGED_CONFIG=1 | ||
| 496 | + fi | ||
| 497 | +elif [ "$FRIENDLY" = "y" ]; then | ||
| 498 | + if [ -z "$HAVE_FRIENDLY" ]; then | ||
| 499 | + sed -i '/^defaults[[:space:]]*{/ a\ | ||
| 500 | + user_friendly_names yes | ||
| 501 | +' $TMPFILE | ||
| 502 | + CHANGED_CONFIG=1 | ||
| 503 | + elif [ "$HAVE_FRIENDLY" = 0 ]; then | ||
| 504 | + sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)/ user_friendly_names yes/' $TMPFILE | ||
| 505 | + CHANGED_CONFIG=1 | ||
| 506 | + fi | ||
| 507 | +fi | ||
| 508 | + | ||
| 509 | +if [ -f "$OUTPUTFILE" ]; then | ||
| 510 | + cp $OUTPUTFILE $OUTPUTFILE.old | ||
| 511 | + if [ $? != 0 ]; then | ||
| 512 | + echo "failed to backup old config file, $OUTPUTFILE not updated" | ||
| 513 | + exit 1 | ||
| 514 | + fi | ||
| 515 | +fi | ||
| 516 | + | ||
| 517 | +cp $TMPFILE $OUTPUTFILE | ||
| 518 | +if [ $? != 0 ]; then | ||
| 519 | + echo "failed to copy new config file into place, check $OUTPUTFILE is still OK" | ||
| 520 | + exit 1 | ||
| 521 | +fi | ||
| 522 | + | ||
| 523 | +rm -f $TMPFILE | ||
| 524 | + | ||
| 525 | +if [ "$ENABLE" = 1 ]; then | ||
| 526 | + if [ "$HAVE_MODULE" = 0 ]; then | ||
| 527 | + modprobe dm_multipath | ||
| 528 | + fi | ||
| 529 | + if [ "$HAVE_MULTIPATHD" = 0 ]; then | ||
| 530 | + systemctl start multipathd.service | ||
| 531 | + fi | ||
| 532 | +elif [ "$ENABLE" = 0 ]; then | ||
| 533 | + if [ "$HAVE_MULTIPATHD" = 1 ]; then | ||
| 534 | + systemctl stop multipathd.service | ||
| 535 | + fi | ||
| 536 | +elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then | ||
| 537 | + systemctl reload multipathd.service | ||
| 538 | +fi | ||
| 539 | diff --git a/multipath/mpathconf.8 b/multipath/mpathconf.8 | ||
| 540 | new file mode 100644 | ||
| 541 | index 0000000..4cd3267 | ||
| 542 | --- /dev/null | ||
| 543 | +++ b/multipath/mpathconf.8 | ||
| 544 | @@ -0,0 +1,101 @@ | ||
| 545 | +.TH MPATHCONF 8 "June 2010" "" "Linux Administrator's Manual" | ||
| 546 | +.SH NAME | ||
| 547 | +mpathconf - A tool for configuring device-mapper-multipath | ||
| 548 | +.SH SYNOPSIS | ||
| 549 | +.B mpathconf | ||
| 550 | +.RB [\| commands \|] | ||
| 551 | +.RB [\| options \|] | ||
| 552 | +.SH DESCRIPTION | ||
| 553 | +.B mpathconf | ||
| 554 | +is a utility that creates or modifies | ||
| 555 | +.B /etc/multipath.conf. | ||
| 556 | +It can enable or disable multipathing and configure some common options. | ||
| 557 | +.B mpathconf | ||
| 558 | +can also load the | ||
| 559 | +.B dm_multipath | ||
| 560 | +module, start and stop the | ||
| 561 | +.B multipathd | ||
| 562 | +daemon, and configure the | ||
| 563 | +.B multipathd | ||
| 564 | +service to start automatically or not. If | ||
| 565 | +.B mpathconf | ||
| 566 | +is called with no commands, it will display the current configuration. | ||
| 567 | + | ||
| 568 | +The default options for mpathconf are | ||
| 569 | +.B --with_module | ||
| 570 | +The | ||
| 571 | +.B --with_multipathd | ||
| 572 | +option is not set by default. Enabling multipathing will load the | ||
| 573 | +.B dm_multipath | ||
| 574 | +module but it will not immediately start it. This is so | ||
| 575 | +that users can manually edit their config file if necessary, before starting | ||
| 576 | +.B multipathd. | ||
| 577 | + | ||
| 578 | +If | ||
| 579 | +.B /etc/multipath.conf | ||
| 580 | +already exists, mpathconf will edit it. If it does not exist, mpathconf will | ||
| 581 | +create a default file with | ||
| 582 | +.B user_friendly_names | ||
| 583 | +and | ||
| 584 | +.B find_multipaths | ||
| 585 | +set. To disable these, use the | ||
| 586 | +.B --user_friendly_names n | ||
| 587 | +and | ||
| 588 | +.B --find_multipaths n | ||
| 589 | +options | ||
| 590 | +.SH COMMANDS | ||
| 591 | +.TP | ||
| 592 | +.B --enable | ||
| 593 | +Removes any line that blacklists all device nodes from the | ||
| 594 | +.B /etc/multipath.conf | ||
| 595 | +blacklist section. | ||
| 596 | +.TP | ||
| 597 | +.B --disable | ||
| 598 | +Adds a line that blacklists all device nodes to the | ||
| 599 | +.B /etc/multipath.conf | ||
| 600 | +blacklist section. If no blacklist section exists, it will create one. | ||
| 601 | +.TP | ||
| 602 | +.B --user_friendly_name \fP { \fBy\fP | \fBn\fP } | ||
| 603 | +If set to \fBy\fP, this adds the line | ||
| 604 | +.B user_friendly_names yes | ||
| 605 | +to the | ||
| 606 | +.B /etc/multipath.conf | ||
| 607 | +defaults section. If set to \fBn\fP, this removes the line, if present. This | ||
| 608 | +command can be used along with any other command. | ||
| 609 | +.TP | ||
| 610 | +.B --find_multipaths\fP { \fBy\fP | \fBn\fP } | ||
| 611 | +If set to \fBy\fP, this adds the line | ||
| 612 | +.B find_multipaths yes | ||
| 613 | +to the | ||
| 614 | +.B /etc/multipath.conf | ||
| 615 | +defaults section. If set to \fBn\fP, this removes the line, if present. This | ||
| 616 | +command can be used aldong with any other command. | ||
| 617 | +.SH OPTIONS | ||
| 618 | +.TP | ||
| 619 | +.B --with_module\fP { \fBy\fP | \fBn\fP } | ||
| 620 | +If set to \fBy\fP, this runs | ||
| 621 | +.B modprobe dm_multipath | ||
| 622 | +to install the multipath modules. This option only works with the | ||
| 623 | +.B --enable | ||
| 624 | +command. This option is set to \fBy\fP by default. | ||
| 625 | +.TP | ||
| 626 | +.B --with_multipathd { \fBy\fP | \fBn\fP } | ||
| 627 | +If set to \fBy\fP, this runs | ||
| 628 | +.B service multipathd start | ||
| 629 | +to start the multipathd daemon on \fB--enable\fP, | ||
| 630 | +.B service multipathd stop | ||
| 631 | +to stop the multipathd daemon on \fB--disable\fP, and | ||
| 632 | +.B service multipathd reload | ||
| 633 | +to reconfigure multipathd on \fB--user_frindly_names\fP and | ||
| 634 | +\fB--find_multipaths\fP. | ||
| 635 | +This option is set to \fBn\fP by default. | ||
| 636 | +.SH FILES | ||
| 637 | +.BR /etc/multipath.conf | ||
| 638 | +.SH "SEE ALSO" | ||
| 639 | +.BR multipath.conf (5), | ||
| 640 | +.BR modprobe (8), | ||
| 641 | +.BR multipath (8), | ||
| 642 | +.BR multipathd (8), | ||
| 643 | +.BR service (8), | ||
| 644 | +.SH AUTHOR | ||
| 645 | +Benjamin Marzinski <bmarzins@redhat.com> | ||
| 646 | -- | ||
| 647 | 2.8.1 | ||
| 648 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0006-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch b/meta-oe/recipes-support/multipath-tools/files/0006-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch new file mode 100644 index 0000000000..dc291b8128 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0006-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch | |||
| @@ -0,0 +1,166 @@ | |||
| 1 | From 15179c830521d8f37f9254ebc6bbf150a409f956 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Fri, 17 Oct 2014 11:20:34 -0500 | ||
| 4 | Subject: [PATCH 06/14] RH: add wwids from kernel cmdline mpath.wwids with -A | ||
| 5 | |||
| 6 | This patch adds another option to multipath, "-A", which reads | ||
| 7 | /proc/cmdline for mpath.wwid=<WWID> options, and adds any wwids it finds | ||
| 8 | to /etc/multipath/wwids. While this isn't usually important during | ||
| 9 | normal operation, since these wwids should already be added, it can be | ||
| 10 | helpful during installation, to make sure that multipath can claim | ||
| 11 | devices as its own, before LVM or something else makes use of them. The | ||
| 12 | patch also execs "/sbin/multipath -A" before running multipathd in | ||
| 13 | multipathd.service | ||
| 14 | |||
| 15 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 16 | --- | ||
| 17 | libmultipath/wwids.c | 44 +++++++++++++++++++++++++++++++++++++++++++ | ||
| 18 | libmultipath/wwids.h | 1 + | ||
| 19 | multipath/main.c | 10 ++++++++-- | ||
| 20 | multipath/multipath.8 | 5 ++++- | ||
| 21 | multipathd/multipathd.service | 1 + | ||
| 22 | 5 files changed, 58 insertions(+), 3 deletions(-) | ||
| 23 | |||
| 24 | diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c | ||
| 25 | index bc70a27..88bb72b 100644 | ||
| 26 | --- a/libmultipath/wwids.c | ||
| 27 | +++ b/libmultipath/wwids.c | ||
| 28 | @@ -321,3 +321,47 @@ remember_wwid(char *wwid) | ||
| 29 | condlog(4, "wwid %s already in wwids file", wwid); | ||
| 30 | return 0; | ||
| 31 | } | ||
| 32 | + | ||
| 33 | +int remember_cmdline_wwid(void) | ||
| 34 | +{ | ||
| 35 | + FILE *f = NULL; | ||
| 36 | + char buf[LINE_MAX], *next, *ptr; | ||
| 37 | + int ret = 0; | ||
| 38 | + | ||
| 39 | + f = fopen("/proc/cmdline", "re"); | ||
| 40 | + if (!f) { | ||
| 41 | + condlog(0, "can't open /proc/cmdline : %s", strerror(errno)); | ||
| 42 | + return -1; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + if (!fgets(buf, sizeof(buf), f)) { | ||
| 46 | + if (ferror(f)) | ||
| 47 | + condlog(0, "read of /proc/cmdline failed : %s", | ||
| 48 | + strerror(errno)); | ||
| 49 | + else | ||
| 50 | + condlog(0, "couldn't read /proc/cmdline"); | ||
| 51 | + fclose(f); | ||
| 52 | + return -1; | ||
| 53 | + } | ||
| 54 | + fclose(f); | ||
| 55 | + next = buf; | ||
| 56 | + while((ptr = strstr(next, "mpath.wwid="))) { | ||
| 57 | + ptr += 11; | ||
| 58 | + next = strpbrk(ptr, " \t\n"); | ||
| 59 | + if (next) { | ||
| 60 | + *next = '\0'; | ||
| 61 | + next++; | ||
| 62 | + } | ||
| 63 | + if (strlen(ptr)) { | ||
| 64 | + if (remember_wwid(ptr) != 0) | ||
| 65 | + ret = -1; | ||
| 66 | + } | ||
| 67 | + else { | ||
| 68 | + condlog(0, "empty mpath.wwid kernel command line option"); | ||
| 69 | + ret = -1; | ||
| 70 | + } | ||
| 71 | + if (!next) | ||
| 72 | + break; | ||
| 73 | + } | ||
| 74 | + return ret; | ||
| 75 | +} | ||
| 76 | diff --git a/libmultipath/wwids.h b/libmultipath/wwids.h | ||
| 77 | index 9527012..b665232 100644 | ||
| 78 | --- a/libmultipath/wwids.h | ||
| 79 | +++ b/libmultipath/wwids.h | ||
| 80 | @@ -17,5 +17,6 @@ int remember_wwid(char *wwid); | ||
| 81 | int check_wwids_file(char *wwid, int write_wwid); | ||
| 82 | int remove_wwid(char *wwid); | ||
| 83 | int replace_wwids(vector mp); | ||
| 84 | +int remember_cmdline_wwid(void); | ||
| 85 | |||
| 86 | #endif /* _WWIDS_H */ | ||
| 87 | diff --git a/multipath/main.c b/multipath/main.c | ||
| 88 | index 4174d43..72585b0 100644 | ||
| 89 | --- a/multipath/main.c | ||
| 90 | +++ b/multipath/main.c | ||
| 91 | @@ -102,7 +102,7 @@ usage (char * progname) | ||
| 92 | { | ||
| 93 | fprintf (stderr, VERSION_STRING); | ||
| 94 | fprintf (stderr, "Usage:\n"); | ||
| 95 | - fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-r] [-i] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); | ||
| 96 | + fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-r] [-i] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); | ||
| 97 | fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [-R num] [dev]\n", progname); | ||
| 98 | fprintf (stderr, " %s -F [-v lvl] [-R num]\n", progname); | ||
| 99 | fprintf (stderr, " %s -t\n", progname); | ||
| 100 | @@ -116,6 +116,8 @@ usage (char * progname) | ||
| 101 | " -f flush a multipath device map\n" | ||
| 102 | " -F flush all multipath device maps\n" | ||
| 103 | " -a add a device wwid to the wwids file\n" | ||
| 104 | + " -A add devices from kernel command line mpath.wwids\n" | ||
| 105 | + " parameters to wwids file\n" | ||
| 106 | " -c check if a device should be a path in a multipath device\n" | ||
| 107 | " -q allow queue_if_no_path when multipathd is not running\n" | ||
| 108 | " -d dry run, do not create or update devmaps\n" | ||
| 109 | @@ -522,7 +524,7 @@ main (int argc, char *argv[]) | ||
| 110 | exit(1); | ||
| 111 | multipath_conf = conf; | ||
| 112 | conf->retrigger_tries = 0; | ||
| 113 | - while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrR:itquwW")) != EOF ) { | ||
| 114 | + while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrR:itquwW")) != EOF ) { | ||
| 115 | switch(arg) { | ||
| 116 | case 1: printf("optarg : %s\n",optarg); | ||
| 117 | break; | ||
| 118 | @@ -586,6 +588,10 @@ main (int argc, char *argv[]) | ||
| 119 | case 't': | ||
| 120 | r = dump_config(conf); | ||
| 121 | goto out_free_config; | ||
| 122 | + case 'A': | ||
| 123 | + if (remember_cmdline_wwid() != 0) | ||
| 124 | + exit(1); | ||
| 125 | + exit(0); | ||
| 126 | case 'h': | ||
| 127 | usage(argv[0]); | ||
| 128 | exit(0); | ||
| 129 | diff --git a/multipath/multipath.8 b/multipath/multipath.8 | ||
| 130 | index b9436e5..b9ad6b1 100644 | ||
| 131 | --- a/multipath/multipath.8 | ||
| 132 | +++ b/multipath/multipath.8 | ||
| 133 | @@ -25,7 +25,7 @@ multipath \- Device mapper target autoconfig. | ||
| 134 | .RB [\| \-b\ \c | ||
| 135 | .IR bindings_file \|] | ||
| 136 | .RB [\| \-d \|] | ||
| 137 | -.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \|-i | \-a | \|-u | \-w | \-W \|] | ||
| 138 | +.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \|-i | \-a | \-A | \-u | \-w | \-W \|] | ||
| 139 | .RB [\| \-p\ \c | ||
| 140 | .IR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|] | ||
| 141 | .RB [\| \-R\ \c | ||
| 142 | @@ -122,6 +122,9 @@ Add the WWID for the specified device to the WWIDs file. | ||
| 143 | Check if the device specified in the program environment should be | ||
| 144 | a path in a multipath device. | ||
| 145 | . | ||
| 146 | +.B \-A | ||
| 147 | +add wwids from any kernel command line mpath.wwid parameters to the wwids file | ||
| 148 | +. | ||
| 149 | .TP | ||
| 150 | .B \-w | ||
| 151 | Remove the WWID for the specified device from the WWIDs file. | ||
| 152 | diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service | ||
| 153 | index fafd088..a623a3f 100644 | ||
| 154 | --- a/multipathd/multipathd.service | ||
| 155 | +++ b/multipathd/multipathd.service | ||
| 156 | @@ -15,6 +15,7 @@ Type=notify | ||
| 157 | NotifyAccess=main | ||
| 158 | LimitCORE=infinity | ||
| 159 | ExecStartPre=-/sbin/modprobe -a scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm-multipath | ||
| 160 | +ExecStartPre=-/sbin/multipath -A | ||
| 161 | ExecStart=/sbin/multipathd -d -s | ||
| 162 | ExecReload=/sbin/multipathd reconfigure | ||
| 163 | |||
| 164 | -- | ||
| 165 | 2.8.1 | ||
| 166 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0007-RH-trigger-change-uevent-on-new-device-creation.patch b/meta-oe/recipes-support/multipath-tools/files/0007-RH-trigger-change-uevent-on-new-device-creation.patch new file mode 100644 index 0000000000..025a3512e3 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0007-RH-trigger-change-uevent-on-new-device-creation.patch | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | From 0d2c9afbd89d79fd700f9c99aa20e5f7c7382027 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Mon, 24 Apr 2017 09:39:57 -0500 | ||
| 4 | Subject: [PATCH 07/14] RH: trigger change uevent on new device creation | ||
| 5 | |||
| 6 | When multipath first sees a path device with user_friendly names | ||
| 7 | enabled, it can't know if the device should be multipathed. This means | ||
| 8 | that it will not claim the device in udev. If the device is eventually | ||
| 9 | multipathed, multipath should trigger a change uevent to update the udev | ||
| 10 | database to claim the device. | ||
| 11 | |||
| 12 | This also reverts commit 64e27ec066a001012f44550f095c93443e91d845. | ||
| 13 | |||
| 14 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 15 | --- | ||
| 16 | libmultipath/configure.c | 26 ++++++++++++++++++++++++-- | ||
| 17 | libmultipath/configure.h | 1 + | ||
| 18 | libmultipath/wwids.c | 4 ++-- | ||
| 19 | multipath/main.c | 2 +- | ||
| 20 | multipathd/main.c | 7 ++----- | ||
| 21 | 5 files changed, 30 insertions(+), 10 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/libmultipath/configure.c b/libmultipath/configure.c | ||
| 24 | index bd090d9..843dd09 100644 | ||
| 25 | --- a/libmultipath/configure.c | ||
| 26 | +++ b/libmultipath/configure.c | ||
| 27 | @@ -422,6 +422,28 @@ trigger_udev_change(const struct multipath *mpp) | ||
| 28 | udev_device_unref(udd); | ||
| 29 | } | ||
| 30 | |||
| 31 | +void | ||
| 32 | +trigger_paths_udev_change(const struct multipath *mpp) | ||
| 33 | +{ | ||
| 34 | + struct pathgroup * pgp; | ||
| 35 | + struct path * pp; | ||
| 36 | + int i, j; | ||
| 37 | + | ||
| 38 | + if (!mpp || !mpp->pg) | ||
| 39 | + return; | ||
| 40 | + | ||
| 41 | + vector_foreach_slot (mpp->pg, pgp, i) { | ||
| 42 | + if (!pgp->paths) | ||
| 43 | + continue; | ||
| 44 | + vector_foreach_slot(pgp->paths, pp, j) { | ||
| 45 | + if (!pp->udev) | ||
| 46 | + continue; | ||
| 47 | + sysfs_attr_set_value(pp->udev, "uevent", "change", | ||
| 48 | + strlen("change")); | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | static int | ||
| 54 | is_mpp_known_to_udev(const struct multipath *mpp) | ||
| 55 | { | ||
| 56 | @@ -802,8 +824,8 @@ int domap(struct multipath *mpp, char *params, int is_daemon) | ||
| 57 | * succeeded | ||
| 58 | */ | ||
| 59 | mpp->force_udev_reload = 0; | ||
| 60 | - if (mpp->action == ACT_CREATE) | ||
| 61 | - remember_wwid(mpp->wwid); | ||
| 62 | + if (mpp->action == ACT_CREATE && remember_wwid(mpp->wwid) == 1) | ||
| 63 | + trigger_paths_udev_change(mpp); | ||
| 64 | if (!is_daemon) { | ||
| 65 | /* multipath client mode */ | ||
| 66 | dm_switchgroup(mpp->alias, mpp->bestpg); | ||
| 67 | diff --git a/libmultipath/configure.h b/libmultipath/configure.h | ||
| 68 | index fd7f581..253e29b 100644 | ||
| 69 | --- a/libmultipath/configure.h | ||
| 70 | +++ b/libmultipath/configure.h | ||
| 71 | @@ -36,3 +36,4 @@ int get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type, | ||
| 72 | vector pathvec, char **wwid); | ||
| 73 | int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh, int is_daemon); | ||
| 74 | int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name); | ||
| 75 | +void trigger_paths_udev_change(const struct multipath *mpp); | ||
| 76 | diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c | ||
| 77 | index 88bb72b..249c6c1 100644 | ||
| 78 | --- a/libmultipath/wwids.c | ||
| 79 | +++ b/libmultipath/wwids.c | ||
| 80 | @@ -319,7 +319,7 @@ remember_wwid(char *wwid) | ||
| 81 | condlog(3, "wrote wwid %s to wwids file", wwid); | ||
| 82 | else | ||
| 83 | condlog(4, "wwid %s already in wwids file", wwid); | ||
| 84 | - return 0; | ||
| 85 | + return ret; | ||
| 86 | } | ||
| 87 | |||
| 88 | int remember_cmdline_wwid(void) | ||
| 89 | @@ -353,7 +353,7 @@ int remember_cmdline_wwid(void) | ||
| 90 | next++; | ||
| 91 | } | ||
| 92 | if (strlen(ptr)) { | ||
| 93 | - if (remember_wwid(ptr) != 0) | ||
| 94 | + if (remember_wwid(ptr) < 0) | ||
| 95 | ret = -1; | ||
| 96 | } | ||
| 97 | else { | ||
| 98 | diff --git a/multipath/main.c b/multipath/main.c | ||
| 99 | index 72585b0..2eda6a3 100644 | ||
| 100 | --- a/multipath/main.c | ||
| 101 | +++ b/multipath/main.c | ||
| 102 | @@ -336,7 +336,7 @@ configure (struct config *conf, enum mpath_cmds cmd, | ||
| 103 | } | ||
| 104 | if (cmd == CMD_ADD_WWID) { | ||
| 105 | r = remember_wwid(refwwid); | ||
| 106 | - if (r == 0) | ||
| 107 | + if (r >= 0) | ||
| 108 | printf("wwid '%s' added\n", refwwid); | ||
| 109 | else | ||
| 110 | printf("failed adding '%s' to wwids file\n", | ||
| 111 | diff --git a/multipathd/main.c b/multipathd/main.c | ||
| 112 | index 81c76ca..874bcce 100644 | ||
| 113 | --- a/multipathd/main.c | ||
| 114 | +++ b/multipathd/main.c | ||
| 115 | @@ -2093,7 +2093,8 @@ configure (struct vectors * vecs, int start_waiters) | ||
| 116 | |||
| 117 | sync_maps_state(mpvec); | ||
| 118 | vector_foreach_slot(mpvec, mpp, i){ | ||
| 119 | - remember_wwid(mpp->wwid); | ||
| 120 | + if (remember_wwid(mpp->wwid) == 1) | ||
| 121 | + trigger_paths_udev_change(mpp); | ||
| 122 | update_map_pr(mpp); | ||
| 123 | } | ||
| 124 | |||
| 125 | @@ -2175,10 +2176,6 @@ reconfigure (struct vectors * vecs) | ||
| 126 | conf->verbosity = verbosity; | ||
| 127 | if (bindings_read_only) | ||
| 128 | conf->bindings_read_only = bindings_read_only; | ||
| 129 | - if (conf->find_multipaths) { | ||
| 130 | - condlog(2, "find_multipaths is set: -n is implied"); | ||
| 131 | - ignore_new_devs = 1; | ||
| 132 | - } | ||
| 133 | if (ignore_new_devs) | ||
| 134 | conf->ignore_new_devs = ignore_new_devs; | ||
| 135 | uxsock_timeout = conf->uxsock_timeout; | ||
| 136 | -- | ||
| 137 | 2.8.1 | ||
| 138 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0008-libmultipath-change-how-RADOS-checker-is-enabled.patch b/meta-oe/recipes-support/multipath-tools/files/0008-libmultipath-change-how-RADOS-checker-is-enabled.patch new file mode 100644 index 0000000000..f678809931 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0008-libmultipath-change-how-RADOS-checker-is-enabled.patch | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | From 0be174dbedd861d7694b0c7799fe26be31eb32b0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Fri, 26 May 2017 17:52:57 -0500 | ||
| 4 | Subject: [PATCH 08/14] libmultipath: change how RADOS checker is enabled | ||
| 5 | |||
| 6 | Instead of making the user call "make", "make install" and "make clean" | ||
| 7 | with ENABLE_RADOS set correctly, have the makefile check if | ||
| 8 | /usr/include/rados/librados.h exists, just like it checks if specific | ||
| 9 | functions exist in a file. | ||
| 10 | |||
| 11 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 12 | --- | ||
| 13 | Makefile.inc | 13 +++++++++++++ | ||
| 14 | libmultipath/checkers/Makefile | 3 ++- | ||
| 15 | 2 files changed, 15 insertions(+), 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/Makefile.inc b/Makefile.inc | ||
| 18 | index 2591fa9..e084fd1 100644 | ||
| 19 | --- a/Makefile.inc | ||
| 20 | +++ b/Makefile.inc | ||
| 21 | @@ -109,5 +109,18 @@ check_func = \ | ||
| 22 | echo "$$found" \ | ||
| 23 | ) | ||
| 24 | |||
| 25 | +# Checker whether a file with name $1 exists | ||
| 26 | +check_file = $(shell \ | ||
| 27 | + if [ -f "$1" ]; then \ | ||
| 28 | + found=1; \ | ||
| 29 | + status="yes"; \ | ||
| 30 | + else \ | ||
| 31 | + found=0; \ | ||
| 32 | + status="no"; \ | ||
| 33 | + fi; \ | ||
| 34 | + echo 1>&2 "Checking if $1 exists ... $$status"; \ | ||
| 35 | + echo "$$found" \ | ||
| 36 | + ) | ||
| 37 | + | ||
| 38 | %.o: %.c | ||
| 39 | $(CC) $(CFLAGS) -c -o $@ $< | ||
| 40 | diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile | ||
| 41 | index 732ca9d..bce6b8b 100644 | ||
| 42 | --- a/libmultipath/checkers/Makefile | ||
| 43 | +++ b/libmultipath/checkers/Makefile | ||
| 44 | @@ -14,7 +14,8 @@ LIBS= \ | ||
| 45 | libcheckemc_clariion.so \ | ||
| 46 | libcheckhp_sw.so \ | ||
| 47 | libcheckrdac.so | ||
| 48 | -ifneq ($(ENABLE_RADOS),0) | ||
| 49 | + | ||
| 50 | +ifneq ($(call check_file,/usr/include/rados/librados.h),0) | ||
| 51 | LIBS += libcheckrbd.so | ||
| 52 | endif | ||
| 53 | |||
| 54 | -- | ||
| 55 | 2.8.1 | ||
| 56 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0009-multipath-set-verbosity-to-default-during-config.patch b/meta-oe/recipes-support/multipath-tools/files/0009-multipath-set-verbosity-to-default-during-config.patch new file mode 100644 index 0000000000..17d2d91796 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0009-multipath-set-verbosity-to-default-during-config.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | From 526e539628e051128abf46a60ec22e18c9b5d84f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Wed, 31 May 2017 15:03:02 -0500 | ||
| 4 | Subject: [PATCH 09/14] multipath: set verbosity to default during config | ||
| 5 | |||
| 6 | condlog was setting the verbosity to 0 if there was no configuration. | ||
| 7 | This keeps multipath from printing warning messages about config file | ||
| 8 | problems that are found while loading the configuration. Instead, it | ||
| 9 | should use the default config level until it loads the configuration | ||
| 10 | to find the current value. | ||
| 11 | |||
| 12 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 13 | --- | ||
| 14 | libmultipath/debug.c | 3 ++- | ||
| 15 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/libmultipath/debug.c b/libmultipath/debug.c | ||
| 18 | index fbe171a..f89b264 100644 | ||
| 19 | --- a/libmultipath/debug.c | ||
| 20 | +++ b/libmultipath/debug.c | ||
| 21 | @@ -11,6 +11,7 @@ | ||
| 22 | #include "../third-party/valgrind/drd.h" | ||
| 23 | #include "vector.h" | ||
| 24 | #include "config.h" | ||
| 25 | +#include "defaults.h" | ||
| 26 | |||
| 27 | void dlog (int sink, int prio, const char * fmt, ...) | ||
| 28 | { | ||
| 29 | @@ -21,7 +22,7 @@ void dlog (int sink, int prio, const char * fmt, ...) | ||
| 30 | va_start(ap, fmt); | ||
| 31 | conf = get_multipath_config(); | ||
| 32 | ANNOTATE_IGNORE_READS_BEGIN(); | ||
| 33 | - thres = (conf) ? conf->verbosity : 0; | ||
| 34 | + thres = (conf) ? conf->verbosity : DEFAULT_VERBOSITY; | ||
| 35 | ANNOTATE_IGNORE_READS_END(); | ||
| 36 | put_multipath_config(conf); | ||
| 37 | |||
| 38 | -- | ||
| 39 | 2.8.1 | ||
| 40 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0010-mpath-skip-device-configs-without-vendor-product.patch b/meta-oe/recipes-support/multipath-tools/files/0010-mpath-skip-device-configs-without-vendor-product.patch new file mode 100644 index 0000000000..396b6d32e3 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0010-mpath-skip-device-configs-without-vendor-product.patch | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | From f88d60a93e98d86ae294f2317a122c4efde276f0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Wed, 31 May 2017 17:58:59 -0500 | ||
| 4 | Subject: [PATCH 10/14] mpath: skip device configs without vendor/product | ||
| 5 | |||
| 6 | Right now if multipath.conf includes a device configuration without a | ||
| 7 | vendor or product string, it will automatically be applied to all | ||
| 8 | devices, skipping all other configs entirely. This is clearly wrong. | ||
| 9 | This patch makes sure that user added configs include vendor and | ||
| 10 | product strings | ||
| 11 | |||
| 12 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 13 | --- | ||
| 14 | libmultipath/config.c | 7 +++++++ | ||
| 15 | 1 file changed, 7 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/libmultipath/config.c b/libmultipath/config.c | ||
| 18 | index c485748..bdde113 100644 | ||
| 19 | --- a/libmultipath/config.c | ||
| 20 | +++ b/libmultipath/config.c | ||
| 21 | @@ -452,6 +452,13 @@ restart: | ||
| 22 | break; | ||
| 23 | j = n; | ||
| 24 | vector_foreach_slot_after(hw, hwe2, j) { | ||
| 25 | + /* drop invalid device configs */ | ||
| 26 | + if (!hwe2->vendor || !hwe2->product) { | ||
| 27 | + condlog(0, "device config missing vendor or product parameter"); | ||
| 28 | + vector_del_slot(hw, j--); | ||
| 29 | + free_hwe(hwe2); | ||
| 30 | + continue; | ||
| 31 | + } | ||
| 32 | if (hwe_regmatch(hwe1, hwe2)) | ||
| 33 | continue; | ||
| 34 | /* dup */ | ||
| 35 | -- | ||
| 36 | 2.8.1 | ||
| 37 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0011-multipathd-fix-show-maps-json-crash.patch b/meta-oe/recipes-support/multipath-tools/files/0011-multipathd-fix-show-maps-json-crash.patch new file mode 100644 index 0000000000..12d6d38a78 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0011-multipathd-fix-show-maps-json-crash.patch | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | From bc3ceda747104afdc24386df5dc45ca86f6c2936 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 3 | Date: Thu, 1 Jun 2017 17:52:28 -0500 | ||
| 4 | Subject: [PATCH 11/14] multipathd: fix "show maps json" crash | ||
| 5 | |||
| 6 | If there are no multipath devices, show_maps_json sets the maximum size | ||
| 7 | of the reply buffer to 0. Having a size of 0 causes the calls to calloc | ||
| 8 | and realloc to behave in ways that the code isn't designed to handle, | ||
| 9 | leading to a double-free crash. Instead, show_maps_json should just | ||
| 10 | use the INITIAL_REPLY_LEN if there are no multipath devices. | ||
| 11 | |||
| 12 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> | ||
| 13 | --- | ||
| 14 | multipathd/cli_handlers.c | 6 ++++-- | ||
| 15 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c | ||
| 18 | index 04c7386..7b0d00c 100644 | ||
| 19 | --- a/multipathd/cli_handlers.c | ||
| 20 | +++ b/multipathd/cli_handlers.c | ||
| 21 | @@ -162,10 +162,12 @@ show_maps_json (char ** r, int * len, struct vectors * vecs) | ||
| 22 | struct multipath * mpp; | ||
| 23 | char * c; | ||
| 24 | char * reply; | ||
| 25 | - unsigned int maxlen = INITIAL_REPLY_LEN * | ||
| 26 | - PRINT_JSON_MULTIPLIER * VECTOR_SIZE(vecs->mpvec); | ||
| 27 | + unsigned int maxlen = INITIAL_REPLY_LEN; | ||
| 28 | int again = 1; | ||
| 29 | |||
| 30 | + if (VECTOR_SIZE(vecs->mpvec) > 0) | ||
| 31 | + maxlen *= PRINT_JSON_MULTIPLIER * VECTOR_SIZE(vecs->mpvec); | ||
| 32 | + | ||
| 33 | vector_foreach_slot(vecs->mpvec, mpp, i) { | ||
| 34 | if (update_multipath(vecs, mpp->alias, 0)) { | ||
| 35 | return 1; | ||
| 36 | -- | ||
| 37 | 2.8.1 | ||
| 38 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0012-multipath-tools-modify-Makefile.inc-for-cross-compil.patch b/meta-oe/recipes-support/multipath-tools/files/0012-multipath-tools-modify-Makefile.inc-for-cross-compil.patch new file mode 100644 index 0000000000..5ccd4aed8b --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0012-multipath-tools-modify-Makefile.inc-for-cross-compil.patch | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | From 6864ba28dec61609662ce5dc8bc7ed1925abb546 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 3 | Date: Wed, 5 Jul 2017 02:56:13 -0400 | ||
| 4 | Subject: [PATCH 12/14] multipath-tools: modify Makefile.inc for | ||
| 5 | cross-compilation | ||
| 6 | |||
| 7 | Do not look for systemd info on the host, and allow us to pass in CFLAGS | ||
| 8 | using the OPTFLAGS variable. | ||
| 9 | |||
| 10 | Upstream-Status: Inappropriate [embedded specific] | ||
| 11 | |||
| 12 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 13 | |||
| 14 | Update for version 0.5.0-144-g770e6d0 | ||
| 15 | |||
| 16 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 17 | |||
| 18 | Update for version 0.7.1 | ||
| 19 | |||
| 20 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 21 | --- | ||
| 22 | Makefile.inc | 8 ++------ | ||
| 23 | 1 file changed, 2 insertions(+), 6 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/Makefile.inc b/Makefile.inc | ||
| 26 | index e084fd1..c7f45fa 100644 | ||
| 27 | --- a/Makefile.inc | ||
| 28 | +++ b/Makefile.inc | ||
| 29 | @@ -35,12 +35,6 @@ ifndef RUN | ||
| 30 | endif | ||
| 31 | endif | ||
| 32 | |||
| 33 | -ifndef SYSTEMD | ||
| 34 | - ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1) | ||
| 35 | - SYSTEMD = $(shell systemctl --version 2> /dev/null | sed -n 's/systemd \([0-9]*\)/\1/p') | ||
| 36 | - endif | ||
| 37 | -endif | ||
| 38 | - | ||
| 39 | ifndef SYSTEMDPATH | ||
| 40 | SYSTEMDPATH=usr/lib | ||
| 41 | endif | ||
| 42 | @@ -82,11 +76,13 @@ TEST_CC_OPTION = $(shell \ | ||
| 43 | |||
| 44 | STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector) | ||
| 45 | |||
| 46 | +ifndef OPTFLAGS | ||
| 47 | OPTFLAGS = -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int \ | ||
| 48 | -Werror=implicit-function-declaration -Werror=format-security \ | ||
| 49 | -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered \ | ||
| 50 | -Wp,-D_FORTIFY_SOURCE=2 $(STACKPROT) \ | ||
| 51 | --param=ssp-buffer-size=4 | ||
| 52 | +endif | ||
| 53 | |||
| 54 | CFLAGS = $(OPTFLAGS) -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" | ||
| 55 | BIN_CFLAGS = -fPIE -DPIE | ||
| 56 | -- | ||
| 57 | 2.8.1 | ||
| 58 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/0013-Always-use-devmapper.patch b/meta-oe/recipes-support/multipath-tools/files/0013-Always-use-devmapper.patch new file mode 100644 index 0000000000..52240f6439 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/0013-Always-use-devmapper.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | From 1498338970a093fccbda3e33f5588a289ef2c66a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 3 | Date: Wed, 5 Jul 2017 02:59:46 -0400 | ||
| 4 | Subject: [PATCH 13/14] Always use devmapper | ||
| 5 | |||
| 6 | Do not try to compute several _API_ make variables | ||
| 7 | from host information when cross-compiling. | ||
| 8 | |||
| 9 | Upstream-Status: Inappropriate [embedded specific] | ||
| 10 | |||
| 11 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
| 12 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 13 | |||
| 14 | Rebase to 0.7.1 | ||
| 15 | |||
| 16 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 17 | --- | ||
| 18 | libmultipath/Makefile | 19 ++++--------------- | ||
| 19 | 1 file changed, 4 insertions(+), 15 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/libmultipath/Makefile b/libmultipath/Makefile | ||
| 22 | index b3244fc..9006b3f 100644 | ||
| 23 | --- a/libmultipath/Makefile | ||
| 24 | +++ b/libmultipath/Makefile | ||
| 25 | @@ -20,21 +20,10 @@ ifdef SYSTEMD | ||
| 26 | endif | ||
| 27 | endif | ||
| 28 | |||
| 29 | -ifneq ($(call check_func,dm_task_no_flush,/usr/include/libdevmapper.h),0) | ||
| 30 | - CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE | ||
| 31 | -endif | ||
| 32 | - | ||
| 33 | -ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),0) | ||
| 34 | - CFLAGS += -DLIBDM_API_COOKIE | ||
| 35 | -endif | ||
| 36 | - | ||
| 37 | -ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,/usr/include/libudev.h),0) | ||
| 38 | - CFLAGS += -DLIBUDEV_API_RECVBUF | ||
| 39 | -endif | ||
| 40 | - | ||
| 41 | -ifneq ($(call check_func,dm_task_deferred_remove,/usr/include/libdevmapper.h),0) | ||
| 42 | - CFLAGS += -DLIBDM_API_DEFERRED | ||
| 43 | -endif | ||
| 44 | +CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE | ||
| 45 | +CFLAGS += -DLIBDM_API_COOKIE | ||
| 46 | +CFLAGS += -DLIBUDEV_API_RECVBUF | ||
| 47 | +CFLAGS += -DLIBDM_API_DEFERRED | ||
| 48 | |||
| 49 | OBJS = memory.o parser.o vector.o devmapper.o callout.o \ | ||
| 50 | hwtable.o blacklist.o util.o dmparser.o config.o \ | ||
| 51 | -- | ||
| 52 | 2.8.1 | ||
| 53 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper-kpartx.patch b/meta-oe/recipes-support/multipath-tools/files/0014-Always-use-devmapper-for-kpartx.patch index 803e52c10c..f951213c18 100644 --- a/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper-kpartx.patch +++ b/meta-oe/recipes-support/multipath-tools/files/0014-Always-use-devmapper-for-kpartx.patch | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | From 7267cf235fc052eaa1ca36e437096576edacb131 Mon Sep 17 00:00:00 2001 | 1 | From 7f5869cd32a7b3f717d9544b35562d9d01ca6510 Mon Sep 17 00:00:00 2001 |
| 2 | From: Aws Ismail <aws.ismail@windriver.com> | 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
| 3 | Date: Mon, 22 Sep 2014 17:22:32 -0700 | 3 | Date: Wed, 5 Jul 2017 03:03:16 -0400 |
| 4 | Subject: [PATCH] Always use devmapper for kpartx | 4 | Subject: [PATCH 14/14] Always use devmapper for kpartx |
| 5 | 5 | ||
| 6 | Do not try to compute the LIBDM_API_COOKIE make variable | 6 | Do not try to compute the LIBDM_API_COOKIE make variable |
| 7 | from host information when cross-compiling. | 7 | from host information when cross-compiling. |
| @@ -10,21 +10,22 @@ Upstream-Status: Inappropriate [embedded specific] | |||
| 10 | 10 | ||
| 11 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | 11 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> |
| 12 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | 12 | Signed-off-by: Joe Slater <joe.slater@windriver.com> |
| 13 | |||
| 14 | Rebase to 0.7.1 | ||
| 15 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 13 | --- | 16 | --- |
| 14 | kpartx/Makefile | 6 +----- | 17 | kpartx/Makefile | 4 +--- |
| 15 | 1 file changed, 1 insertion(+), 5 deletions(-) | 18 | 1 file changed, 1 insertion(+), 3 deletions(-) |
| 16 | 19 | ||
| 17 | diff --git a/kpartx/Makefile b/kpartx/Makefile | 20 | diff --git a/kpartx/Makefile b/kpartx/Makefile |
| 18 | index e8a59f2..e694a65 100644 | 21 | index bfa6fe8..be87124 100644 |
| 19 | --- a/kpartx/Makefile | 22 | --- a/kpartx/Makefile |
| 20 | +++ b/kpartx/Makefile | 23 | +++ b/kpartx/Makefile |
| 21 | @@ -7,11 +7,7 @@ CFLAGS += -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 | 24 | @@ -8,9 +8,7 @@ LDFLAGS += $(BIN_LDFLAGS) |
| 22 | 25 | ||
| 23 | LIBDEPS += -ldevmapper | 26 | LIBDEPS += -ldevmapper |
| 24 | 27 | ||
| 25 | -LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h) | 28 | -ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),0) |
| 26 | - | ||
| 27 | -ifneq ($(strip $(LIBDM_API_COOKIE)),0) | ||
| 28 | - CFLAGS += -DLIBDM_API_COOKIE | 29 | - CFLAGS += -DLIBDM_API_COOKIE |
| 29 | -endif | 30 | -endif |
| 30 | +CFLAGS += -DLIBDM_API_COOKIE | 31 | +CFLAGS += -DLIBDM_API_COOKIE |
| @@ -32,5 +33,5 @@ index e8a59f2..e694a65 100644 | |||
| 32 | OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \ | 33 | OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \ |
| 33 | gpt.o mac.o ps3.o crc32.o lopart.o xstrncpy.o devmapper.o | 34 | gpt.o mac.o ps3.o crc32.o lopart.o xstrncpy.o devmapper.o |
| 34 | -- | 35 | -- |
| 35 | 2.11.0 | 36 | 2.8.1 |
| 36 | 37 | ||
diff --git a/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper.patch b/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper.patch deleted file mode 100644 index 33834f6b80..0000000000 --- a/meta-oe/recipes-support/multipath-tools/files/always-use-libdevmapper.patch +++ /dev/null | |||
| @@ -1,57 +0,0 @@ | |||
| 1 | From c4f0dba4e86bfa20252fcc8218398e7468ca9149 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Aws Ismail <aws.ismail@windriver.com> | ||
| 3 | Date: Mon, 22 Sep 2014 17:22:32 -0700 | ||
| 4 | Subject: [PATCH] Always use devmapper | ||
| 5 | |||
| 6 | Do not try to compute several _API_ make variables | ||
| 7 | from host information when cross-compiling. | ||
| 8 | |||
| 9 | Upstream-Status: Inappropriate [embedded specific] | ||
| 10 | |||
| 11 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
| 12 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 13 | --- | ||
| 14 | libmultipath/Makefile | 27 ++++----------------------- | ||
| 15 | 1 file changed, 4 insertions(+), 23 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/libmultipath/Makefile b/libmultipath/Makefile | ||
| 18 | index 495cebe..9626e69 100644 | ||
| 19 | --- a/libmultipath/Makefile | ||
| 20 | +++ b/libmultipath/Makefile | ||
| 21 | @@ -20,29 +20,10 @@ ifdef SYSTEMD | ||
| 22 | endif | ||
| 23 | endif | ||
| 24 | |||
| 25 | -LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h) | ||
| 26 | - | ||
| 27 | -ifneq ($(strip $(LIBDM_API_FLUSH)),0) | ||
| 28 | - CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE | ||
| 29 | -endif | ||
| 30 | - | ||
| 31 | -LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h) | ||
| 32 | - | ||
| 33 | -ifneq ($(strip $(LIBDM_API_COOKIE)),0) | ||
| 34 | - CFLAGS += -DLIBDM_API_COOKIE | ||
| 35 | -endif | ||
| 36 | - | ||
| 37 | -LIBUDEV_API_RECVBUF = $(shell grep -Ecs '^[a-z]*[[:space:]]+udev_monitor_set_receive_buffer_size' /usr/include/libudev.h) | ||
| 38 | - | ||
| 39 | -ifneq ($(strip $(LIBUDEV_API_RECVBUF)),0) | ||
| 40 | - CFLAGS += -DLIBUDEV_API_RECVBUF | ||
| 41 | -endif | ||
| 42 | - | ||
| 43 | -LIBDM_API_DEFERRED = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_deferred_remove' /usr/include/libdevmapper.h) | ||
| 44 | - | ||
| 45 | -ifneq ($(strip $(LIBDM_API_DEFERRED)),0) | ||
| 46 | - CFLAGS += -DLIBDM_API_DEFERRED | ||
| 47 | -endif | ||
| 48 | +CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE | ||
| 49 | +CFLAGS += -DLIBDM_API_COOKIE | ||
| 50 | +CFLAGS += -DLIBUDEV_API_RECVBUF | ||
| 51 | +CFLAGS += -DLIBDM_API_DEFERRED | ||
| 52 | |||
| 53 | OBJS = memory.o parser.o vector.o devmapper.o callout.o \ | ||
| 54 | hwtable.o blacklist.o util.o dmparser.o config.o \ | ||
| 55 | -- | ||
| 56 | 2.11.0 | ||
| 57 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/checkers-disable-libcheckrbd.so.patch b/meta-oe/recipes-support/multipath-tools/files/checkers-disable-libcheckrbd.so.patch deleted file mode 100644 index 908a5162e6..0000000000 --- a/meta-oe/recipes-support/multipath-tools/files/checkers-disable-libcheckrbd.so.patch +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | From 148b848f45957e5e1c0466e8c79c84ba4a0bf241 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Patrick Ohly <patrick.ohly@intel.com> | ||
| 3 | Date: Fri, 27 Jan 2017 10:35:54 +0100 | ||
| 4 | Subject: [PATCH] checkers: disable libcheckrbd.so | ||
| 5 | |||
| 6 | libcheckrbd.so depends on librados, which is not currently available | ||
| 7 | as a recipe. These checkers seem to be optional, so for now we merely | ||
| 8 | disable compilation of libcheckrbd.so. | ||
| 9 | |||
| 10 | Upstream-Status: Inappropriate [configuration] | ||
| 11 | |||
| 12 | Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> | ||
| 13 | --- | ||
| 14 | libmultipath/checkers/Makefile | 1 - | ||
| 15 | 1 file changed, 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile | ||
| 18 | index 11ab76f..c848d50 100644 | ||
| 19 | --- a/libmultipath/checkers/Makefile | ||
| 20 | +++ b/libmultipath/checkers/Makefile | ||
| 21 | @@ -14,7 +14,6 @@ LIBS= \ | ||
| 22 | libcheckemc_clariion.so \ | ||
| 23 | libcheckhp_sw.so \ | ||
| 24 | libcheckrdac.so \ | ||
| 25 | - libcheckrbd.so | ||
| 26 | |||
| 27 | all: $(LIBS) | ||
| 28 | |||
| 29 | -- | ||
| 30 | 2.11.0 | ||
| 31 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/makefile_inc.patch b/meta-oe/recipes-support/multipath-tools/files/makefile_inc.patch deleted file mode 100644 index 5b7b6966ac..0000000000 --- a/meta-oe/recipes-support/multipath-tools/files/makefile_inc.patch +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | From 9f5768eca165502b0f17d271aa6f7cf530ec60b2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Joe Slater <joe.slater@windriver.com> | ||
| 3 | Date: Mon, 22 Sep 2014 17:22:32 -0700 | ||
| 4 | Subject: [PATCH] multipath-tools: modify Makefile.inc for | ||
| 5 | cross-compilation | ||
| 6 | |||
| 7 | Do not look for systemd info on the host, and allow us to pass in CFLAGS | ||
| 8 | using the OPTFLAGS variable. | ||
| 9 | |||
| 10 | Upstream-Status: Inappropriate [embedded specific] | ||
| 11 | |||
| 12 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 13 | |||
| 14 | Update for version 0.5.0-144-g770e6d0 | ||
| 15 | |||
| 16 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 17 | --- | ||
| 18 | Makefile.inc | 17 +++++------------ | ||
| 19 | 1 file changed, 5 insertions(+), 12 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/Makefile.inc b/Makefile.inc | ||
| 22 | index 1cc8f44..15f8b91 100644 | ||
| 23 | --- a/Makefile.inc | ||
| 24 | +++ b/Makefile.inc | ||
| 25 | @@ -29,12 +29,6 @@ ifndef RUN | ||
| 26 | endif | ||
| 27 | endif | ||
| 28 | |||
| 29 | -ifndef SYSTEMD | ||
| 30 | - ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1) | ||
| 31 | - SYSTEMD = $(shell systemctl --version 2> /dev/null | sed -n 's/systemd \([0-9]*\)/\1/p') | ||
| 32 | - endif | ||
| 33 | -endif | ||
| 34 | - | ||
| 35 | ifndef SYSTEMDPATH | ||
| 36 | SYSTEMDPATH=usr/lib | ||
| 37 | endif | ||
| 38 | @@ -61,13 +55,12 @@ RM = rm -f | ||
| 39 | LN = ln -sf | ||
| 40 | INSTALL_PROGRAM = install | ||
| 41 | |||
| 42 | -OPTFLAGS = -O2 -g -pipe -Wall -Wextra -Wformat=2 \ | ||
| 43 | - -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered \ | ||
| 44 | - -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector \ | ||
| 45 | - --param=ssp-buffer-size=4 | ||
| 46 | +ifndef OPTFLAGS | ||
| 47 | +OPTFLAGS = $(RPM_OPT_FLAGS) -Wunused -Wstrict-prototypes | ||
| 48 | +endif | ||
| 49 | |||
| 50 | -CFLAGS = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" | ||
| 51 | -SHARED_FLAGS = -shared | ||
| 52 | +CFLAGS = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" | ||
| 53 | +SHARED_FLAGS = -shared | ||
| 54 | |||
| 55 | %.o: %.c | ||
| 56 | $(CC) $(CFLAGS) -c -o $@ $< | ||
| 57 | -- | ||
| 58 | 2.11.0 | ||
| 59 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/files/multipath.conf.example b/meta-oe/recipes-support/multipath-tools/files/multipath.conf.example new file mode 100644 index 0000000000..6bbeadba27 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/multipath.conf.example | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | # This is a basic configuration file with some examples, for device mapper | ||
| 2 | # multipath. | ||
| 3 | # For a complete list of the default configuration values, see | ||
| 4 | # /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults | ||
| 5 | # For a list of configuration options with descriptions, see | ||
| 6 | # /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.annotated | ||
| 7 | |||
| 8 | ## By default, devices with vendor = "IBM" and product = "S/390.*" are | ||
| 9 | ## blacklisted. To enable mulitpathing on these devies, uncomment the | ||
| 10 | ## following lines. | ||
| 11 | #blacklist_exceptions { | ||
| 12 | # device { | ||
| 13 | # vendor "IBM" | ||
| 14 | # product "S/390.*" | ||
| 15 | # } | ||
| 16 | #} | ||
| 17 | |||
| 18 | ## Use user friendly names, instead of using WWIDs as names. | ||
| 19 | defaults { | ||
| 20 | user_friendly_names yes | ||
| 21 | } | ||
| 22 | ## | ||
| 23 | ## Here is an example of how to configure some standard options. | ||
| 24 | ## | ||
| 25 | # | ||
| 26 | #defaults { | ||
| 27 | # udev_dir /dev | ||
| 28 | # polling_interval 10 | ||
| 29 | # selector "round-robin 0" | ||
| 30 | # path_grouping_policy multibus | ||
| 31 | # getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n" | ||
| 32 | # prio alua | ||
| 33 | # path_checker readsector0 | ||
| 34 | # rr_min_io 100 | ||
| 35 | # max_fds 8192 | ||
| 36 | # rr_weight priorities | ||
| 37 | # failback immediate | ||
| 38 | # no_path_retry fail | ||
| 39 | # user_friendly_names yes | ||
| 40 | #} | ||
| 41 | ## | ||
| 42 | ## The wwid line in the following blacklist section is shown as an example | ||
| 43 | ## of how to blacklist devices by wwid. The 2 devnode lines are the | ||
| 44 | ## compiled in default blacklist. If you want to blacklist entire types | ||
| 45 | ## of devices, such as all scsi devices, you should use a devnode line. | ||
| 46 | ## However, if you want to blacklist specific devices, you should use | ||
| 47 | ## a wwid line. Since there is no guarantee that a specific device will | ||
| 48 | ## not change names on reboot (from /dev/sda to /dev/sdb for example) | ||
| 49 | ## devnode lines are not recommended for blacklisting specific devices. | ||
| 50 | ## | ||
| 51 | #blacklist { | ||
| 52 | # wwid 26353900f02796769 | ||
| 53 | # devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" | ||
| 54 | # devnode "^hd[a-z]" | ||
| 55 | #} | ||
| 56 | #multipaths { | ||
| 57 | # multipath { | ||
| 58 | # wwid 3600508b4000156d700012000000b0000 | ||
| 59 | # alias yellow | ||
| 60 | # path_grouping_policy multibus | ||
| 61 | # path_checker readsector0 | ||
| 62 | # path_selector "round-robin 0" | ||
| 63 | # failback manual | ||
| 64 | # rr_weight priorities | ||
| 65 | # no_path_retry 5 | ||
| 66 | # } | ||
| 67 | # multipath { | ||
| 68 | # wwid 1DEC_____321816758474 | ||
| 69 | # alias red | ||
| 70 | # } | ||
| 71 | #} | ||
| 72 | #devices { | ||
| 73 | # device { | ||
| 74 | # vendor "COMPAQ " | ||
| 75 | # product "HSV110 (C)COMPAQ" | ||
| 76 | # path_grouping_policy multibus | ||
| 77 | # getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n" | ||
| 78 | # path_checker readsector0 | ||
| 79 | # path_selector "round-robin 0" | ||
| 80 | # hardware_handler "0" | ||
| 81 | # failback 15 | ||
| 82 | # rr_weight priorities | ||
| 83 | # no_path_retry queue | ||
| 84 | # } | ||
| 85 | # device { | ||
| 86 | # vendor "COMPAQ " | ||
| 87 | # product "MSA1000 " | ||
| 88 | # path_grouping_policy multibus | ||
| 89 | # } | ||
| 90 | #} | ||
diff --git a/meta-oe/recipes-support/multipath-tools/files/shared-libs-avoid-linking-.so-as-executable.patch b/meta-oe/recipes-support/multipath-tools/files/shared-libs-avoid-linking-.so-as-executable.patch deleted file mode 100644 index 88579e6aab..0000000000 --- a/meta-oe/recipes-support/multipath-tools/files/shared-libs-avoid-linking-.so-as-executable.patch +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 1 | From 4311856200480288494df8df737f71ea316592d0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Patrick Ohly <patrick.ohly@intel.com> | ||
| 3 | Date: Thu, 26 Jan 2017 15:28:34 +0100 | ||
| 4 | Subject: [PATCH] shared libs: avoid linking .so as executable | ||
| 5 | |||
| 6 | When the OE build systems sets CFLAGS including -pie, gcc overrides | ||
| 7 | the earlier -shared parameter and tries to link a binary, leading to | ||
| 8 | errors about missing functions like main(). | ||
| 9 | |||
| 10 | Reordering the parameters so that -shared comes after CFLAGS | ||
| 11 | fixes this. | ||
| 12 | |||
| 13 | Upstream-Status: Inappropriate [OE specific, -pie shouldn't be in CFLAGS?!] | ||
| 14 | |||
| 15 | Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> | ||
| 16 | --- | ||
| 17 | diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile | ||
| 18 | index 457c4ca..f68c82c 100644 | ||
| 19 | --- a/libmpathcmd/Makefile | ||
| 20 | +++ b/libmpathcmd/Makefile | ||
| 21 | @@ -9,7 +9,7 @@ OBJS = mpath_cmd.o | ||
| 22 | all: $(LIBS) | ||
| 23 | |||
| 24 | $(LIBS): $(OBJS) | ||
| 25 | - $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) $(LIBDEPS) | ||
| 26 | + $(CC) $(LDFLAGS) $(CFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) | ||
| 27 | $(LN) $@ $(DEVLIB) | ||
| 28 | |||
| 29 | install: $(LIBS) | ||
| 30 | diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile | ||
| 31 | index 6e43427..2486302 100644 | ||
| 32 | --- a/libmpathpersist/Makefile | ||
| 33 | +++ b/libmpathpersist/Makefile | ||
| 34 | @@ -15,7 +15,7 @@ all: $(LIBS) | ||
| 35 | |||
| 36 | $(LIBS): | ||
| 37 | $(CC) -c $(CFLAGS) *.c | ||
| 38 | - $(CC) $(LDFLAGS) $(SHARED_FLAGS) $(LIBDEPS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) | ||
| 39 | + $(CC) $(LDFLAGS) $(CFLAGS) $(SHARED_FLAGS) $(LIBDEPS) -Wl,-soname=$@ -o $@ $(OBJS) | ||
| 40 | $(LN) $(LIBS) $(DEVLIB) | ||
| 41 | $(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz | ||
| 42 | $(GZIP) mpath_persistent_reserve_out.3 > mpath_persistent_reserve_out.3.gz | ||
| 43 | diff --git a/libmultipath/Makefile b/libmultipath/Makefile | ||
| 44 | index 495cebe..752bcc0 100644 | ||
| 45 | --- a/libmultipath/Makefile | ||
| 46 | +++ b/libmultipath/Makefile | ||
| 47 | @@ -55,7 +55,7 @@ OBJS = memory.o parser.o vector.o devmapper.o callout.o \ | ||
| 48 | all: $(LIBS) | ||
| 49 | |||
| 50 | $(LIBS): $(OBJS) | ||
| 51 | - $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) $(LIBDEPS) | ||
| 52 | + $(CC) $(LDFLAGS) $(CFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) | ||
| 53 | $(LN) $@ $(DEVLIB) | ||
| 54 | |||
| 55 | install: | ||
diff --git a/meta-oe/recipes-support/multipath-tools/multipath-tools_0.7.1.bb b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.7.1.bb new file mode 100644 index 0000000000..93312116ff --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.7.1.bb | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | SUMMARY = "The upstream project used to drive the Device Mapper multipathing driver" | ||
| 2 | |||
| 3 | DESCRIPTION = "It provides tools to manage multipath devices \ | ||
| 4 | by instructing the device-mapper kernel module what to do. These \ | ||
| 5 | tools include: \ | ||
| 6 | 1. multipath - Scan the system for multipath devices and assemble them.\ | ||
| 7 | 2. multipathd - Detects when paths fail and execs multipath to update \ | ||
| 8 | things.\ | ||
| 9 | 3. mpathpersist - Persistent reservation management feature allows \ | ||
| 10 | cluster management software to manage persistent reservation through \ | ||
| 11 | mpath device. It processes management requests from callers and hides \ | ||
| 12 | the management task details. It also handles persistent reservation \ | ||
| 13 | management of data path life cycle and state changes.\ | ||
| 14 | 4. kpartx - This tool, derived from util-linux's partx, reads partition \ | ||
| 15 | tables on specified device and create device maps over partitions \ | ||
| 16 | segments detected. It is called from hotplug upon device maps creation \ | ||
| 17 | and deletion" | ||
| 18 | |||
| 19 | HOMEPAGE = "http://christophe.varoqui.free.fr/" | ||
| 20 | |||
| 21 | DEPENDS = "libdevmapper \ | ||
| 22 | libaio \ | ||
| 23 | liburcu \ | ||
| 24 | readline \ | ||
| 25 | udev \ | ||
| 26 | json-c \ | ||
| 27 | " | ||
| 28 | |||
| 29 | LICENSE = "GPLv2" | ||
| 30 | |||
| 31 | SRC_URI = "git://git.opensvc.com/multipath-tools/.git;protocol=http \ | ||
| 32 | file://multipathd.oe \ | ||
| 33 | file://multipath.conf.example \ | ||
| 34 | file://0001-multipath-attempt-at-common-multipath.rules.patch \ | ||
| 35 | file://0002-RH-fixup-udev-rules-for-redhat.patch \ | ||
| 36 | file://0003-RH-Remove-the-property-blacklist-exception-builtin.patch \ | ||
| 37 | file://0004-RH-don-t-start-without-a-config-file.patch \ | ||
| 38 | file://0005-RH-add-mpathconf.patch \ | ||
| 39 | file://0006-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch \ | ||
| 40 | file://0007-RH-trigger-change-uevent-on-new-device-creation.patch \ | ||
| 41 | file://0008-libmultipath-change-how-RADOS-checker-is-enabled.patch \ | ||
| 42 | file://0009-multipath-set-verbosity-to-default-during-config.patch \ | ||
| 43 | file://0010-mpath-skip-device-configs-without-vendor-product.patch \ | ||
| 44 | file://0011-multipathd-fix-show-maps-json-crash.patch \ | ||
| 45 | file://0012-multipath-tools-modify-Makefile.inc-for-cross-compil.patch \ | ||
| 46 | file://0013-Always-use-devmapper.patch \ | ||
| 47 | file://0014-Always-use-devmapper-for-kpartx.patch \ | ||
| 48 | " | ||
| 49 | LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" | ||
| 50 | |||
| 51 | SRCREV = "f21166a812a2cfb50ecf9550d32947c83103f83a" | ||
| 52 | |||
| 53 | S = "${WORKDIR}/git" | ||
| 54 | |||
| 55 | inherit systemd pkgconfig | ||
| 56 | |||
| 57 | SYSTEMD_SERVICE_${PN} = "multipathd.service" | ||
| 58 | |||
| 59 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
| 60 | |||
| 61 | # multipath-tools includes a copy of the valgrind.h header | ||
| 62 | # file and uses the macros to suppress some false positives. However, | ||
| 63 | # that only works on ARM when thumb is disabled. Otherwise one gets: | ||
| 64 | # Error: shifts in CMP/MOV instructions are only supported in unified syntax -- `mov r12,r12,ror#3' | ||
| 65 | # ../Makefile.inc:66: recipe for target 'debug.o' failed | ||
| 66 | ARM_INSTRUCTION_SET_armv4 = "arm" | ||
| 67 | ARM_INSTRUCTION_SET_armv5 = "arm" | ||
| 68 | |||
| 69 | # The exact version of SYSTEMD does not matter but should be greater than 209. | ||
| 70 | # | ||
| 71 | EXTRA_OEMAKE = 'MULTIPATH_VERSION=${PV} DESTDIR=${D} syslibdir=${base_libdir} \ | ||
| 72 | OPTFLAGS="${CFLAGS}" \ | ||
| 73 | bindir=${base_sbindir} \ | ||
| 74 | LIB=${base_libdir} libdir=${base_libdir}/multipath \ | ||
| 75 | unitdir=${systemd_system_unitdir} \ | ||
| 76 | ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "SYSTEMD=216", "", d)} \ | ||
| 77 | ' | ||
| 78 | |||
| 79 | do_install() { | ||
| 80 | oe_runmake install | ||
| 81 | |||
| 82 | # We copy an initscript, but do not start multipathd at init time. | ||
| 83 | # | ||
| 84 | if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)};then | ||
| 85 | install -d ${D}${sysconfdir}/init.d | ||
| 86 | cp ${WORKDIR}/multipathd.oe ${D}${sysconfdir}/init.d/multipathd | ||
| 87 | fi | ||
| 88 | |||
| 89 | install -d ${D}${sysconfdir} | ||
| 90 | install -m 0644 ${WORKDIR}/multipath.conf.example \ | ||
| 91 | ${D}${sysconfdir}/multipath.conf.example | ||
| 92 | } | ||
| 93 | |||
| 94 | FILES_${PN}-dbg += "${base_libdir}/multipath/.debug" | ||
| 95 | |||
| 96 | PACKAGES =+ "${PN}-libs" | ||
| 97 | FILES_${PN}-libs = "${base_libdir}/lib*.so.* \ | ||
| 98 | ${base_libdir}/multipath/lib*.so*" | ||
| 99 | RDEPENDS_${PN} += "${PN}-libs" | ||
| 100 | |||
| 101 | PROVIDES += "device-mapper-multipath" | ||
| 102 | RPROVIDES_${PN} += "device-mapper-multipath" | ||
| 103 | RPROVIDES_${PN}-libs += "device-mapper-multipath-libs" | ||
| 104 | |||
| 105 | FILES_${PN}-dev += "${base_libdir}/pkgconfig" | ||
| 106 | |||
| 107 | PACKAGES =+ "kpartx" | ||
| 108 | FILES_kpartx = "${base_sbindir}/kpartx \ | ||
| 109 | ${nonarch_libdir}/udev/kpartx_id \ | ||
| 110 | " | ||
| 111 | |||
| 112 | RDEPENDS_${PN} += "kpartx" | ||
diff --git a/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb b/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb deleted file mode 100644 index 5f8c422576..0000000000 --- a/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb +++ /dev/null | |||
| @@ -1,71 +0,0 @@ | |||
| 1 | SUMMARY = "The upstream project used to drive the Device Mapper multipathing driver" | ||
| 2 | |||
| 3 | DEPENDS = "libdevmapper libaio liburcu readline udev" | ||
| 4 | |||
| 5 | LICENSE = "LGPLv2" | ||
| 6 | |||
| 7 | SRC_URI = "git://git.opensvc.com/multipath-tools/.git;protocol=http \ | ||
| 8 | file://multipathd.oe \ | ||
| 9 | file://makefile_inc.patch \ | ||
| 10 | file://always-use-libdevmapper.patch \ | ||
| 11 | file://always-use-libdevmapper-kpartx.patch \ | ||
| 12 | file://0001-multipathd.service-Error-fix.patch \ | ||
| 13 | file://shared-libs-avoid-linking-.so-as-executable.patch \ | ||
| 14 | file://checkers-disable-libcheckrbd.so.patch \ | ||
| 15 | " | ||
| 16 | LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" | ||
| 17 | |||
| 18 | # 0.6.4 | ||
| 19 | SRCREV = "922421cf795d53d339862bb2d99f1a85c96ad9a3" | ||
| 20 | |||
| 21 | inherit systemd | ||
| 22 | |||
| 23 | |||
| 24 | S = "${WORKDIR}/git" | ||
| 25 | |||
| 26 | PV = "0.6.4+git${@'${SRCPV}'.split('+')[-1]}" | ||
| 27 | |||
| 28 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
| 29 | |||
| 30 | # multipath-tools includes a copy of the valgrind.h header | ||
| 31 | # file and uses the macros to suppress some false positives. However, | ||
| 32 | # that only works on ARM when thumb is disabled. Otherwise one gets: | ||
| 33 | # Error: shifts in CMP/MOV instructions are only supported in unified syntax -- `mov r12,r12,ror#3' | ||
| 34 | # ../Makefile.inc:66: recipe for target 'debug.o' failed | ||
| 35 | ARM_INSTRUCTION_SET_armv4 = "arm" | ||
| 36 | ARM_INSTRUCTION_SET_armv5 = "arm" | ||
| 37 | |||
| 38 | # The exact version of SYSTEMD does not matter but should be greater than 209. | ||
| 39 | # | ||
| 40 | EXTRA_OEMAKE = 'MULTIPATH_VERSION=${PV} DESTDIR=${D} syslibdir=${base_libdir} \ | ||
| 41 | OPTFLAGS="${CFLAGS}" \ | ||
| 42 | bindir=${base_sbindir} \ | ||
| 43 | LIB=${base_libdir} libdir=${base_libdir}/multipath \ | ||
| 44 | unitdir=${systemd_system_unitdir} \ | ||
| 45 | ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "SYSTEMD=216", "", d)} \ | ||
| 46 | ' | ||
| 47 | |||
| 48 | do_install() { | ||
| 49 | oe_runmake install | ||
| 50 | |||
| 51 | # We copy an initscript, but do not start multipathd at init time. | ||
| 52 | # | ||
| 53 | install -d ${D}${sysconfdir}/init.d | ||
| 54 | cp ${WORKDIR}/multipathd.oe ${D}${sysconfdir}/init.d/multipathd | ||
| 55 | |||
| 56 | } | ||
| 57 | |||
| 58 | FILES_${PN}-dbg += "${base_libdir}/multipath/.debug" | ||
| 59 | |||
| 60 | # systemd and udev stuff always goes under /lib! | ||
| 61 | # | ||
| 62 | FILES_${PN} += "${base_libdir}/multipath \ | ||
| 63 | ${systemd_system_unitdir} \ | ||
| 64 | " | ||
| 65 | |||
| 66 | PACKAGES =+ "kpartx" | ||
| 67 | FILES_kpartx = "${base_sbindir}/kpartx \ | ||
| 68 | ${nonarch_libdir}/udev/kpartx_id \ | ||
| 69 | " | ||
| 70 | |||
| 71 | RDEPENDS_${PN} += "kpartx" | ||
