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

* Re: [Drbd-dev] [PATCH] drbd.ocf: drbdsetup v9 has no sh-status command
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Miedzik, Piotr Bogdan @ 2016-07-08 11:26 UTC (permalink / raw)
  To: 'drbd-dev@lists.linbit.com'

I've found mistake in drbd.ocf in line 1045 anyway.
Kernel module version should be checked in opposite order.


> -----Original Message-----
> From: Miedzik, Piotr Bogdan
> Sent: 6 lipca 2016 09:59
> To: 'drbd-dev@lists.linbit.com'
> Subject: [PATCH] drbd.ocf: drbdsetup v9 has no sh-status command
> 
> 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	[flat|nested] 4+ messages in thread

* Re: [Drbd-dev] [PATCH] drbd.ocf: drbdsetup v9 has no sh-status command
  2016-07-08 11:26 ` Miedzik, Piotr Bogdan
@ 2016-07-11 16:27   ` Lars Ellenberg
  2016-07-12  8:53     ` Miedzik, Piotr Bogdan
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ellenberg @ 2016-07-11 16:27 UTC (permalink / raw)
  To: drbd-dev

On Fri, Jul 08, 2016 at 11:26:52AM +0000, Miedzik, Piotr Bogdan wrote:
> I've found mistake in drbd.ocf in line 1045 anyway.
> Kernel module version should be checked in opposite order.

That's not the only thing missing wrt drbd 9 and pacemaker integration.

I have some unfinished work around, which eventually will find its way
into the repositories and packages "soon".

But for now, it's unfinished :-|

-- 
: Lars Ellenberg
: LINBIT | Keeping the Digital World Running
: DRBD -- Heartbeat -- Corosync -- Pacemaker
: R&D, Integration, Ops, Consulting, Support

DRBD® and LINBIT® are registered trademarks of LINBIT

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

* Re: [Drbd-dev] [PATCH] drbd.ocf: drbdsetup v9 has no sh-status command
  2016-07-11 16:27   ` Lars Ellenberg
@ 2016-07-12  8:53     ` Miedzik, Piotr Bogdan
  0 siblings, 0 replies; 4+ messages in thread
From: Miedzik, Piotr Bogdan @ 2016-07-12  8:53 UTC (permalink / raw)
  To: 'Lars Ellenberg', drbd-dev@lists.linbit.com

I realized that so I've written new script (https://github.com/qermit/drbd-utils/blob/master/scripts/drbd9.ocf) based on stateful OCF example, Filesystem and drbd.ocf 

The main difference to an original drbd.ocf is:
- it should not fail (or become unmanaged) when it's defined as a normal resource.
- each resource has its own debug level and debug file
- does not relay on drbdsetup sh-status
- creates .enable.${resourcename} file to cope with drbdmanage
- allows to have more than 2 clones

I find drbdmanage very nice tool but it causes some problems with pcs start/stop actions. It would be nice to have something like promotion type parameter (auto/manual/disabled).

Regards

> -----Original Message-----
> From: drbd-dev-bounces@lists.linbit.com [mailto:drbd-dev-
> bounces@lists.linbit.com] On Behalf Of Lars Ellenberg
> Sent: 11 lipca 2016 18:28
> To: drbd-dev@lists.linbit.com
> Subject: Re: [Drbd-dev] [PATCH] drbd.ocf: drbdsetup v9 has no sh-status
> command
> 
> On Fri, Jul 08, 2016 at 11:26:52AM +0000, Miedzik, Piotr Bogdan wrote:
> > I've found mistake in drbd.ocf in line 1045 anyway.
> > Kernel module version should be checked in opposite order.
> 
> That's not the only thing missing wrt drbd 9 and pacemaker integration.
> 
> I have some unfinished work around, which eventually will find its way
> into the repositories and packages "soon".
> 
> But for now, it's unfinished :-|
> 
> --
> : Lars Ellenberg
> : LINBIT | Keeping the Digital World Running
> : DRBD -- Heartbeat -- Corosync -- Pacemaker
> : R&D, Integration, Ops, Consulting, Support
> 
> DRBD(r) and LINBIT(r) are registered trademarks of LINBIT
> _______________________________________________
> drbd-dev mailing list
> drbd-dev@lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/drbd-dev

^ permalink raw reply	[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