Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] [PATCH] drbd.ocf: drbdsetup v9 has no sh-status command
@ 2016-07-06  7:58 Miedzik, Piotr Bogdan
  2016-07-08 11:26 ` Miedzik, Piotr Bogdan
  0 siblings, 1 reply; 4+ messages in thread
From: Miedzik, Piotr Bogdan @ 2016-07-06  7:58 UTC (permalink / raw)
  To: 'drbd-dev@lists.linbit.com'

https://github.com/qermit/drbd-utils

---
 scripts/drbd.ocf | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index eee8d62..3995a24 100755
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -359,13 +359,19 @@ drbd_set_status_variables() {
        DRBD_DSTATE_LOCAL=()
        DRBD_DSTATE_REMOTE=()

-       if $DRBD_HAS_MULTI_VOLUME ; then
-               out="$($DRBDSETUP sh-status "$DRBD_RESOURCE")" && eval "$out"
-       else
-               # without "MULTI_VOLUME", the DRBD_DEVICES array
-               # should contain exactly one value
-               out="$($DRBDSETUP "$DRBD_DEVICES" sh-status)" && eval "$out"
-       fi
+       while : ; do
+               read -r tmp_resource tmp_nodeid tmp_role tmp_suspended
+               DRBD_ROLE_LOCAL[0]=${tmp_role#role:}
+               read -r tmp_volume tmp_minor tmp_dstate tmp_blocked
+               DRBD_DSTATE_LOCAL[0]=${tmp_dstate#disk:}
+               read -r tmp_remotenode tmp_remotenodeid tmp_remoteconnected tmp_remoterole tmp_remotecongested
+               DRBD_CSTATE[0]=${tmp_remoteconnected#connection:}
+               DRBD_ROLE_REMOTE[0]=${tmp_remoterole#role:}
+               read -r tmp_remotevolume tmp_replication tmp_remotedstate tmp_resync
+               DRBD_DSTATE_REMOTE[0]=${tmp_remotedstate#peer-disk:}
+               break
+       done < <($DRBDSETUP status $DRBD_RESOURCE --verbose)
+

        # if there was no output at all, or a weird output
        # make sure the status arrays won't be empty.
--
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-12  8:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-06  7:58 [Drbd-dev] [PATCH] drbd.ocf: drbdsetup v9 has no sh-status command Miedzik, Piotr Bogdan
2016-07-08 11:26 ` Miedzik, Piotr Bogdan
2016-07-11 16:27   ` Lars Ellenberg
2016-07-12  8:53     ` Miedzik, Piotr Bogdan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox