diff -Nru drbd8-8.4.3/debian/changelog drbd8-8.4.3/debian/changelog --- drbd8-8.4.3/debian/changelog 2014-02-07 17:55:46.000000000 +0000 +++ drbd8-8.4.3/debian/changelog 2014-04-30 13:36:56.000000000 +0000 @@ -1,3 +1,22 @@ +drbd8 (2:8.4.3-0ubuntu0.12.04.2) precise-proposed; urgency=low + + * d/p/ubuntu-fix-drbdsetup-legacy-path.patch + Test kernel module version and run the legacy drbdsetup early if + it is lower than 8.4. Also do not try to be smart about paths for + the legacy command (newer upstream versions do the same) (LP: #1314289). + * d/p/ubuntu-compat83-init-script.patch: + Fix service stop to shut down the resources (LP: #1314289). + * d/p/ubuntu-compat83-ocf-script.patch: + Fix pacemaker/corosync startup when running compat mode (LP: #1314289). + * d/p/ubuntu-fix-drbdadm-version-check.patch: + Fix compat mode when DRBD_DONT_WARN_ON_VERSION_MISMATCH is set + (LP: #1314598) + * d/rules: Create soft-links for compat binaries in /sbin to work + around the tools looking for compat binaries in their own path + when called with full path (LP: #1314289). + + -- Stefan Bader Wed, 30 Apr 2014 15:20:23 +0200 + drbd8 (2:8.4.3-0ubuntu0.12.04.1) precise; urgency=low * Backport version from 13.04 so that the utils will handle the diff -Nru drbd8-8.4.3/debian/patches/series drbd8-8.4.3/debian/patches/series --- drbd8-8.4.3/debian/patches/series 2014-02-07 17:55:46.000000000 +0000 +++ drbd8-8.4.3/debian/patches/series 2014-04-30 13:36:20.000000000 +0000 @@ -5,3 +5,7 @@ ubuntu-no-options-in-global.patch ubuntu-emulate-adjust-with-progress.patch ubuntu-adjust-legacy-version.patch +ubuntu-fix-drbdsetup-legacy-path.patch +ubuntu-compat83-init-script.patch +ubuntu-compat83-ocf-script.patch +ubuntu-fix-drbdadm-version-check.patch diff -Nru drbd8-8.4.3/debian/patches/ubuntu-compat83-init-script.patch drbd8-8.4.3/debian/patches/ubuntu-compat83-init-script.patch --- drbd8-8.4.3/debian/patches/ubuntu-compat83-init-script.patch 1970-01-01 00:00:00.000000000 +0000 +++ drbd8-8.4.3/debian/patches/ubuntu-compat83-init-script.patch 2014-04-29 17:08:56.000000000 +0000 @@ -0,0 +1,42 @@ +Description: Add drbd-8.3 compat code to init script + The drbdsetup command to get the resource names does not work when + running in compat mode. Since there was no multi-volume support it + is sufficient to use the device name for the down command. +Forwarded: not-yet +Origin: vendor, http://bugs.launchpad.net/bugs/1314289 +Bug-Ubuntu: http://bugs.launchpad.net/bugs/1314289 +Author: Stefan Bader + +Index: drbd8-8.4.3/scripts/drbd +=================================================================== +--- drbd8-8.4.3.orig/scripts/drbd 2014-04-22 13:55:54.000000000 +0200 ++++ drbd8-8.4.3/scripts/drbd 2014-04-25 08:53:21.616201633 +0200 +@@ -36,6 +36,9 @@ fi + + test -f $DRBDADM || exit 5 + ++DRBDADM_VERSION_CODE=0 ++eval "$(DRBDADM --version 2>/dev/null)" ++ + # we only use these two functions, define fallback versions of them ... + log_daemon_msg() { echo -n "${1:-}: ${2:-}"; } + log_end_msg() { echo "."; } +@@ -216,10 +219,15 @@ case "$1" in + *" not mounted") :;; + *) echo "$M" >&2 ;; + esac ++ if (( $DRBDADM_VERSION_CODE < 0x080400 )); then ++ drbdsetup "$d" down ++ fi + done +- for res in $(drbdsetup all show | sed -ne 's/^resource \(.*\) {$/\1/p'); do +- drbdsetup "$res" down +- done ++ if (( $DRBDADM_VERSION_CODE >= 0x080400 )); then ++ for res in $(drbdsetup all show | sed -ne 's/^resource \(.*\) {$/\1/p'); do ++ drbdsetup "$res" down ++ done ++ fi + _udev_settle &> /dev/null + $RMMOD drbd && break + fi diff -Nru drbd8-8.4.3/debian/patches/ubuntu-compat83-ocf-script.patch drbd8-8.4.3/debian/patches/ubuntu-compat83-ocf-script.patch --- drbd8-8.4.3/debian/patches/ubuntu-compat83-ocf-script.patch 1970-01-01 00:00:00.000000000 +0000 +++ drbd8-8.4.3/debian/patches/ubuntu-compat83-ocf-script.patch 2014-04-29 17:08:56.000000000 +0000 @@ -0,0 +1,41 @@ +Description: Add drbd-8.3 compat code to ocf script + The ocf script, used by pacemaker an a resource agent, does not work + as expected. One problem is drbdsetup-83 that needs a device name or + minor number instead of a resource name. + The other issue is that drbdadm when called through pacemaker does not + seem to be able to call the compat drbdadm-83 (oddly only the syncer + command). Work around that as well. +Forwarded: not-yet +Origin: vendor, http://bugs.launchpad.net/bugs/1314289 +Bug-Ubuntu: http://bugs.launchpad.net/bugs/1314289 +Author: Stefan Bader + +Index: drbd8-8.4.3/scripts/drbd.ocf +=================================================================== +--- drbd8-8.4.3.orig/scripts/drbd.ocf 2014-04-25 16:56:38.761961474 +0200 ++++ drbd8-8.4.3/scripts/drbd.ocf 2014-04-25 17:00:25.000000000 +0200 +@@ -259,7 +259,11 @@ drbd_set_status_variables() { + DRBD_DSTATE_REMOTE=(DUnknown) + + # Populates a set of variables relevant to DRBD's status +- eval "$($DRBDSETUP "$DRBD_RESOURCE" sh-status)" ++ if $DRBD_HAS_MULTI_VOLUME; then ++ eval "$($DRBDSETUP "$DRBD_RESOURCE" sh-status)" ++ else ++ eval "$($DRBDSETUP "${DRBD_DEVICES[0]}" sh-status)" ++ fi + } + + # This is not the only fencing mechanism. +@@ -816,6 +820,11 @@ drbd_validate_all () { + fi + if (( $DRBDADM_VERSION_CODE >= 0x080400 )); then + DRBD_HAS_MULTI_VOLUME=true ++ else ++ DRBDADM="drbdadm-83" ++ DRBDSETUP="drbdsetup-83" ++ check_binary $DRBDADM ++ check_binary $DRBDSETUP + fi + check_crm_feature_set + diff -Nru drbd8-8.4.3/debian/patches/ubuntu-fix-drbdadm-version-check.patch drbd8-8.4.3/debian/patches/ubuntu-fix-drbdadm-version-check.patch --- drbd8-8.4.3/debian/patches/ubuntu-fix-drbdadm-version-check.patch 1970-01-01 00:00:00.000000000 +0000 +++ drbd8-8.4.3/debian/patches/ubuntu-fix-drbdadm-version-check.patch 2014-04-30 13:36:20.000000000 +0000 @@ -0,0 +1,20 @@ +Description: Fix drbdadm compat mode when environment variable is set + When DRBD_DONT_WARN_ON_VERSION_MISMATCH is set, vcs_get_current is not + called and compat mode never gets run. +Forwarded: not-needed +Origin: vendor, http://bugs.launchpad.net/bugs/1314598 +Bug-Ubuntu: http://bugs.launchpad.net/bugs/1314598 +Author: Stefan Bader + +Index: drbd8-8.4.3/user/drbdadm_usage_cnt.c +=================================================================== +--- drbd8-8.4.3.orig/user/drbdadm_usage_cnt.c 2014-04-30 13:56:48.860032534 +0200 ++++ drbd8-8.4.3/user/drbdadm_usage_cnt.c 2014-04-30 13:58:46.124605810 +0200 +@@ -291,6 +291,7 @@ void add_lib_drbd_to_path(void) + + void maybe_exec_drbdadm_83(char **argv) + { ++ vcs_get_current(); + if (current_vcs_rel.version.major == 8 && + current_vcs_rel.version.minor == 3) { + #ifdef DRBD_LEGACY_83 diff -Nru drbd8-8.4.3/debian/patches/ubuntu-fix-drbdsetup-legacy-path.patch drbd8-8.4.3/debian/patches/ubuntu-fix-drbdsetup-legacy-path.patch --- drbd8-8.4.3/debian/patches/ubuntu-fix-drbdsetup-legacy-path.patch 1970-01-01 00:00:00.000000000 +0000 +++ drbd8-8.4.3/debian/patches/ubuntu-fix-drbdsetup-legacy-path.patch 2014-04-29 17:08:56.000000000 +0000 @@ -0,0 +1,123 @@ +Description: Also add drbd lib to the path for drbdsetup + The same is done for drbadmin. Otherwise the call to the legacy binary + fails. +Forwarded: not-yet +Origin: vendor, http://bugs.launchpad.net/bugs/1314289 +Bug-Ubuntu: http://bugs.launchpad.net/bugs/1314289 +Author: Stefan Bader +Index: drbd8-8.4.3/user/drbdsetup.c +=================================================================== +--- drbd8-8.4.3.orig/user/drbdsetup.c 2014-04-25 17:03:05.000000000 +0200 ++++ drbd8-8.4.3/user/drbdsetup.c 2014-04-25 17:35:48.065446636 +0200 +@@ -2395,33 +2395,69 @@ static int is_drbd_driver_missing(void) + return 1; + } + +-void exec_legacy_drbdsetup(char **argv) +-{ + #ifdef DRBD_LEGACY_83 +- static const char * const legacy_drbdsetup = "drbdsetup-83"; +- char *progname, *drbdsetup; ++/* ++ * Query /proc/drbd for kernel module version (stolen mostly from drbdadm). ++ */ ++static unsigned int version_from_string(char *s) ++{ ++ char *v1, *v2, *v3; ++ unsigned ver = 0; ++ ++ v1 = strstr(s, "version: "); ++ if (v1) { ++ v1 += 9; ++ for (v2 = v1; *v2 && *v2 != '.'; v2++); ++ if (*v2 == '.') { ++ *(v2++) = 0; ++ for (v3 = v2; *v3 && *v3 != '.'; v3++); ++ if (*v3 == '.') { ++ *(v3++) = 0; ++ ver = (unsigned int) strtol(v1, NULL, 10); ++ ver <<= 8; ++ ver += (unsigned int) strtol(v2, NULL, 10); ++ ver <<= 8; ++ ver += (unsigned int) strtol(v3, NULL, 10); ++ } ++ } ++ } ++ ++ return ver; ++} + +- /* in case drbdsetup is called with an absolute or relative pathname +- * look for the legacy drbdsetup binary in the same location, +- * otherwise, just let execvp sort it out... */ +- if ((progname = strrchr(argv[0], '/')) == 0) { +- drbdsetup = strdup(legacy_drbdsetup); +- } else { +- size_t len_dir, l; +- +- ++progname; +- len_dir = progname - argv[0]; +- +- l = len_dir + strlen(legacy_drbdsetup) + 1; +- drbdsetup = malloc(l); +- if (!drbdsetup) { +- fprintf(stderr, "Malloc() failed\n"); +- exit(20); ++static unsigned int get_driver_version(void) ++{ ++ const int buf_size = 4096; ++ char *buf; ++ int rr, fd; ++ unsigned int ver = 0xffffff; ++ ++ fd = open("/proc/drbd", O_RDONLY); ++ if (fd == -1) return 0; ++ ++ buf = malloc(buf_size); ++ if (buf) { ++ rr = read(fd, buf, buf_size - 1); ++ if (rr != -1) { ++ buf[rr] = 0; ++ ver = version_from_string(buf); + } +- strncpy(drbdsetup, argv[0], len_dir); +- strcpy(drbdsetup + len_dir, legacy_drbdsetup); ++ free(buf); + } +- execvp(drbdsetup, argv); ++ close(fd); ++ ++ return ver; ++} ++#endif ++ ++void exec_legacy_drbdsetup(char **argv) ++{ ++#ifdef DRBD_LEGACY_83 ++ /* ++ * No subtle path magics, just go there (seen on more recent ++ * versions of drbd. ++ */ ++ execv("/lib/drbd/drbdsetup-83", argv); + #else + fprintf(stderr, "This drbdsetup was not built with support for legacy drbd-8.3\n" + "Eventually rebuild with ./configure --with-legacy-connector\n"); +@@ -2441,6 +2477,18 @@ int main(int argc, char **argv) + return -111; + } + ++#ifdef DRBD_LEGACY_83 ++ /* ++ * Switch to legacy command early if version code < 0x080400 ++ */ ++ if (get_driver_version() < 0x080400) { ++ exec_legacy_drbdsetup(argv); ++ /* Only reached in case exec() failed... */ ++ fprintf(stderr, "Failed to run legacy drbdsetup!\n"); ++ return 20; ++ } ++#endif ++ + cmdname = strrchr(argv[0],'/'); + if (cmdname) + argv[0] = ++cmdname; diff -Nru drbd8-8.4.3/debian/rules drbd8-8.4.3/debian/rules --- drbd8-8.4.3/debian/rules 2014-02-07 17:55:46.000000000 +0000 +++ drbd8-8.4.3/debian/rules 2014-04-29 17:08:56.000000000 +0000 @@ -115,6 +115,14 @@ $(MAKE) DESTDIR=$(CURDIR)/debian/drbd8-utils/ install dh_install --source=debian/drbd8-utils --list-missing -s + # Create soft-links for the compat binaries to work around commands + # searching for the same path only for compat binaries when called + # with a full path. + ln -s ../lib/drbd/drbdadm-83 \ + $(CURDIR)/debian/drbd8-utils/sbin/drbdadm-83 + ln -s ../lib/drbd/drbdsetup-83 \ + $(CURDIR)/debian/drbd8-utils/sbin/drbdsetup-83 + # Move udev rule to /lib/udev/rules.d (Fixes lintian warning) mkdir -p $(CURDIR)/debian/drbd8-utils/lib/udev/ mv $(CURDIR)/debian/drbd8-utils/etc/udev/rules.d $(CURDIR)/debian/drbd8-utils/lib/udev/