Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package drbd-utils for openSUSE:Factory checked in at 2025-01-09 15:09:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/drbd-utils (Old) and /work/SRC/openSUSE:Factory/.drbd-utils.new.1881 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "drbd-utils" Thu Jan 9 15:09:37 2025 rev:62 rq:1235883 version:9.29.0 Changes: -------- --- /work/SRC/openSUSE:Factory/drbd-utils/drbd-utils.changes 2024-11-12 19:26:08.071298541 +0100 +++ /work/SRC/openSUSE:Factory/.drbd-utils.new.1881/drbd-utils.changes 2025-01-09 15:11:26.566269933 +0100 @@ -1,0 +2,91 @@ +Wed Jan 8 07:42:00 UTC 2025 - Heming Zhao <heming.zhao@suse.com> + +- Update drbd-utils from 9.25.0 to 9.29.0 + + * Changelog from Linbit: + + 9.29.0 + ----------- + * drbdmeta: fix initialization for external md + * build: allow disbling keyutils + * tests: export sanitized environment + * drbdmon: various improvements + * build: add cyclonedx + * drbsetup,v9: fix multiple paths drbdsetup show --json + strictly spreaking breaking change, but maily used internally + * events2: expose if device is open + * drbdadm: fix undefined behavior that triggered on amd64 + * shared: fix out-of-bounds access in parsing + * drbsetup,v9: event consistency with peer devices + * drbdadm: fix parsing of v8.4 configs for compatibility + * drbdmeta: fix segfault for check-resize on intentionally diskless + * drbd-promote@.service: check if ExecCondition is available + + 9.28.0 + ----------- + * events2: set may_promote:no promotion_score:0 while + force-io-failure:yes + * drbdsetup,v9: show TLS in connection status + * drbdsetup,v9: add udev command + * 8.3: remove + * crm-fence-peer.9.sh: fixes for pacemaker 2.1.7 + * events2: improved out of order message handling + + 9.27.0 + ----------- + * adjust,v9: retry for diskless primaries + * tests: sanitize env (e.g., TZ) + * drbdmeta: dump and restore the members field + + 9.26.0 + ----------- + * config,v9: new config option load-balance-paths + * config,v9: new config options rdma-ctrls-(snd|rcv)buf-size + * drbdadm,v9: fix segfault if proxy has no path + * drbd: increase maximum CPU mask size + * systemd: introduce drbd-graceful-shutdown.service + * drbdmeta,v9: fix regression, allow attach after offline resize + * drbdsetup,v9: add path established information to JSON status + * events2: terminate on module unload even under --poll + * events2: specif exit code if module unload + * docs: add spdx license file + * drbdmon: various smaller improvements + * drbdsetup,v9: support for TLS/kTLS + + * remove patches which are already included in upstream code: + 0001-drbdadm-v9-do-not-segfault-when-re-configuring-proxy.patch + 0002-user-drbrdmon-add-missing-stdint.h-includes.patch + 0003-Introduce-default_types.h-header.patch + bsc-1219263_crm-fence-peer.9.sh-fix-parsing-in_ccm-crmd-fields-o.patch + bsc-1219263_crm-fence-peer.9.sh-use-join-of-node_state-to-judge-.patch + bsc-1233273_drbd.ocf-update-regex-of-sed-for-new-output-from-crm.patch + usrmerge_move_lib_to_prefix_lib.patch + + * add upstream patches to align commit 0a014f290802: + 0001-drbd-verify.py-relax-host-key-checking.patch + 0002-DRBDmon-Disabled-DRBD-commands-warning-only-for-actu.patch + 0003-DRBDmon-Integrate-global-local-command-delegation.patch + 0004-DRBDmon-Adjust-events-log-supplier-program-name.patch + 0005-DRBDmon-Add-drbd-events-log-supplier.patch + 0006-DRBDmon-Adjust-Makefile.patch + 0007-DRBDmon-Version-V1R4M1.patch + 0008-drbdadm-add-proxy-options-to-add-connection-command.patch + 0009-Do-not-hardcode-paths-in-services-and-scripts.patch + 0010-Fix-typo-in-warning-there-is-no-po4a-translage-comma.patch + 0011-drbd.ocf-explicitly-timeout-crm_master-IPC-early.patch + 0012-drbd.ocf-the-text-output-of-crm_resource-locate-has-.patch + + * update patches according to source code changes: + bsc-1233273_drbd.ocf-replace-crm_master-with-ocf_promotion_score.patch + fence-after-pacemaker-down.patch + + * modify upstream patch for passing build: + 0009-Do-not-hardcode-paths-in-services-and-scripts.patch + + * add new service: + drbd-graceful-shutdown.service + + * add new binrary: + drbd-events-log-supplier + +------------------------------------------------------------------- Old: ---- 0001-drbdadm-v9-do-not-segfault-when-re-configuring-proxy.patch 0002-user-drbrdmon-add-missing-stdint.h-includes.patch 0003-Introduce-default_types.h-header.patch bsc-1219263_crm-fence-peer.9.sh-fix-parsing-in_ccm-crmd-fields-o.patch bsc-1219263_crm-fence-peer.9.sh-use-join-of-node_state-to-judge-.patch bsc-1233273_drbd.ocf-update-regex-of-sed-for-new-output-from-crm.patch drbd-utils-9.25.0.tar.gz usrmerge_move_lib_to_prefix_lib.patch New: ---- 0001-drbd-verify.py-relax-host-key-checking.patch 0002-DRBDmon-Disabled-DRBD-commands-warning-only-for-actu.patch 0003-DRBDmon-Integrate-global-local-command-delegation.patch 0004-DRBDmon-Adjust-events-log-supplier-program-name.patch 0005-DRBDmon-Add-drbd-events-log-supplier.patch 0006-DRBDmon-Adjust-Makefile.patch 0007-DRBDmon-Version-V1R4M1.patch 0008-drbdadm-add-proxy-options-to-add-connection-command.patch 0009-Do-not-hardcode-paths-in-services-and-scripts.patch 0010-Fix-typo-in-warning-there-is-no-po4a-translage-comma.patch 0011-drbd.ocf-explicitly-timeout-crm_master-IPC-early.patch 0012-drbd.ocf-the-text-output-of-crm_resource-locate-has-.patch drbd-utils-9.29.0.tar.gz BETA DEBUG BEGIN: Old: * remove patches which are already included in upstream code: 0001-drbdadm-v9-do-not-segfault-when-re-configuring-proxy.patch 0002-user-drbrdmon-add-missing-stdint.h-includes.patch Old: 0001-drbdadm-v9-do-not-segfault-when-re-configuring-proxy.patch 0002-user-drbrdmon-add-missing-stdint.h-includes.patch 0003-Introduce-default_types.h-header.patch Old: 0002-user-drbrdmon-add-missing-stdint.h-includes.patch 0003-Introduce-default_types.h-header.patch bsc-1219263_crm-fence-peer.9.sh-fix-parsing-in_ccm-crmd-fields-o.patch Old: 0003-Introduce-default_types.h-header.patch bsc-1219263_crm-fence-peer.9.sh-fix-parsing-in_ccm-crmd-fields-o.patch bsc-1219263_crm-fence-peer.9.sh-use-join-of-node_state-to-judge-.patch Old: bsc-1219263_crm-fence-peer.9.sh-fix-parsing-in_ccm-crmd-fields-o.patch bsc-1219263_crm-fence-peer.9.sh-use-join-of-node_state-to-judge-.patch bsc-1233273_drbd.ocf-update-regex-of-sed-for-new-output-from-crm.patch Old: bsc-1219263_crm-fence-peer.9.sh-use-join-of-node_state-to-judge-.patch bsc-1233273_drbd.ocf-update-regex-of-sed-for-new-output-from-crm.patch usrmerge_move_lib_to_prefix_lib.patch Old: bsc-1233273_drbd.ocf-update-regex-of-sed-for-new-output-from-crm.patch usrmerge_move_lib_to_prefix_lib.patch BETA DEBUG END: BETA DEBUG BEGIN: New: * add upstream patches to align commit 0a014f290802: 0001-drbd-verify.py-relax-host-key-checking.patch 0002-DRBDmon-Disabled-DRBD-commands-warning-only-for-actu.patch New: 0001-drbd-verify.py-relax-host-key-checking.patch 0002-DRBDmon-Disabled-DRBD-commands-warning-only-for-actu.patch 0003-DRBDmon-Integrate-global-local-command-delegation.patch New: 0002-DRBDmon-Disabled-DRBD-commands-warning-only-for-actu.patch 0003-DRBDmon-Integrate-global-local-command-delegation.patch 0004-DRBDmon-Adjust-events-log-supplier-program-name.patch New: 0003-DRBDmon-Integrate-global-local-command-delegation.patch 0004-DRBDmon-Adjust-events-log-supplier-program-name.patch 0005-DRBDmon-Add-drbd-events-log-supplier.patch New: 0004-DRBDmon-Adjust-events-log-supplier-program-name.patch 0005-DRBDmon-Add-drbd-events-log-supplier.patch 0006-DRBDmon-Adjust-Makefile.patch New: 0005-DRBDmon-Add-drbd-events-log-supplier.patch 0006-DRBDmon-Adjust-Makefile.patch 0007-DRBDmon-Version-V1R4M1.patch New: 0006-DRBDmon-Adjust-Makefile.patch 0007-DRBDmon-Version-V1R4M1.patch 0008-drbdadm-add-proxy-options-to-add-connection-command.patch New: 0007-DRBDmon-Version-V1R4M1.patch 0008-drbdadm-add-proxy-options-to-add-connection-command.patch 0009-Do-not-hardcode-paths-in-services-and-scripts.patch New: 0008-drbdadm-add-proxy-options-to-add-connection-command.patch 0009-Do-not-hardcode-paths-in-services-and-scripts.patch 0010-Fix-typo-in-warning-there-is-no-po4a-translage-comma.patch New: 0009-Do-not-hardcode-paths-in-services-and-scripts.patch 0010-Fix-typo-in-warning-there-is-no-po4a-translage-comma.patch 0011-drbd.ocf-explicitly-timeout-crm_master-IPC-early.patch New: 0010-Fix-typo-in-warning-there-is-no-po4a-translage-comma.patch 0011-drbd.ocf-explicitly-timeout-crm_master-IPC-early.patch 0012-drbd.ocf-the-text-output-of-crm_resource-locate-has-.patch New: 0011-drbd.ocf-explicitly-timeout-crm_master-IPC-early.patch 0012-drbd.ocf-the-text-output-of-crm_resource-locate-has-.patch BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ drbd-utils.spec ++++++ --- /var/tmp/diff_new_pack.PK99bZ/_old 2025-01-09 15:11:27.350302410 +0100 +++ /var/tmp/diff_new_pack.PK99bZ/_new 2025-01-09 15:11:27.354302577 +0100 @@ -1,7 +1,7 @@ # # spec file for package drbd-utils # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,7 +16,7 @@ # -%define services drbd.service drbd-lvchange@.service drbd-promote@.service drbd-demote-or-escalate@.service drbd-reconfigure-suspend-or-error@.service drbd-services@.target drbd-wait-promotable@.service drbd@.service drbd@.target ocf.ra@.service +%define services drbd.service drbd-graceful-shutdown.service drbd-lvchange@.service drbd-promote@.service drbd-demote-or-escalate@.service drbd-reconfigure-suspend-or-error@.service drbd-services@.target drbd-wait-promotable@.service drbd@.service drbd@.target ocf.ra@.service %if 0%{?suse_version} < 1550 # for SLEs %define sbindir /sbin @@ -32,7 +32,7 @@ # Only need po4a to build man from git source code %bcond_without prebuiltman Name: drbd-utils -Version: 9.25.0 +Version: 9.29.0 Release: 0 Summary: Distributed Replicated Block Device License: GPL-2.0-or-later @@ -43,23 +43,28 @@ ############################################# # Upstream patches -Patch0001: 0001-drbdadm-v9-do-not-segfault-when-re-configuring-proxy.patch -Patch0002: 0002-user-drbrdmon-add-missing-stdint.h-includes.patch -Patch0003: 0003-Introduce-default_types.h-header.patch +Patch0001: 0001-drbd-verify.py-relax-host-key-checking.patch +Patch0002: 0002-DRBDmon-Disabled-DRBD-commands-warning-only-for-actu.patch +Patch0003: 0003-DRBDmon-Integrate-global-local-command-delegation.patch +Patch0004: 0004-DRBDmon-Adjust-events-log-supplier-program-name.patch +Patch0005: 0005-DRBDmon-Add-drbd-events-log-supplier.patch +Patch0006: 0006-DRBDmon-Adjust-Makefile.patch +Patch0007: 0007-DRBDmon-Version-V1R4M1.patch +Patch0008: 0008-drbdadm-add-proxy-options-to-add-connection-command.patch +Patch0009: 0009-Do-not-hardcode-paths-in-services-and-scripts.patch +Patch0010: 0010-Fix-typo-in-warning-there-is-no-po4a-translage-comma.patch +Patch0011: 0011-drbd.ocf-explicitly-timeout-crm_master-IPC-early.patch +Patch0012: 0012-drbd.ocf-the-text-output-of-crm_resource-locate-has-.patch # SUSE specific patches Patch1001: init-script-fixes.diff -Patch1002: usrmerge_move_lib_to_prefix_lib.patch -Patch1003: fence-after-pacemaker-down.patch -Patch1004: bsc-1032142_Disable-quorum-in-default-configuration.patch -Patch1005: move_fencing_from_disk_to_net_in_example.patch -Patch1006: pie-fix.patch -Patch1007: bsc-1219263_crm-fence-peer.9.sh-fix-parsing-in_ccm-crmd-fields-o.patch -Patch1008: bsc-1219263_crm-fence-peer.9.sh-use-join-of-node_state-to-judge-.patch -Patch1009: bsc-1233273_drbd.ocf-replace-crm_master-with-ocf_promotion_score.patch -Patch1010: bsc-1233273_drbd.ocf-update-regex-of-sed-for-new-output-from-crm.patch -Patch1011: bsc-1233273_drbd.ocf-update-for-OCF-1.1.patch -Patch1099: rpmlint-build-error.patch +Patch1002: fence-after-pacemaker-down.patch +Patch1003: bsc-1032142_Disable-quorum-in-default-configuration.patch +Patch1004: move_fencing_from_disk_to_net_in_example.patch +Patch1005: pie-fix.patch +Patch1006: bsc-1233273_drbd.ocf-replace-crm_master-with-ocf_promotion_score.patch +Patch1007: bsc-1233273_drbd.ocf-update-for-OCF-1.1.patch +Patch1008: rpmlint-build-error.patch ############################################# Provides: drbd-bash-completion = %{version} @@ -214,6 +219,7 @@ %{sbindir}/drbdmeta %if %{with drbdmon} %{sbindir}/drbdmon +%{sbindir}/drbd-events-log-supplier %endif %ifarch %{ix86} x86_64 %dir %attr(700,root,root) %{_sysconfdir}/xen @@ -225,6 +231,7 @@ %{_prefix}/lib/ocf/resource.d/linbit/drbd.shellfuncs.sh %{_udevrulesdir}/65-drbd.rules %{_unitdir}/drbd.service +%{_unitdir}/drbd-graceful-shutdown.service %{_unitdir}/drbd-lvchange@.service %{_unitdir}/drbd-promote@.service %{_unitdir}/drbd-demote-or-escalate@.service ++++++ 0001-drbd-verify.py-relax-host-key-checking.patch ++++++ From c72edcfbb0ec0ea587dd75be7c8fa5a407380ab4 Mon Sep 17 00:00:00 2001 From: Philipp Reisner <philipp.reisner@linbit.com> Date: Mon, 4 Nov 2024 18:03:22 +0100 Subject: [PATCH 01/12] drbd-verify.py: relax host key checking --- scripts/drbd-verify.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/drbd-verify.py b/scripts/drbd-verify.py index 3699a1687fa4..4232cd911ecc 100755 --- a/scripts/drbd-verify.py +++ b/scripts/drbd-verify.py @@ -8,6 +8,7 @@ import sys import re import os +ssh_opts = ['-oStrictHostKeyChecking=no'] events_re = re.compile(r'change peer-device name:(\S+) peer-node-id:(\d+) conn-name:(\S+) volume:0 replication:(\w+)->(\w+)') progress_re = re.compile(r'change peer-device name:(\S+) peer-node-id:(\d+) conn-name:(\S+) volume:0 done:(\d+\.\d+)') @@ -103,7 +104,7 @@ def verify_res(res_json, peers, mbr_only: bool, level2:bool): if len(diskful_peers) >= 1: for i, peer_json in enumerate(diskful_peers): peer_name = peer_json['name'] - args = ['ssh', peer_name, '/tmp/' + this_prog_name, '--json'] + args = ['ssh'] + ssh_opts + [peer_name, '/tmp/' + this_prog_name, '--json'] args += ['--resource', res_name, '--level2'] peers = [p['name'] for j, p in enumerate(diskful_peers) if j > i] if peers: @@ -114,7 +115,7 @@ def verify_res(res_json, peers, mbr_only: bool, level2:bool): if level2: continue args.append('--mbr-only') - subprocess.run(['scp', '-q', this_prog_path, '{}:/tmp/'.format(peer_name)]) + subprocess.run(['scp'] + ssh_opts + ['-q', this_prog_path, '{}:/tmp/'.format(peer_name)]) with subprocess.Popen(args, stdout=subprocess.PIPE) as p: peer_result = json.load(p.stdout) result_json['oos'].update(peer_result[res_name]['oos']) -- 2.43.0 ++++++ 0002-DRBDmon-Disabled-DRBD-commands-warning-only-for-actu.patch ++++++ From b37e33525eeff89d03cd6b98862d15f90aee7e15 Mon Sep 17 00:00:00 2001 From: Robert Altnoeder <robert.altnoeder@linbit.com> Date: Fri, 26 Jul 2024 08:35:09 +0200 Subject: [PATCH 02/12] DRBDmon: Disabled DRBD commands warning only for actual DRBD commands --- user/drbdmon/terminal/DrbdCommandsImpl.cpp | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/user/drbdmon/terminal/DrbdCommandsImpl.cpp b/user/drbdmon/terminal/DrbdCommandsImpl.cpp index 8b75a2aae8a7..006234f70df6 100644 --- a/user/drbdmon/terminal/DrbdCommandsImpl.cpp +++ b/user/drbdmon/terminal/DrbdCommandsImpl.cpp @@ -83,10 +83,10 @@ DrbdCommandsImpl::~DrbdCommandsImpl() noexcept bool DrbdCommandsImpl::execute_command(const std::string& command, StringTokenizer& tokenizer) { bool processed = false; - if (dsp_comp_hub.enable_drbd_actions) + Entry* const cmd_entry = cmd_map->get(&command); + if (cmd_entry != nullptr) { - Entry* const cmd_entry = cmd_map->get(&command); - if (cmd_entry != nullptr) + if (dsp_comp_hub.enable_drbd_actions) { cmd_func_type cmd_func = cmd_entry->cmd_func; try @@ -109,16 +109,18 @@ bool DrbdCommandsImpl::execute_command(const std::string& command, StringTokeniz ); } } + else + { + const uint64_t msg_id = dsp_comp_hub.log->add_entry( + MessageLog::log_level::WARN, + "DRBD commands are currently disabled" + ); + dsp_comp_hub.dsp_shared->message_id = msg_id; + dsp_comp_hub.dsp_selector->switch_to_display(DisplayId::display_page::MSG_VIEWER); + } + } - else - { - const uint64_t msg_id = dsp_comp_hub.log->add_entry( - MessageLog::log_level::WARN, - "DRBD commands are currently disabled" - ); - dsp_comp_hub.dsp_shared->message_id = msg_id; - dsp_comp_hub.dsp_selector->switch_to_display(DisplayId::display_page::MSG_VIEWER); - } + return processed; } -- 2.43.0 ++++++ 0003-DRBDmon-Integrate-global-local-command-delegation.patch ++++++ From 1053b3344c85646bbfbc59233a3d502183c3ea65 Mon Sep 17 00:00:00 2001 From: Robert Altnoeder <robert.altnoeder@linbit.com> Date: Fri, 26 Jul 2024 08:37:09 +0200 Subject: [PATCH 03/12] DRBDmon: Integrate global/local command delegation --- user/drbdmon/terminal/DisplayCommon.h | 12 +++++----- user/drbdmon/terminal/DisplayCommonImpl.cpp | 20 ++++++++++------- user/drbdmon/terminal/DisplayCommonImpl.h | 8 +++++-- user/drbdmon/terminal/MDspBase.cpp | 25 +++------------------ 4 files changed, 28 insertions(+), 37 deletions(-) diff --git a/user/drbdmon/terminal/DisplayCommon.h b/user/drbdmon/terminal/DisplayCommon.h index 9160c3ddb215..b1b94e43e51f 100644 --- a/user/drbdmon/terminal/DisplayCommon.h +++ b/user/drbdmon/terminal/DisplayCommon.h @@ -2,6 +2,7 @@ #define DISPLAYCOMMON_H #include <default_types.h> +#include <terminal/ModularDisplay.h> class DisplayCommon { @@ -16,9 +17,7 @@ class DisplayCommon enum command_state_type : uint8_t { INPUT = 0, - CANCEL = 1, - CMD_LOCAL = 2, - CMD_GLOBAL = 3 + CANCEL = 1 }; virtual ~DisplayCommon() noexcept @@ -47,9 +46,12 @@ class DisplayCommon virtual void display_problem_mode_label(const bool using_problem_mode) const = 0; virtual problem_mode_type get_problem_mode() const noexcept = 0; virtual void toggle_problem_mode() noexcept = 0; - virtual command_state_type command_line_key_pressed(const uint32_t key) const = 0; + virtual command_state_type command_line_key_pressed( + const uint32_t key, + ModularDisplay& display + ) const = 0; virtual void activate_command_line() const = 0; - virtual bool global_command() const = 0; + virtual bool execute_command(ModularDisplay& display) const = 0; virtual void application_idle() const = 0; virtual void application_working() const = 0; }; diff --git a/user/drbdmon/terminal/DisplayCommonImpl.cpp b/user/drbdmon/terminal/DisplayCommonImpl.cpp index 8427b2fc46a0..f3ceed782e02 100644 --- a/user/drbdmon/terminal/DisplayCommonImpl.cpp +++ b/user/drbdmon/terminal/DisplayCommonImpl.cpp @@ -706,7 +706,10 @@ void DisplayCommonImpl::toggle_problem_mode() noexcept } } -DisplayCommon::command_state_type DisplayCommonImpl::command_line_key_pressed(const uint32_t key) const +DisplayCommon::command_state_type DisplayCommonImpl::command_line_key_pressed( + const uint32_t key, + ModularDisplay& display +) const { DisplayCommon::command_state_type state = DisplayCommon::command_state_type::INPUT; if (key == KeyCodes::FUNC_12) @@ -717,11 +720,8 @@ DisplayCommon::command_state_type DisplayCommonImpl::command_line_key_pressed(co else if (key == KeyCodes::ENTER) { - state = DisplayCommon::command_state_type::CMD_LOCAL; - if (global_command()) - { - state = DisplayCommon::command_state_type::CMD_GLOBAL; - } + const bool processed = execute_command(display); + state = processed ? DisplayCommon::command_state_type::CANCEL : DisplayCommon::command_state_type::INPUT; } else { @@ -834,7 +834,7 @@ void DisplayCommonImpl::activate_command_line() const } } -bool DisplayCommonImpl::global_command() const +bool DisplayCommonImpl::execute_command(ModularDisplay& display) const { bool processed = false; const std::string& command = dsp_comp_hub.command_line->get_text(); @@ -859,7 +859,11 @@ bool DisplayCommonImpl::global_command() const processed = dsp_comp_hub.global_cmd_exec->execute_command(upper_keyword, tokenizer); if (!processed) { - processed = dsp_comp_hub.drbd_cmd_exec->execute_command(upper_keyword, tokenizer); + processed = display.execute_command(upper_keyword, tokenizer); + if (!processed) + { + processed = dsp_comp_hub.drbd_cmd_exec->execute_command(upper_keyword, tokenizer); + } } } } diff --git a/user/drbdmon/terminal/DisplayCommonImpl.h b/user/drbdmon/terminal/DisplayCommonImpl.h index 1ac7fafa6f96..8e09bfbe1eb7 100644 --- a/user/drbdmon/terminal/DisplayCommonImpl.h +++ b/user/drbdmon/terminal/DisplayCommonImpl.h @@ -3,6 +3,7 @@ #include <default_types.h> #include <terminal/DisplayCommon.h> +#include <terminal/ModularDisplay.h> #include <terminal/DisplayIo.h> #include <terminal/ComponentsHub.h> #include <string> @@ -35,9 +36,12 @@ class DisplayCommonImpl : public DisplayCommon virtual void display_problem_mode_label(const bool using_problem_mode) const override; virtual problem_mode_type get_problem_mode() const noexcept; virtual void toggle_problem_mode() noexcept; - virtual DisplayCommon::command_state_type command_line_key_pressed(const uint32_t key) const; + virtual command_state_type command_line_key_pressed( + const uint32_t key, + ModularDisplay& display + ) const override; virtual void activate_command_line() const; - virtual bool global_command() const override; + virtual bool execute_command(ModularDisplay& display) const override; virtual void application_idle() const override; virtual void application_working() const override; diff --git a/user/drbdmon/terminal/MDspBase.cpp b/user/drbdmon/terminal/MDspBase.cpp index 77bc86af6160..f95d3a21ac7f 100644 --- a/user/drbdmon/terminal/MDspBase.cpp +++ b/user/drbdmon/terminal/MDspBase.cpp @@ -176,29 +176,10 @@ bool MDspBase::key_pressed(const uint32_t key) else if (base_input_mode == base_input_mode_type::COMMAND) { - const DisplayCommon::command_state_type state = dsp_comp_hub.dsp_common->command_line_key_pressed(key); - bool exit_cmd_mode = false; - if (state == DisplayCommon::command_state_type::CMD_LOCAL) - { - StringTokenizer tokenizer(dsp_comp_hub.command_line->get_text(), DisplayConsts::CMD_TOKEN_DELIMITER); - if (tokenizer.has_next()) - { - std::string keyword(tokenizer.next()); - if (keyword.length() >= 2) - { - keyword.erase(0, 1); - std::string upper_keyword = string_transformations::uppercase_copy_of(keyword); - exit_cmd_mode = execute_command(upper_keyword, tokenizer); - } - } - } - else + const DisplayCommon::command_state_type state = dsp_comp_hub.dsp_common->command_line_key_pressed( + key, *this + ); if (state != DisplayCommon::command_state_type::INPUT) - { - exit_cmd_mode = true; - } - - if (exit_cmd_mode) { base_input_mode = base_input_mode_type::GLOBAL_KEYS; dsp_comp_hub.dsp_io->write_text(dsp_comp_hub.ansi_ctl->ANSI_CURSOR_OFF.c_str()); -- 2.43.0 ++++++ 0004-DRBDmon-Adjust-events-log-supplier-program-name.patch ++++++ From 4ecb776ed6b75d326624281b50f0a11adeca2e58 Mon Sep 17 00:00:00 2001 From: Robert Altnoeder <robert.altnoeder@linbit.com> Date: Wed, 20 Nov 2024 18:44:19 +0100 Subject: [PATCH 04/12] DRBDmon: Adjust events log supplier program name --- user/drbdmon/subprocess/EventsSourceSpawner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/drbdmon/subprocess/EventsSourceSpawner.cpp b/user/drbdmon/subprocess/EventsSourceSpawner.cpp index 20fa13bec0d8..1b50aa23b6d6 100644 --- a/user/drbdmon/subprocess/EventsSourceSpawner.cpp +++ b/user/drbdmon/subprocess/EventsSourceSpawner.cpp @@ -21,7 +21,7 @@ const char* const EventsSourceSpawner::EVENTS_PROGRAM_ARGS[] = "all", nullptr }; -const char* const EventsSourceSpawner::SAVED_EVENTS_PROGRAM = "eventsfeeder"; +const char* const EventsSourceSpawner::SAVED_EVENTS_PROGRAM = "drbd-events-log-supplier"; EventsSourceSpawner::EventsSourceSpawner(MessageLog& logRef): log(logRef) -- 2.43.0 ++++++ 0005-DRBDmon-Add-drbd-events-log-supplier.patch ++++++ From 60c3ed545e1c36de25545656f5c6c586e548b852 Mon Sep 17 00:00:00 2001 From: Robert Altnoeder <robert.altnoeder@linbit.com> Date: Wed, 20 Nov 2024 18:44:41 +0100 Subject: [PATCH 05/12] DRBDmon: Add drbd-events-log-supplier --- user/drbdmon/drbd-events-log-supplier.cpp | 147 ++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 user/drbdmon/drbd-events-log-supplier.cpp diff --git a/user/drbdmon/drbd-events-log-supplier.cpp b/user/drbdmon/drbd-events-log-supplier.cpp new file mode 100644 index 000000000000..9fe48f0ccd71 --- /dev/null +++ b/user/drbdmon/drbd-events-log-supplier.cpp @@ -0,0 +1,147 @@ +#include <cstddef> +#include <iostream> +#include <fstream> +#include <string> + +extern "C" +{ + #include <unistd.h> +} + +constexpr int ERR_OUT_OF_MEMORY = 2; +constexpr int ERR_IO = 3; + +const std::string INIT_STATE_SEPA("exists -"); +const size_t INIT_STATE_SEPA_LENGTH = INIT_STATE_SEPA.length(); + +int process_events(const std::string& path); +bool is_init_state_sepa(const std::string& event_line); + +/** + * DRBD events log file supplier for DRBDmon + */ +int main(int argc, char* argv[]) +{ + int exit_code = EXIT_FAILURE; + + try + { + if (argc == 2) + { + std::string path(argv[1]); + exit_code = process_events(path); + } + else + { + std::cerr << "DRBD Events Log File Supplier | Arguments:\n" << + " path .......... Path to a file containing DBRD event lines\n"; + } + } + catch (std::bad_alloc&) + { + std::cerr << "Out of memory" << std::endl; + exit_code = ERR_OUT_OF_MEMORY; + } + + std::cout << std::flush; + std::cerr << std::flush; + + return exit_code; +} + +/** + * Emits event lines from an events log file and appends the initial state separator + * if it is absent from the file. The output is stdout, which DRBDmon pipes to itself. + * + * DRBDmon recovers its events source process by respawning it if it exits for any reason. + * Therefore, this method does not return if successful, instead, it will + * suspend indefinitely. DRBDmon will terminate this process when the user exits DRBDmon. + */ +int process_events(const std::string& path) +{ + int rc = ERR_IO; + + // Internal pipe used for suspending execution + int pipe_fd[2]; + int pipe_rc = pipe(pipe_fd); + if (pipe_rc == 0) + { + std::ifstream in_file(path); + if (in_file.good()) + { + bool have_init_state_sepa = false; + + // Emit events from the file to DRBDmon + std::string event_line; + while (in_file.good()) + { + std::getline(in_file, event_line); + if (event_line.length() > 0) + { + std::cout << event_line << '\n'; + } + if (is_init_state_sepa(event_line)) + { + have_init_state_sepa = true; + } + + event_line.clear(); + } + + if (in_file.eof()) + { + // If there was no initial state separator in the events log file, + // emit one to DRBDmon + if (!have_init_state_sepa) + { + std::cout << INIT_STATE_SEPA << '\n'; + } + std::cout << std::flush; + + rc = EXIT_SUCCESS; + + // Suspend execution indefinitely. DRBDmon will terminate this process when it exits. + char in_char = 0; + const ssize_t read_count = read(pipe_fd[0], &in_char, 1); + // Nothing to do with that result... + static_cast<void> (read_count); + } + else + { + // I/O failed before the entire file was processed, I/O error. + std::cerr << "I/O error while reading DRBD events file \"" << path << "\"\n"; + } + } + else + { + // Cannot open/read the file. Typically a non-existent path/file or permissions problem. + std::cerr << "I/O error, cannot read DRBD events file \"" << path << "\"\n"; + } + } + else + { + // Cannot create the pipe used for suspending. + // Typically a resource exhaustion problem, e.g. the OS being out of memory. + std::cerr << "I/O error, pipe creation failed\n"; + } + + return rc; +} + +/** + * Checks whether an events line is the initial state separator + */ +bool is_init_state_sepa(const std::string& event_line) +{ + bool result = false; + if (event_line.length() >= INIT_STATE_SEPA_LENGTH) + { + size_t idx = 0; + while (idx < INIT_STATE_SEPA_LENGTH && event_line[idx] == INIT_STATE_SEPA[idx]) + { + ++idx; + } + result = idx == INIT_STATE_SEPA_LENGTH; + } + return result; +} -- 2.43.0 ++++++ 0006-DRBDmon-Adjust-Makefile.patch ++++++ From 5611462e6e157e23e9571bfd364cb22ec17b91b6 Mon Sep 17 00:00:00 2001 From: Robert Altnoeder <robert.altnoeder@linbit.com> Date: Wed, 20 Nov 2024 18:45:11 +0100 Subject: [PATCH 06/12] DRBDmon: Adjust Makefile --- drbd.spec.in | 1 + user/drbdmon/Makefile.in | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drbd.spec.in b/drbd.spec.in index 0205776f2618..9559e2950e13 100644 --- a/drbd.spec.in +++ b/drbd.spec.in @@ -155,6 +155,7 @@ This packages includes the DRBD administration tools. %endif %if %{with drbdmon} %{_sbindir}/drbdmon +%{_sbindir}/drbd-events-log-supplier %endif %if "%{initscripttype}" == "sysv" %{_initddir}/drbd diff --git a/user/drbdmon/Makefile.in b/user/drbdmon/Makefile.in index 36673b19c857..9c5427e9b22a 100644 --- a/user/drbdmon/Makefile.in +++ b/user/drbdmon/Makefile.in @@ -16,7 +16,7 @@ else DESTDIR ?= / endif -binaries := drbdmon +binaries := drbdmon drbd-events-log-supplier ifeq ($(WITH_DRBDMON),yes) all: $(binaries) @@ -28,6 +28,7 @@ PHONY := all dsaext-obj := cppdsaext/src/dsaext.o integerparse-obj := cppdsaext/src/integerparse.o +supplier-obj := drbd-events-log-supplier.o l-obj := DrbdMon.o DrbdMonConsts.o MessageLog.o IntervalTimer.o SubProcessNotification.o l-obj += MessageLogNotification.o @@ -77,6 +78,9 @@ $(integerparse-obj): $(basename $(integerparse-obj)).cpp $(basename $(integerpar drbdmon: $(ls-obj) $(CXX) -o $@ $(CPPFLAGS) $(CXXFLAGS) $^ $(LIBS) +drbd-events-log-supplier: $(supplier-obj) + $(CXX) -o $@ $(CPPFLAGS) $(CXXFLAGS) $^ + # do not try to rebuild Makefile itself Makefile: ; @@ -89,16 +93,18 @@ Makefile: ; install: ifeq ($(WITH_DRBDMON),yes) install -m 755 drbdmon $(DESTDIR)$(sbindir) + install -m 755 drbd-events-log-supplier $(DESTDIR)$(sbindir) endif uninstall: ifeq ($(WITH_DRBDMON),yes) rm -f $(DESTDIR)$(sbindir)/drbdmon + rm -r $(DESTDIR)$(sbindir)/drbd-events-log-supplier endif PHONY += clean distclean clean: - rm -f $(local-obj) $(dsaext-obj) $(integerparse-obj) $(binaries) + rm -f $(local-obj) $(dsaext-obj) $(integerparse-obj) $(supplier-obj) $(binaries) distclean: clean rm -f $(local-dep) -- 2.43.0 ++++++ 0007-DRBDmon-Version-V1R4M1.patch ++++++ From 17c3bc04145900b0039a686b4e2cc28f9d5f3859 Mon Sep 17 00:00:00 2001 From: Robert Altnoeder <robert.altnoeder@linbit.com> Date: Mon, 4 Nov 2024 19:13:46 +0100 Subject: [PATCH 07/12] DRBDmon: Version V1R4M1 --- user/drbdmon/DrbdMonConsts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/drbdmon/DrbdMonConsts.cpp b/user/drbdmon/DrbdMonConsts.cpp index 6b130db93156..5135d636bd2a 100644 --- a/user/drbdmon/DrbdMonConsts.cpp +++ b/user/drbdmon/DrbdMonConsts.cpp @@ -7,6 +7,6 @@ extern "C" } const std::string DrbdMonConsts::PROGRAM_NAME = "DRBDmon"; -const std::string DrbdMonConsts::PROJECT_VERSION = "V1R4M0"; +const std::string DrbdMonConsts::PROJECT_VERSION = "V1R4M1"; const std::string DrbdMonConsts::UTILS_VERSION = PACKAGE_VERSION; const std::string DrbdMonConsts::BUILD_HASH = GITHASH; -- 2.43.0 ++++++ 0008-drbdadm-add-proxy-options-to-add-connection-command.patch ++++++ From 9dab78b5822d59a13e767ef20fdffab46f79cb25 Mon Sep 17 00:00:00 2001 From: Joel Colledge <joel.colledge@linbit.com> Date: Thu, 21 Nov 2024 09:55:26 +0100 Subject: [PATCH 08/12] drbdadm: add proxy options to 'add connection' command Some options such as rcvbuf-size must be set before attempting to connect. Proxy v3 used ugly hacks to allow time for the options to arrive before connecting. Proxy v4 does not use this approach. Instead it requires the options to be set on the command line for 'add connection'. The additional options are ignored by Proxy v3 with a "trailing garbage" warning. We continue to set the properties using 'set' commands as well to retain compatibility with Proxy v3. Proxy v4 ignores 'set' commands which do not change the value of the option. So this is compatible with Proxy v3 and v4. --- user/v9/drbdadm_main.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/user/v9/drbdadm_main.c b/user/v9/drbdadm_main.c index 74cf60365a6d..a983a9463fb8 100644 --- a/user/v9/drbdadm_main.c +++ b/user/v9/drbdadm_main.c @@ -2043,19 +2043,33 @@ char *_proxy_connection_name(char *conn_name, const struct d_resource *res, cons return conn_name; } +#define ADD_CONNECTION_MAX_LEN 4096 + static int do_proxy_conn_up(const struct cfg_ctx *ctx) { const char *argv[4] = { drbd_proxy_ctl, "-c", NULL, NULL }; struct connection *conn = ctx->conn; struct path *path = STAILQ_FIRST(&conn->paths); /* multiple paths via proxy, later! */ char *conn_name; + char *buffer; + char *buffer_pos; + int buffer_remaining; + int n; + struct d_option *opt; + int rv = -1; if (!path->my_proxy || !path->peer_proxy) return 0; conn_name = proxy_connection_name(ctx->res, conn); - argv[2] = ssprintf( + buffer_remaining = ADD_CONNECTION_MAX_LEN; + buffer = checked_malloc(buffer_remaining); + buffer_pos = buffer; + + n = snprintf( + buffer_pos, + buffer_remaining, "add connection %s %s:%s %s:%s %s:%s %s:%s", conn_name, path->my_proxy->inside.addr, @@ -2066,8 +2080,28 @@ static int do_proxy_conn_up(const struct cfg_ctx *ctx) path->my_proxy->outside.port, path->my_address->addr, path->my_address->port); + if (n < 0 || n >= buffer_remaining) + goto out; + buffer_pos += n; + buffer_remaining -= n; - return m_system_ex(argv, SLEEPS_SHORT, ctx->res->name); + STAILQ_FOREACH(opt, &path->my_proxy->options, link) { + n = snprintf( + buffer_pos, + buffer_remaining, + " --%s=%s", + opt->name, opt->value); + if (n < 0 || n >= buffer_remaining) + goto out; + buffer_pos += n; + buffer_remaining -= n; + } + + argv[2] = buffer; + rv = m_system_ex(argv, SLEEPS_SHORT, ctx->res->name); +out: + free(buffer); + return rv; } static int do_proxy_conn_plugins(const struct cfg_ctx *ctx) -- 2.43.0 ++++++ 0009-Do-not-hardcode-paths-in-services-and-scripts.patch ++++++ by heming.zhao@suse.com remove the patch of scripts/.gitignore for following complain msg: ``` + /usr/lib/rpm/rpmuncompress /usr/src/packages/SOURCES/0009-Do-not-hardcode-paths-in-services-and-scripts.patch + /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f The text leading up to this was: -------------------------- |diff --git a/scripts/.gitignore b/scripts/.gitignore |index a307904047f8..ba121127c341 100644 |--- a/scripts/.gitignore |+++ b/scripts/.gitignore -------------------------- No file to patch. Skipping patch. 1 out of 1 hunk ignored ``` From 080e93bd9bcf546cd3a9870ae1add2469a2a4e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Wanzenb=C3=B6ck?= <moritz.wanzenboeck@linbit.com> Date: Fri, 20 Sep 2024 10:30:24 +0200 Subject: [PATCH 09/12] Do not hardcode paths in services and scripts This fixes issues when drbd-utils get installed to non-standard locations. Since the autoconf generated Makefile should still allow override on install, we have to use a new target to do our own expansion. The implementation is lifted from the autconf manual: info autoconf "Installation Directory Variables" # Conflicts: # scripts/.gitignore # scripts/Makefile.in --- configure.ac | 2 +- scripts/.gitignore | 8 +++++++ scripts/Makefile.in | 23 +++++++++++++++---- ...ce => drbd-demote-or-escalate@.service.in} | 2 +- ...vice => drbd-graceful-shutdown.service.in} | 2 +- scripts/drbd-promote@.service.in | 4 ++-- ...-reconfigure-suspend-or-error@.service.in} | 4 ++-- ...ervice-shim.sh => drbd-service-shim.sh.in} | 18 +++++++-------- ...rvice => drbd-wait-promotable@.service.in} | 2 +- scripts/{drbd.service => drbd.service.in} | 6 ++--- scripts/{drbd@.service => drbd@.service.in} | 6 ++--- .../{ocf.ra@.service => ocf.ra@.service.in} | 4 ++-- 12 files changed, 51 insertions(+), 30 deletions(-) rename scripts/{drbd-demote-or-escalate@.service => drbd-demote-or-escalate@.service.in} (92%) rename scripts/{drbd-graceful-shutdown.service => drbd-graceful-shutdown.service.in} (88%) rename scripts/{drbd-reconfigure-suspend-or-error@.service => drbd-reconfigure-suspend-or-error@.service.in} (71%) rename scripts/{drbd-service-shim.sh => drbd-service-shim.sh.in} (81%) rename scripts/{drbd-wait-promotable@.service => drbd-wait-promotable@.service.in} (84%) rename scripts/{drbd.service => drbd.service.in} (80%) rename scripts/{drbd@.service => drbd@.service.in} (87%) rename scripts/{ocf.ra@.service => ocf.ra@.service.in} (85%) diff --git a/configure.ac b/configure.ac index cd166bbafbc0..630163cee103 100644 --- a/configure.ac +++ b/configure.ac @@ -525,7 +525,7 @@ fi dnl The configuration files we create (from their .in template) if test -z $SPECMODE; then - AC_CONFIG_FILES(Makefile user/shared/Makefile user/v9/Makefile user/v84/Makefile scripts/Makefile scripts/drbd.rules user/windrbd/Makefile user/drbdmon/Makefile documentation/common/Makefile_v84_com documentation/common/Makefile_v9_com) + AC_CONFIG_FILES(Makefile user/shared/Makefile user/v9/Makefile user/v84/Makefile scripts/Makefile user/windrbd/Makefile user/drbdmon/Makefile documentation/common/Makefile_v84_com documentation/common/Makefile_v9_com) AC_CONFIG_HEADERS(user/shared/config.h) else AC_CONFIG_FILES(drbd.spec) diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 7652ee872500..001d08da54e4 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -67,9 +67,20 @@ SYSTEMD_TEMPLATES += drbd-wait-promotable@.service SYSTEMD_UNITS = drbd.service SYSTEMD_UNITS += drbd-graceful-shutdown.service -SERVICE_TEMPLATES = drbd-promote@.service +UDEV_TEMPLATES = drbd.rules -TEMPLATES := $(SERVICE_TEMPLATES) +SERVICE_TEMPLATES = drbd.service +SERVICE_TEMPLATES += drbd@.service +SERVICE_TEMPLATES += drbd-demote-or-escalate@.service +SERVICE_TEMPLATES += drbd-graceful-shutdown.service +SERVICE_TEMPLATES += drbd-promote@.service +SERVICE_TEMPLATES += drbd-reconfigure-suspend-or-error@.service +SERVICE_TEMPLATES += drbd-wait-promotable@.service +SERVICE_TEMPLATES += ocf.ra@.service + +SCRIPT_TEMPLATES = drbd-service-shim.sh + +TEMPLATES := $(SCRIPT_TEMPLATES) $(SERVICE_TEMPLATES) $(UDEV_TEMPLATES) # variables meant to be overridden from the make command line ifeq ($(WITH_WINDRBD),yes) @@ -82,7 +93,7 @@ all: $(TEMPLATES) install: install-utils install-udev install-xen install-heartbeat install-pacemaker install-rgmanager install-bashcompletion -install-utils: $(SERVICE_TEMPLATES) +install-utils: $(SERVICE_TEMPLATES) $(SCRIPT_TEMPLATES) install -d $(DESTDIR)$(LIBDIR) # "sysv" or "both" ifeq ($(subst both,sysv,$(initscripttype)),sysv) @@ -172,7 +183,7 @@ ifeq ($(WITH_XEN),yes) install -m 755 block-drbd $(DESTDIR)$(sysconfdir)/xen/scripts endif -install-udev: +install-udev: $(UDEV_TEMPLATES) ifeq ($(WITH_UDEV),yes) mkdir -p $(DESTDIR)$(udevrulesdir) install -m 644 drbd.rules $(DESTDIR)$(udevrulesdir)/65-drbd.rules$(UDEV_RULE_SUFFIX) @@ -214,7 +225,9 @@ Makefile.in: ; Makefile: Makefile.in ../config.status cd .. && ./config.status scripts/Makefile -edit = sed -e '' +edit = sed -e '' \ + -e 's|@sbindir[@]|$(sbindir)|g' \ + -e 's|@libdir[@]|$(LIBDIR)|g' \ ifeq ($(SYSTEMD_EXEC_CONDITION),no) edit += -e 's|^ExecCondition=|ExecStart=|' diff --git a/scripts/drbd-demote-or-escalate@.service b/scripts/drbd-demote-or-escalate@.service.in similarity index 92% rename from scripts/drbd-demote-or-escalate@.service rename to scripts/drbd-demote-or-escalate@.service.in index 2093223847b4..f5e123199323 100644 --- a/scripts/drbd-demote-or-escalate@.service +++ b/scripts/drbd-demote-or-escalate@.service.in @@ -28,5 +28,5 @@ TimeoutSec=60 # "Type=forking" would be an option to have it retry a number of times, # and then only escalate to FailureAction if that did not help. Type=oneshot -ExecStart=/lib/drbd/scripts/drbd-service-shim.sh secondary-or-escalate %I +ExecStart=@libdir@/scripts/drbd-service-shim.sh secondary-or-escalate %I ExecStopPost=-/bin/journalctl --sync diff --git a/scripts/drbd-graceful-shutdown.service b/scripts/drbd-graceful-shutdown.service.in similarity index 88% rename from scripts/drbd-graceful-shutdown.service rename to scripts/drbd-graceful-shutdown.service.in index b6e8a149d051..6118d880d8fb 100644 --- a/scripts/drbd-graceful-shutdown.service +++ b/scripts/drbd-graceful-shutdown.service.in @@ -13,4 +13,4 @@ Before=drbd.service drbd@.service Type=oneshot RemainAfterExit=yes -ExecStop=/lib/drbd/scripts/drbd-service-shim.sh down all +ExecStop=@libdir@/scripts/drbd-service-shim.sh down all diff --git a/scripts/drbd-promote@.service.in b/scripts/drbd-promote@.service.in index 71345d9b723d..23e74c282250 100644 --- a/scripts/drbd-promote@.service.in +++ b/scripts/drbd-promote@.service.in @@ -24,5 +24,5 @@ RemainAfterExit=yes # (ab)using systemd features # if we cannot configure and promote, that's a condition, not a failure # See the comment above wrt. FailureAction vs OnFailure -ExecCondition=/lib/drbd/scripts/drbd-service-shim.sh primary %I -ExecStop=/lib/drbd/scripts/drbd-service-shim.sh secondary %I +ExecCondition=@libdir@/scripts/drbd-service-shim.sh primary %I +ExecStop=@libdir@/scripts/drbd-service-shim.sh secondary %I diff --git a/scripts/drbd-reconfigure-suspend-or-error@.service b/scripts/drbd-reconfigure-suspend-or-error@.service.in similarity index 71% rename from scripts/drbd-reconfigure-suspend-or-error@.service rename to scripts/drbd-reconfigure-suspend-or-error@.service.in index c0e59e5e72d3..6a0a2584e3a6 100644 --- a/scripts/drbd-reconfigure-suspend-or-error@.service +++ b/scripts/drbd-reconfigure-suspend-or-error@.service.in @@ -10,5 +10,5 @@ RefuseManualStop=yes SyslogIdentifier=drbd-%I Type=oneshot RemainAfterExit=yes -ExecStop=-/usr/sbin/drbdsetup resource-options --on-no-quorum io-error --on-no-data io-error %I -ExecStart=-/usr/sbin/drbdsetup resource-options --on-no-quorum suspend-io --on-no-data suspend-io %I +ExecStop=-@sbindir@/drbdsetup resource-options --on-no-quorum io-error --on-no-data io-error %I +ExecStart=-@sbindir@/drbdsetup resource-options --on-no-quorum suspend-io --on-no-data suspend-io %I diff --git a/scripts/drbd-service-shim.sh b/scripts/drbd-service-shim.sh.in similarity index 81% rename from scripts/drbd-service-shim.sh rename to scripts/drbd-service-shim.sh.in index 786387463891..56029bdcebe2 100755 --- a/scripts/drbd-service-shim.sh +++ b/scripts/drbd-service-shim.sh.in @@ -14,7 +14,7 @@ secondary_check() { local ex_secondary current_state opts opts="$1" - /usr/sbin/drbdsetup secondary $opts "$res" + @sbindir@/drbdsetup secondary $opts "$res" ex_secondary=$? case $ex_secondary in 0) @@ -26,7 +26,7 @@ secondary_check() { # any other special treatment for special exit codes? *) # double check for "resource does not exist" - current_state=$(/usr/sbin/drbdsetup events2 --now "$res") + current_state=$(@sbindir@/drbdsetup events2 --now "$res") if [[ $current_state = "exists -" ]]; then echo >&2 "<7>not even configured" return 0 @@ -40,23 +40,23 @@ secondary_check() { case "$cmd" in adjust) - exec /usr/sbin/drbdadm adjust "$res" + exec @sbindir@/drbdadm adjust "$res" ;; down) - exec /usr/sbin/drbdsetup down "$res" + exec @sbindir@/drbdsetup down "$res" ;; primary) - exec /usr/sbin/drbdsetup primary "$res" + exec @sbindir@/drbdsetup primary "$res" ;; secondary) - exec /usr/sbin/drbdsetup secondary "$res" + exec @sbindir@/drbdsetup secondary "$res" ;; secondary-force) - exec /usr/sbin/drbdsetup secondary --force=yes "$res" + exec @sbindir@/drbdsetup secondary --force=yes "$res" ;; secondary-secondary-force) - /usr/sbin/drbdsetup secondary "$res" && exit 0 - exec /usr/sbin/drbdsetup secondary --force=yes "$res" + @sbindir@/drbdsetup secondary "$res" && exit 0 + exec @sbindir@/drbdsetup secondary --force=yes "$res" ;; secondary*-or-escalate) # Log something and try to get journald to flush its logs diff --git a/scripts/drbd-wait-promotable@.service b/scripts/drbd-wait-promotable@.service.in similarity index 84% rename from scripts/drbd-wait-promotable@.service rename to scripts/drbd-wait-promotable@.service.in index 81c3789f5a4c..f416274839e9 100644 --- a/scripts/drbd-wait-promotable@.service +++ b/scripts/drbd-wait-promotable@.service.in @@ -10,7 +10,7 @@ Type=oneshot # on first start, wait for access to "good data" # let systemd handle timeouts -ExecStart=/lib/drbd/scripts/drbd-wait-promotable.sh %I +ExecStart=@libdir@/scripts/drbd-wait-promotable.sh %I RemainAfterExit=yes [Install] diff --git a/scripts/drbd.service b/scripts/drbd.service.in similarity index 80% rename from scripts/drbd.service rename to scripts/drbd.service.in index 96c599e75042..8bfeb17cb91d 100644 --- a/scripts/drbd.service +++ b/scripts/drbd.service.in @@ -12,11 +12,11 @@ RemainAfterExit=yes # A check for INIT_VERSION already exists, just set it to something. Environment=INIT_VERSION=systemd -ExecStart=/lib/drbd/scripts/drbd start -ExecStop=/lib/drbd/scripts/drbd stop +ExecStart=@libdir@/scripts/drbd start +ExecStop=@libdir@/scripts/drbd stop # Re-adjust everything on reload -ExecReload=/lib/drbd/scripts/drbd reload +ExecReload=@libdir@/scripts/drbd reload [Install] WantedBy=multi-user.target diff --git a/scripts/drbd@.service b/scripts/drbd@.service.in similarity index 87% rename from scripts/drbd@.service rename to scripts/drbd@.service.in index 0fad10be237e..ab1c044cdeb1 100644 --- a/scripts/drbd@.service +++ b/scripts/drbd@.service.in @@ -35,8 +35,8 @@ RemainAfterExit=yes # depends... do we want this as ExecCondition or as ExecStart # failed start is "failed", failed condition is just "not startable yet" -ExecStart=/lib/drbd/scripts/drbd-service-shim.sh adjust %I -ExecReload=/lib/drbd/scripts/drbd-service-shim.sh adjust %I +ExecStart=@libdir@/scripts/drbd-service-shim.sh adjust %I +ExecReload=@libdir@/scripts/drbd-service-shim.sh adjust %I # can only succeed, if you first stop all depending services -ExecStopPost=/lib/drbd/scripts/drbd-service-shim.sh down %I +ExecStopPost=@libdir@/scripts/drbd-service-shim.sh down %I diff --git a/scripts/ocf.ra@.service b/scripts/ocf.ra@.service.in similarity index 85% rename from scripts/ocf.ra@.service rename to scripts/ocf.ra@.service.in index 9c2268a615a7..4779706a8853 100644 --- a/scripts/ocf.ra@.service +++ b/scripts/ocf.ra@.service.in @@ -22,5 +22,5 @@ Environment=monitor_inverval=30 # Only the first argument is used by the wrapper, # the %n is just to identify which is which in the process list. # All parameterization is done via Environment= in per instance override.conf -ExecStart=/lib/drbd/scripts/ocf.ra.wrapper.sh start-and-monitor %n -ExecStopPost=/lib/drbd/scripts/ocf.ra.wrapper.sh stop %n +ExecStart=@libdir@/scripts/ocf.ra.wrapper.sh start-and-monitor %n +ExecStopPost=@libdir@/scripts/ocf.ra.wrapper.sh stop %n -- 2.43.0 ++++++ 0010-Fix-typo-in-warning-there-is-no-po4a-translage-comma.patch ++++++ From ee3ab4a67f15fadff72995e45defcbf1e944c9bd Mon Sep 17 00:00:00 2001 From: Ulf 'Tiggi' Tigerstedt <ulf.tigerstedt@csc.fi> Date: Mon, 16 Dec 2024 15:54:37 +0200 Subject: [PATCH 10/12] Fix typo in warning, there is no po4a-translage command --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 630163cee103..4377f3c24a08 100644 --- a/configure.ac +++ b/configure.ac @@ -332,7 +332,7 @@ else fi if test -z $PO4A_TRANSLATE; then - AC_MSG_WARN([Cannot build man pages without po4a-translage. You may safely ignore this warning when building from a tarball.]) + AC_MSG_WARN([Cannot build man pages without po4a-translate. You may safely ignore this warning when building from a tarball.]) dnl default to some sane value at least, dnl so the error message about command not found makes sense PO4A_TRANSLATE=po4a-translate -- 2.43.0 ++++++ 0011-drbd.ocf-explicitly-timeout-crm_master-IPC-early.patch ++++++ From 077a313e9fcacf0b12a35e8094bfdba6ac8aa0d4 Mon Sep 17 00:00:00 2001 From: Lars Ellenberg <lars.ellenberg@linbit.com> Date: Fri, 6 Dec 2024 15:31:01 +0100 Subject: [PATCH 11/12] drbd.ocf: explicitly timeout crm_master IPC early Some environments are notorious for timing out in crm_master one out of ten thousand times. You don't want to know the details. That would then cause a timeout on the monitor action, and pacemaker would feel the need to "recover" from "resource failure", spuriously restarting everything that depends on the DRBD resources. If we fail to update the "master score" in time, we can still report the operation result. The next monitor action will happen, and we get an other attempt at updating the master score. If that update was relevant, worst case it is now delayed. Better than the previous worst case, operation timeout interpreted as resource failure. --- scripts/drbd.ocf | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf index 1d051baa550d..c31858343ba4 100755 --- a/scripts/drbd.ocf +++ b/scripts/drbd.ocf @@ -53,6 +53,7 @@ # OCF_RESKEY_CRM_meta_master_max # OCF_RESKEY_CRM_meta_master_node_max # +# OCF_RESKEY_CRM_meta_timeout # OCF_RESKEY_CRM_meta_interval # # OCF_RESKEY_CRM_meta_notify @@ -515,22 +516,55 @@ if $USE_DEBUG_LOG ; then fi do_cmd_success_log_level="" -do_cmd() { +do_cmd() { __do_cmd_with_timeout "" "$@"; } +do_cmd_CRM_meta_timeout() +{ + local timeout=$(( ($OCF_RESKEY_CRM_meta_timeout - 500 - $SECONDS*1000) / 1000 )) + # if we are short on time already, + # try to get away with whatever time is left + (( timeout > 0 )) || timeout=0 + __do_cmd_with_timeout "$timeout" "$@"; +} +__do_cmd_with_timeout() { # Run a command, return its exit code, capture any output, and log # everything if appropriate. + # use coreutils "timeout", if timeout is != 0. + local timeout=$1; shift local cmd="$*" cmd_out cmd_err ret=125 local success_log_level=${do_cmd_success_log_level:-debug} local failure_log_level=${do_cmd_failure_log_level:-err} ocf_log debug "$DRBD_RESOURCE: Calling $cmd" + if [[ $timeout =~ ^[1-9][0-9]*$ ]]; then + timeout="-t $timeout" + else + timeout="" + fi + + local pipe + local pipe_pid + local result + # capture stdout, stderr, and exit code - eval "$(exec 3>&1; + if exec {pipe}< <(exec 3>&1; printf "cmd_err=%q\n" \ "$( exec 2>&1 1>&3 3>&-; \ out=$( "$@" ); \ ex=$?; \ printf "cmd_out=%q\nret=%q\n" "$out" "$ex" )" - )" + ) + then + pipe_pid=$! + + read -r -d "" -u $pipe $timeout result + if (( $? > 128 )) ; then + kill -KILL $pipe_pid + # wait $pipe_pid + fi + exec {pipe}<&- + + eval "$result" + fi if [ $ret != 0 ]; then ocf_log $failure_log_level "$DRBD_RESOURCE: Called $cmd" @@ -585,13 +619,13 @@ set_master_score() { if [[ $1 -le 0 ]]; then remove_master_score else - do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1 && + do_cmd_CRM_meta_timeout ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1 && current_master_score=$1 fi } remove_master_score() { - do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D + do_cmd_CRM_meta_timeout ${HA_SBIN_DIR}/crm_master -l reboot -D current_master_score="" } -- 2.43.0 ++++++ 0012-drbd.ocf-the-text-output-of-crm_resource-locate-has-.patch ++++++ From 0a014f290802e0221d06bb52a74c2e29f11ef02e Mon Sep 17 00:00:00 2001 From: Lars Ellenberg <lars.ellenberg@linbit.com> Date: Fri, 6 Dec 2024 15:35:58 +0100 Subject: [PATCH 12/12] drbd.ocf: the text output of "crm_resource --locate" has changed "Recent" Pacemaker reports "Promoted" instead of "Master" for promoted resources. Recognize that. This change was made quite a while ago, but the resource agent parameter remove_master_score_if_peer_primary=unexpected is little known and rarely in use, so no-one noticed. --- scripts/drbd.ocf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf index c31858343ba4..34d208f22dd5 100755 --- a/scripts/drbd.ocf +++ b/scripts/drbd.ocf @@ -1021,7 +1021,7 @@ crm_resource_locate_master() called_crm_resource_locate=true DRBD_PRIMARY_PEER_according_to_pcmk=$( crm_resource --resource "$OCF_RESOURCE_INSTANCE" --locate 2>/dev/null | - sed -ne 's/^.*is running on: \([^ ]*\) Master.*$/\1/p' | + sed -ne 's/^.*is running on: \([^ ]*\) \(Master\|Promoted\).*$/\1/p' | grep -vix -m1 -e "$HOSTNAME") } -- 2.43.0 ++++++ bsc-1233273_drbd.ocf-replace-crm_master-with-ocf_promotion_score.patch ++++++ --- /var/tmp/diff_new_pack.PK99bZ/_old 2025-01-09 15:11:27.534310033 +0100 +++ /var/tmp/diff_new_pack.PK99bZ/_new 2025-01-09 15:11:27.538310198 +0100 @@ -57,15 +57,15 @@ if [[ $1 -le 0 ]]; then remove_master_score else -- do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1 && -+ do_cmd ocf_promotion_score -Q -v $1 && +- do_cmd_CRM_meta_timeout ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1 && ++ do_cmd_CRM_meta_timeout ocf_promotion_score -Q -v $1 && current_master_score=$1 fi } remove_master_score() { -- do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D -+ do_cmd ocf_promotion_score -D +- do_cmd_CRM_meta_timeout ${HA_SBIN_DIR}/crm_master -l reboot -D ++ do_cmd_CRM_meta_timeout ocf_promotion_score -D current_master_score="" } ++++++ drbd-utils-9.25.0.tar.gz -> drbd-utils-9.29.0.tar.gz ++++++ ++++ 36828 lines of diff (skipped) ++++++ fence-after-pacemaker-down.patch ++++++ --- /var/tmp/diff_new_pack.PK99bZ/_old 2025-01-09 15:11:27.870323951 +0100 +++ /var/tmp/diff_new_pack.PK99bZ/_new 2025-01-09 15:11:27.870323951 +0100 @@ -2,7 +2,7 @@ --- drbd-utils-8.9.6.orig/scripts/crm-fence-peer.sh 2016-03-14 15:54:38.701360775 +0800 +++ drbd-utils-8.9.6/scripts/crm-fence-peer.sh 2016-03-14 16:00:06.333338664 +0800 @@ -531,6 +531,25 @@ - [[ $crmd = "banned" ]] && will_fence=true + [[ $join = "banned" ]] && will_fence=true if [[ ${expected-down} = "down" && $in_ccm = "false" && $crmd != "online" ]]; then : "pacemaker considers this as clean down" + elif [[ $crmd/$join/$expected = "offline/down/down" ]] ; then