Accepting request 485221 from network:ha-clustering:Factory

1

OBS-URL: https://build.opensuse.org/request/show/485221
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/drbd-utils?expand=0&rev=12
This commit is contained in:
Yuchen Lin 2017-04-12 15:34:45 +00:00 committed by Git OBS Bridge
commit 27cf585694
10 changed files with 94 additions and 429 deletions

View File

@ -0,0 +1,26 @@
From f4a2325172bb011db033ee1d8d1fc747c22f254f Mon Sep 17 00:00:00 2001
From: Kristoffer Gronlund <kgronlund@suse.com>
Date: Tue, 4 Apr 2017 11:22:23 +0200
Subject: [PATCH] Disable quorum in default configuration (bsc#1032142)
---
scripts/global_common.conf | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/global_common.conf b/scripts/global_common.conf
index dd36e92..545b600 100644
--- a/scripts/global_common.conf
+++ b/scripts/global_common.conf
@@ -32,7 +32,8 @@ common {
options {
# cpu-mask on-no-data-accessible
- quorum majority;
+ # quorum majority;
+ quorum off;
}
disk {
--
2.12.0

3
drbd-utils-8.9.11.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c61878635c40536e7d689c65cbbe92ca982fa864cec20717c0af562f2a6c9c48
size 843348

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:297b77c9b3f88de2e7dae459234f2753ea4fc2805282b2d276e35cf51e292913
size 788183

View File

@ -1,3 +1,48 @@
-------------------------------------------------------------------
Tue Apr 4 12:21:55 UTC 2017 - kgronlund@suse.com
- Update to v8.9.11
* No source changes from v8.9.11rc1
-------------------------------------------------------------------
Tue Apr 4 09:25:09 UTC 2017 - kgronlund@suse.com
- Disable quorum in default configuration (bsc#1032142)
- Add 0001-Disable-quorum-in-default-configuration-bsc-1032142.patch
-------------------------------------------------------------------
Fri Mar 24 07:06:02 UTC 2017 - nwang@suse.com
- Update to v8.9.11rc1
- OCF resource agent and crm-fence-peer for drbd9
introduce quorum support
JSON output fixes
set bitmap to 0 on metadata creation
- Remove patch support-drbd9-ra.patch
Remove patch initialize-node-id-when-create-md.patch
- Corresponding user space change of bsc#1031299
-------------------------------------------------------------------
Wed Mar 22 09:10:59 UTC 2017 - nwang@suse.com
- Update to v8.9.10 for drbd9.0.6 and drbdmanage
- new drbdmon tool
drbdadm parser got faster
send SIGKILL to childs if parent drbdadm dies
compat fixes for linux kernel
-------------------------------------------------------------------
Mon Feb 20 16:30:37 CET 2017 - kukuk@suse.de
- Remove obsolete Requires for pre/post install sections
-------------------------------------------------------------------
Tue Feb 14 07:36:34 UTC 2017 - nwang@suse.com
- bsc#1025585, update to v8.9.8
- Remove patch zeroout-discard-devices.patch
Remove patch service-mod.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Dec 6 08:06:00 UTC 2016 - nwang@suse.com Tue Dec 6 08:06:00 UTC 2016 - nwang@suse.com

View File

@ -1,7 +1,7 @@
# #
# spec file for package drbd-utils # spec file for package drbd-utils
# #
# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,24 +16,24 @@
# #
%define real_version 8.9.11
Name: drbd-utils Name: drbd-utils
Version: 8.9.6 Version: 8.9.11rc2
Release: 0 Release: 0
Summary: Distributed Replicated Block Device Summary: Distributed Replicated Block Device
License: GPL-2.0+ License: GPL-2.0+
Group: Productivity/Clustering/HA Group: Productivity/Clustering/HA
Url: http://www.drbd.org/ Url: http://www.drbd.org/
Source: http://oss.linbit.com/drbd/%{name}-%{version}.tar.gz Source: http://www.drbd.org/download/drbd/utils/%{name}-%{real_version}.tar.gz
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines # PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch1: init-script-fixes.diff Patch1: init-script-fixes.diff
Patch2: fix-libdir-in-Makefile.patch Patch2: fix-libdir-in-Makefile.patch
Patch3: zeroout-discard-devices.patch Patch3: fence-after-pacemaker-down.patch
Patch4: service-mod.patch Patch4: fix-segfault-up-stacked-resource.patch
Patch5: fence-after-pacemaker-down.patch # PATCH-SUSE-FIX: Disable quorum in default configuration (bsc#1032142)
Patch6: support-drbd9-ra.patch Patch5: 0001-Disable-quorum-in-default-configuration-bsc-1032142.patch
Patch7: fix-segfault-up-stacked-resource.patch
Patch8: initialize-node-id-when-create-md.patch
Provides: drbd-bash-completion = %{version} Provides: drbd-bash-completion = %{version}
Provides: drbd-pacemaker = %{version} Provides: drbd-pacemaker = %{version}
@ -65,9 +65,6 @@ BuildRequires: udev
Provides: drbd-control Provides: drbd-control
Provides: drbdsetup Provides: drbdsetup
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(post): %insserv_prereq %fillup_prereq
Requires(preun): %insserv_prereq %fillup_prereq
Requires(postun): %insserv_prereq fileutils
%description %description
Drbd is a distributed replicated block device. It mirrors a block Drbd is a distributed replicated block device. It mirrors a block
@ -75,15 +72,12 @@ device over the network to another machine. Think of it as networked
raid 1. It is a building block for setting up clusters. raid 1. It is a building block for setting up clusters.
%prep %prep
%setup -q %setup -q -n %{name}-%{real_version}
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build %build
./autogen.sh ./autogen.sh
@ -152,6 +146,7 @@ rm -rf %{buildroot}%{_sysconfdir}/xen
%{_sysconfdir}/xen/scripts/block-drbd %{_sysconfdir}/xen/scripts/block-drbd
%endif %endif
%{_prefix}/lib/ocf/resource.d/linbit/drbd %{_prefix}/lib/ocf/resource.d/linbit/drbd
%{_prefix}/lib/ocf/resource.d/linbit/drbd.shellfuncs.sh
%{_udevrulesdir}/65-drbd.rules %{_udevrulesdir}/65-drbd.rules
%{_unitdir}/drbd.service %{_unitdir}/drbd.service
/usr/lib/systemd/system/drbd.service /usr/lib/systemd/system/drbd.service
@ -159,8 +154,7 @@ rm -rf %{buildroot}%{_sysconfdir}/xen
%{_localstatedir}/lib/drbd %{_localstatedir}/lib/drbd
/usr/lib/drbd /usr/lib/drbd
/lib/drbd /lib/drbd
/lib/drbd/drbdadm* /lib/drbd/drbd*
/lib/drbd/drbdsetup*
%dir %{_prefix}/lib/ocf %dir %{_prefix}/lib/ocf
%dir %{_prefix}/lib/ocf/resource.d %dir %{_prefix}/lib/ocf/resource.d
%dir %{_prefix}/lib/ocf/resource.d/linbit %dir %{_prefix}/lib/ocf/resource.d/linbit

View File

@ -1,7 +1,6 @@
Index: drbd-utils-8.9.2rc2+git.faeb645/scripts/drbd diff -Naur drbd-utils-8.9.9.orig/scripts/drbd drbd-utils-8.9.9/scripts/drbd
=================================================================== --- drbd-utils-8.9.9.orig/scripts/drbd 2016-10-24 17:37:12.893292307 +0800
--- drbd-utils-8.9.2rc2+git.faeb645.orig/scripts/drbd +++ drbd-utils-8.9.9/scripts/drbd 2016-10-24 17:38:56.728938286 +0800
+++ drbd-utils-8.9.2rc2+git.faeb645/scripts/drbd
@@ -9,14 +9,14 @@ @@ -9,14 +9,14 @@
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
@ -12,17 +11,16 @@ Index: drbd-utils-8.9.2rc2+git.faeb645/scripts/drbd
+# Required-Stop: $remote_fs $network $syslog +# Required-Stop: $remote_fs $network $syslog
# Should-Start: sshd multipathd # Should-Start: sshd multipathd
# Should-Stop: sshd multipathd # Should-Stop: sshd multipathd
-# Default-Start: 2 3 4 5 # Default-Start:
+# Default-Start: 2 3 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
-# X-Start-Before: heartbeat corosync -# X-Start-Before: heartbeat corosync
-# X-Stop-After: heartbeat corosync -# X-Stop-After: heartbeat corosync
+# X-Start-Before: pacemaker corosync +# X-Start-Before: pacemaker corosync
+# X-Stop-After: pacemaker corosync +# X-Stop-After: pacemaker corosync
# X-Interactive: true # X-Interactive: true
# Short-Description: Control drbd resources. # Short-Description: Control DRBD resources.
### END INIT INFO # Description: Control all DRBD resources.
@@ -173,7 +173,6 @@ case "$1" in @@ -184,7 +184,6 @@
done done
done done
@ -30,7 +28,7 @@ Index: drbd-utils-8.9.2rc2+git.faeb645/scripts/drbd
run_hook start_before-wait run_hook start_before-wait
$DRBDADM wait-con-int # User interruptible version of wait-connect all $DRBDADM wait-con-int # User interruptible version of wait-connect all
run_hook start run_hook start
@@ -226,7 +225,6 @@ case "$1" in @@ -256,7 +255,6 @@
fi fi
done done
run_hook stop run_hook stop

View File

@ -1,19 +0,0 @@
---
user/shared/drbdmeta.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/user/shared/drbdmeta.c b/user/shared/drbdmeta.c
index fd8cc17..e8089f8 100644
--- a/user/shared/drbdmeta.c
+++ b/user/shared/drbdmeta.c
@@ -3845,6 +3845,7 @@ void md_convert_08_to_09(struct format *cfg)
cfg->md.flags &= ~(MDF_CONNECTED_IND | MDF_FULL_SYNC | MDF_PEER_OUT_DATED);
+ cfg->md.node_id = -1;
cfg->md.magic = DRBD_MD_MAGIC_09;
re_initialize_md_offsets(cfg);
--
1.8.5.6

View File

@ -1,13 +0,0 @@
Index: drbd-utils-8.9.2/scripts/Makefile.in
===================================================================
--- drbd-utils-8.9.2.orig/scripts/Makefile.in
+++ drbd-utils-8.9.2/scripts/Makefile.in
@@ -65,7 +65,7 @@ endif
# yes, debian apparently allows installing both types from the same package
ifneq ($(initscripttype),sysv) # "systemd" or "both"
install -d $(DESTDIR)$(systemdunitdir)
- install -m 755 drbd.service $(DESTDIR)$(systemdunitdir)/
+ install -m 644 drbd.service $(DESTDIR)$(systemdunitdir)/
install -d $(DESTDIR)/lib/drbd/
install -m 755 drbd $(DESTDIR)/lib/drbd/
install -d $(DESTDIR)$(tmpfilesdir)/

View File

@ -1,314 +0,0 @@
diff -Naur drbd-utils-8.9.6.orig/scripts/drbd.ocf drbd-utils-8.9.6/scripts/drbd.ocf
--- drbd-utils-8.9.6.orig/scripts/drbd.ocf 2016-08-03 11:01:39.334765566 +0800
+++ drbd-utils-8.9.6/scripts/drbd.ocf 2016-08-03 11:31:40.801931986 +0800
@@ -328,6 +328,23 @@
do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
}
+_peer_node_process() {
+ # _since drbd9 support multiple connections
+ : ${_peer_node_id:=0}
+ DRBD_PER_NAME[$_peer_node_id]=$_conn_name
+ DRBD_PER_ID[$_peer_node_id]=$_peer_node_id
+ DRBD_PER_CSTATE[$_peer_node_id]=$_cstate
+ DRBD_PER_ROLE_REMOTE[$_peer_node_id]=${_peer:-Unknown}
+ DRBD_PER_DSTATE_REMOTE[$_peer_node_id]=${_pdsk:-DUnknown}
+
+ : == DEBUG == _peer_node_id == ${_peer_node_id} ==
+ : == DEBUG == DRBD_PER_NAME[_peer_node_id] == ${DRBD_PER_NAME[${_peer_node_id}]} ==
+ : == DEBUG == DRBD_PER_ID[_peer_node_id] == ${DRBD_PER_ID[${_peer_node_id}]} ==
+ : == DEBUG == DRBD_PER_CSTATE[_peer_node_id] == ${DRBD_PER_CSTATE[${_peer_node_id}]} ==
+ : == DEBUG == DRBD_PER_ROLE_REMOTE[_peer_node_id] == ${DRBD_PER_ROLE_REMOTE[${_peer_node_id}]} ==
+ : == DEBUG == DRBD_PER_DSTATE_REMOTE[_peer_node_id] == ${DRBD_PER_DSTATE_REMOTE[${_peer_node_id}]} ==
+}
+
_sh_status_process() {
# _volume not present should not happen,
# but may help make this agent work even if it talks to drbd 8.3.
@@ -335,11 +352,36 @@
# not-yet-created volumes are reported as -1
(( _volume >= 0 )) || _volume=$[1 << 16]
DRBD_ROLE_LOCAL[$_volume]=${_role:-Unconfigured}
- DRBD_ROLE_REMOTE[$_volume]=${_peer:-Unknown}
- DRBD_CSTATE[$_volume]=$_cstate
DRBD_DSTATE_LOCAL[$_volume]=${_disk:-Unconfigured}
- DRBD_DSTATE_REMOTE[$_volume]=${_pdsk:-DUnknown}
+
+ if $DRBD_VERSION_9 ; then
+ #Get from _peer_node_process
+ DRBD_NAME[$_volume]=${DRBD_PER_NAME[@]}
+ DRBD_ID[$_volume]=${DRBD_PER_ID[@]}
+ DRBD_VOLUME[$_volume]=${_volume}
+ DRBD_CSTATE[$_volume]=${DRBD_PER_CSTATE[@]}
+ DRBD_ROLE_REMOTE[$_volume]=${DRBD_PER_ROLE_REMOTE[@]}
+ DRBD_DSTATE_REMOTE[$_volume]=${DRBD_PER_DSTATE_REMOTE[@]}
+
+ DRBD_PER_NAME=()
+ DRBD_PER_ID=()
+ DRBD_PER_CSTATE=()
+ DRBD_PER_ROLE_REMOTE=()
+ DRBD_PER_DSTATE_REMOTE=()
+
+ : == DEBUG == _volume == ${_volume} ==
+ : == DEBUG == DRBD_ROLE_LOCAL == ${DRBD_ROLE_LOCAL[${_volume}]} ==
+ : == DEBUG == DRBD_DSTATE_LOCAL == ${DRBD_DSTATE_LOCAL[${_volume}]} ==
+ : == DEBUG == DRBD_CSTATE == ${DRBD_CSTATE[${_volume}]} ==
+ : == DEBUG == DRBD_ROLE_REMOTE == ${DRBD_ROLE_REMOTE[${_volume}]} ==
+ : == DEBUG == DRBD_DSTATE_REMOTE == ${DRBD_DSTATE_REMOTE[${_volume}]} ==
+ else
+ DRBD_CSTATE[$_volume]=$_cstate
+ DRBD_ROLE_REMOTE[$_volume]=${_peer:-Unknown}
+ DRBD_DSTATE_REMOTE[$_volume]=${_pdsk:-DUnknown}
+ fi
}
+
drbd_set_status_variables() {
# drbdsetup sh-status prints these values to stdout,
# and then prints _sh_status_process.
@@ -352,6 +394,15 @@
local _resynced_percent
local out
+ if $DRBD_VERSION_9 ; then
+ local _peer_node_id _conn_name
+ DRBD_PER_NAME=()
+ DRBD_PER_ID=()
+ DRBD_PER_CSTATE=()
+ DRBD_PER_ROLE_REMOTE=()
+ DRBD_PER_DSTATE_REMOTE=()
+ fi
+
DRBD_ROLE_LOCAL=()
DRBD_ROLE_REMOTE=()
DRBD_CSTATE=()
@@ -369,16 +420,20 @@
# if there was no output at all, or a weird output
# make sure the status arrays won't be empty.
[[ ${#DRBD_ROLE_LOCAL[@]} != 0 ]] || DRBD_ROLE_LOCAL=(Unconfigured)
- [[ ${#DRBD_ROLE_REMOTE[@]} != 0 ]] || DRBD_ROLE_REMOTE=(Unknown)
- [[ ${#DRBD_CSTATE[@]} != 0 ]] || DRBD_CSTATE=(Unconfigured)
[[ ${#DRBD_DSTATE_LOCAL[@]} != 0 ]] || DRBD_DSTATE_LOCAL=(Unconfigured)
+ [[ ${#DRBD_CSTATE[@]} != 0 ]] || DRBD_CSTATE=(Unconfigured)
+ [[ ${#DRBD_ROLE_REMOTE[@]} != 0 ]] || DRBD_ROLE_REMOTE=(Unknown)
[[ ${#DRBD_DSTATE_REMOTE[@]} != 0 ]] || DRBD_DSTATE_REMOTE=(DUnknown)
-
+ if $DRBD_VERSION_9 ; then
+ : == DEBUG == DRBD_NAME == ${DRBD_NAME[@]} ==
+ : == DEBUG == DRBD_ID == ${DRBD_ID[@]} ==
+ : == DEBUG == DRBD_VOLUME == ${DRBD_VOLUME[@]} ==
+ fi
: == DEBUG == DRBD_ROLE_LOCAL == ${DRBD_ROLE_LOCAL[@]} ==
- : == DEBUG == DRBD_ROLE_REMOTE == ${DRBD_ROLE_REMOTE[@]} ==
- : == DEBUG == DRBD_CSTATE == ${DRBD_CSTATE[@]} ==
: == DEBUG == DRBD_DSTATE_LOCAL == ${DRBD_DSTATE_LOCAL[@]} ==
+ : == DEBUG == DRBD_CSTATE == ${DRBD_CSTATE[@]} ==
+ : == DEBUG == DRBD_ROLE_REMOTE == ${DRBD_ROLE_REMOTE[@]} ==
: == DEBUG == DRBD_DSTATE_REMOTE == ${DRBD_DSTATE_REMOTE[@]} ==
}
@@ -414,6 +469,9 @@
ocf_is_true $OCF_RESKEY_stop_outdates_secondary || return 1
local host stop_uname
+ if $DRBD_VERSION_9 ; then
+ local master temp_nmber outdate_self
+ fi
# We ignore $OCF_RESKEY_CRM_meta_notify_promote_uname here
# because: if demote and promote for a _stacked_ resource
# (or a "floating" one, where DRBD sits on top of some SAN)
@@ -437,6 +495,29 @@
return 1
done
+ if $DRBD_VERSION_9 ; then
+ temp_name=($DRBD_NAME[@])
+ temp_dstate=($DRBD_DSTATE_REMOTE[@])
+ temp_number=${#temp_name[@]}
+ outdate_self=false
+
+ for master in $OCF_RESKEY_CRM_meta_notify_master_uname; do
+ for i in `seq 0 $((temp_number-1))`; do
+ if [[ ${temp_name[$i]} == "$master" ]] &&
+ [[ ${temp_dstate[$i]} == "DUnknown" ]]; then
+ outdate_self=true
+ break
+ fi
+ done
+ temp_number=${#temp_name[@]}
+ done
+
+ if ! $outdate_self; then
+ #The disconnecting node is not in Primary
+ return 1
+ fi
+ fi
+
# e.g. post/promote of some other peer.
# Should not happen, fencing constraints should take care of that.
# But in case it does, scream out loud.
@@ -993,6 +1074,7 @@
DRBDADM="drbdadm"
DRBDSETUP="drbdsetup"
DRBD_HAS_MULTI_VOLUME=false
+ DRBD_VERSION_9=false
# these will _exit_ if they don't find the binaries
check_binary $DRBDADM
@@ -1015,18 +1097,28 @@
modinfo -F version drbd |
sed -ne 's/^\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1 \2 \3/p'))
fi
- if (( $DRBD_KERNEL_VERSION_CODE >= 0x080400 )); then
+ if (( $DRBD_KERNEL_VERSION_CODE >= 0x090000 )); then
+ DRBD_HAS_MULTI_VOLUME=true
+ DRBD_VERSION_9=true
+ elif (( $DRBD_KERNEL_VERSION_CODE >= 0x080400 )); then
DRBD_HAS_MULTI_VOLUME=true
- elif (( $DRBD_KERNEL_VERSION_CODE >= 0x090000 )) ; then
- ocf_log err "This resource agent does (still) only support DRBD version 8.x"
- exit $OCF_ERR_INSTALLED
fi
check_crm_feature_set
# Check clone and M/S options.
- meta_expect clone-max -le 2
+ # Drbd9 support more than two nodes
+ if ! $DRBD_VERSION_9 ; then
+ meta_expect clone-max -le 2
+ fi
+
+ if [ ${OCF_RESKEY_CRM_meta_clone_max} -gt 2 ]
+ then
+ ocf_log warn "SUSE only supports two nodes, although it is technically feasible to use more than two."
+ fi
+
meta_expect clone-node-max = 1
meta_expect master-node-max = 1
+ # With current DRBD-9.0 version more than two primaries at the same time is not support.
meta_expect master-max -le 2
# Rather than returning $OCF_ERR_CONFIGURED, we sometimes return
@@ -1080,7 +1172,12 @@
# DRBD_DEVICES will be a shell array!
# FIXME we should double check that we explicitly restrict the set of
# valid characters in device names...
- if DRBD_DEVICES=($($DRBDADM --stacked sh-dev $DRBD_RESOURCE 2>/dev/null)); then
+ # In DRBD9, no matter stacked or not "$DRBDADM --stacked sh-dev $DRBD_RESOURCE" will return true
+ if $DRBD_VERSION_9 && ! $($DRBDADM --stacked sh-dev $DRBD_RESOURCE 2>&1|
+ grep "not available in stacked" >/dev/null); then
+ DRBD_DEVICES=($($DRBDADM --stacked sh-dev $DRBD_RESOURCE 2>/dev/null))
+ DRBDADM="$DRBDADM -S"
+ elif ! $DRBD_VERSION_9 && DRBD_DEVICES=($($DRBDADM --stacked sh-dev $DRBD_RESOURCE 2>/dev/null)); then
# apparently a "stacked" resource. Remember for future DRBDADM calls.
DRBDADM="$DRBDADM -S"
elif DRBD_DEVICES=($($DRBDADM sh-dev $DRBD_RESOURCE 2>/dev/null)); then
diff -Naur drbd-utils-8.9.6.orig/user/v9/drbdsetup.c drbd-utils-8.9.6/user/v9/drbdsetup.c
--- drbd-utils-8.9.6.orig/user/v9/drbdsetup.c 2016-08-03 11:01:39.318765641 +0800
+++ drbd-utils-8.9.6/user/v9/drbdsetup.c 2016-08-03 11:13:34.582378058 +0800
@@ -251,6 +251,7 @@
static int show_cmd(struct drbd_cmd *cm, int argc, char **argv);
static int status_cmd(struct drbd_cmd *cm, int argc, char **argv);
static int role_cmd(struct drbd_cmd *cm, int argc, char **argv);
+static int sh_status_9compat_cmd(struct drbd_cmd *cm, int argc, char **argv);
static int cstate_cmd(struct drbd_cmd *cm, int argc, char **argv);
static int dstate_cmd(struct drbd_cmd *cm, int argc, char **argv);
static int check_resize_cmd(struct drbd_cmd *cm, int argc, char **argv);
@@ -478,6 +479,9 @@
{"role", CTX_RESOURCE, 0, NO_PAYLOAD, role_cmd,
.lockless = true,
.summary = "Show the current role of a resource." },
+ {"sh-status", CTX_RESOURCE | CTX_ALL, 0, 0, sh_status_9compat_cmd,
+ .lockless = true,
+ .summary = "Show all status of resource." },
{"cstate", CTX_PEER_NODE, 0, NO_PAYLOAD, cstate_cmd,
.lockless = true,
.summary = "Show the current state of a connection." },
@@ -2576,6 +2580,87 @@
return 0;
}
+
+static int sh_status_9compat_cmd(struct drbd_cmd *cm, int argc, char **argv)
+{
+
+ struct resources_list *resources_list, *resource;
+ char *old_objname = objname;
+
+ resources_list = sort_resources(list_resources());
+
+ for (resource = resources_list; resource; resource = resource->next) {
+ struct devices_list *devices, *device;
+ struct connections_list *connections, *connection;
+ struct peer_devices_list *peer_devices = NULL, *peer_device;
+ struct nlattr *nla;
+
+ if (strcmp(old_objname, "all") && strcmp(old_objname, resource->name))
+ continue;
+
+ objname = resource->name;
+ printI("_res_name=%s\n", objname);
+
+ nla = nla_find_nested(resource->res_opts, __nla_type(T_node_id));
+ if (nla)
+ printI("_node_id=%d\n\n", *(uint32_t *)nla_data(nla));
+ else
+ printI("_node_id=\n\n");
+
+ devices = list_devices(resource->name);
+ connections = sort_connections(list_connections(resource->name));
+ if (devices && connections)
+ peer_devices = list_peer_devices(resource->name);
+
+ link_peer_devices_to_devices(peer_devices, devices);
+
+ for (device = devices; device; device = device->next) {
+ ++indent;
+ printI("_minor=%d\n", device->minor);
+ printI("_volume=%d\n", device->ctx.ctx_volume);
+ //refer to v84
+ //printI("_known=%s\n", xxx);
+ printI("_role=%s\n", drbd_role_str(resource->info.res_role));
+ printI("_disk=%s\n\n", drbd_disk_str(device->info.dev_disk_state));
+
+ for (connection = connections; connection; connection = connection->next) {
+ ++indent;
+ for (peer_device = peer_devices; peer_device; peer_device = peer_device->next) {
+ if (connection->ctx.ctx_peer_node_id != peer_device->ctx.ctx_peer_node_id
+ || device->ctx.ctx_volume != peer_device->ctx.ctx_volume)
+ continue;
+ printI("_conn_name=%s\n", connection->ctx.ctx_conn_name);
+ printI("_peer_node_id=%d\n", connection->ctx.ctx_peer_node_id);
+ printI("_cstate=%s\n", drbd_conn_str(connection->info.conn_connection_state));
+ if (connection->info.conn_connection_state == C_CONNECTED) {
+ printI("_peer=%s\n", drbd_role_str(connection->info.conn_role));
+ printI("_pdsk=%s\n\n", drbd_disk_str(peer_device->info.peer_disk_state));
+ } else {
+ printI("_peer=\n");
+ printI("_pdsk=\n");
+ }
+ wrap_printf(0, "_peer_node_process\n\n");
+ }
+ //Dummy
+ //printI("_flags_susp==%s\n", xxx);
+ //...
+ --indent;
+ }
+
+ wrap_printf(0, "_sh_status_process\n\n");
+ --indent;
+ }
+
+ free_connections(connections);
+ free_devices(devices);
+ free_peer_devices(peer_devices);
+ }
+
+ free(resources_list);
+ objname = old_objname;
+ return 0;
+}
+
static int cstate_cmd(struct drbd_cmd *cm, int argc, char **argv)
{
struct connections_list *connections, *connection;

View File

@ -1,52 +0,0 @@
diff -Naur drbd-utils-8.9.5.orig/documentation/v84/drbdsetup.xml drbd-utils-8.9.5/documentation/v84/drbdsetup.xml
--- drbd-utils-8.9.5.orig/documentation/v84/drbdsetup.xml 2015-12-24 14:13:13.928784939 +0800
+++ drbd-utils-8.9.5/documentation/v84/drbdsetup.xml 2015-12-24 14:14:51.533778352 +0800
@@ -1889,6 +1889,24 @@
<para>Clears the sync bitmap in addition to generating a new current UUID.</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><option>--zeroout-devices</option></term>
+
+ <listitem>
+ <para>Start to zeroing out the device on both side in addition to generating
+ a new current UUID .</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--discard-devices</option></term>
+
+ <listitem>
+ <para>Start to allocate a thinly provided backing device on both side in
+ addition to generating a new current UUID .</para>
+ </listitem>
+ </varlistentry>
</variablelist></para>
<para>This can be used to skip the initial sync, if you want to start from scratch. This
diff -Naur drbd-utils-8.9.5.orig/user/v84/config_flags.c drbd-utils-8.9.5/user/v84/config_flags.c
--- drbd-utils-8.9.5.orig/user/v84/config_flags.c 2015-12-24 14:13:13.937784939 +0800
+++ drbd-utils-8.9.5/user/v84/config_flags.c 2015-12-24 14:15:44.450774781 +0800
@@ -1028,6 +1028,8 @@
NLA_POLICY(new_c_uuid_parms),
.fields = {
{ "clear-bitmap", FLAG(clear_bm) },
+ { "zeroout-devices", FLAG(zeroout_devices) },
+ { "discard-devices", FLAG(discard_devices) },
{ } },
};
diff -Naur drbd-utils-8.9.5.orig/user/v84/linux/drbd_genl.h drbd-utils-8.9.5/user/v84/linux/drbd_genl.h
--- drbd-utils-8.9.5.orig/user/v84/linux/drbd_genl.h 2015-12-24 14:13:13.940784938 +0800
+++ drbd-utils-8.9.5/user/v84/linux/drbd_genl.h 2015-12-24 14:16:30.426771679 +0800
@@ -239,6 +239,8 @@
GENL_struct(DRBD_NLA_NEW_C_UUID_PARMS, 10, new_c_uuid_parms,
__flg_field(1, DRBD_GENLA_F_MANDATORY, clear_bm)
+ __flg_field(2, 0, zeroout_devices)
+ __flg_field(3, 0, discard_devices)
)
GENL_struct(DRBD_NLA_TIMEOUT_PARMS, 11, timeout_parms,