[DRBD-cvs] svn commit by phil - r3007 - in branches/drbd-8.0:
documentation scripts user - Implemented the wait-after-sb
option for the startup se
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Thu Aug 2 14:58:34 CEST 2007
Author: phil
Date: 2007-08-02 14:58:32 +0200 (Thu, 02 Aug 2007)
New Revision: 3007
Modified:
branches/drbd-8.0/documentation/drbd.conf.sgml
branches/drbd-8.0/documentation/drbdsetup.sgml
branches/drbd-8.0/scripts/drbd.conf
branches/drbd-8.0/user/drbdadm_scanner.fl
branches/drbd-8.0/user/drbdsetup.c
Log:
Implemented the wait-after-sb option for the startup section.
AND CHANGED THE DEFAULT BEHAVIOUR OF THE INIT SCRIPT.
Modified: branches/drbd-8.0/documentation/drbd.conf.sgml
===================================================================
--- branches/drbd-8.0/documentation/drbd.conf.sgml 2007-08-02 09:35:17 UTC (rev 3006)
+++ branches/drbd-8.0/documentation/drbd.conf.sgml 2007-08-02 12:58:32 UTC (rev 3007)
@@ -217,7 +217,8 @@
<manvolnum>8</manvolnum></citerefentry> for a detailed description
of this section's parameters.
Optional parameters:
- <option>wfc-timeout</option>, <option>degr-wfc-timeout</option>.
+ <option>wfc-timeout</option>, <option>degr-wfc-timeout</option> and
+ <option>wait-after-sb</option>.
</para>
</listitem>
</varlistentry>
@@ -835,6 +836,16 @@
</varlistentry>
<varlistentry>
+ <term><option>wait-after-sb</option></term>
+ <listitem><para>
+ By setting this option you can make the init script to continue
+ to wait even if the device pair had a split brain situation
+ and therefore refuses to connect.
+ </para>
+ </listitem>
+</varlistentry>
+
+<varlistentry>
<term><option>rate <replaceable>rate</replaceable></option></term>
<listitem><para>
<indexterm><primary>drbd.conf</primary><secondary>rate </secondary></indexterm>
Modified: branches/drbd-8.0/documentation/drbdsetup.sgml
===================================================================
--- branches/drbd-8.0/documentation/drbdsetup.sgml 2007-08-02 09:35:17 UTC (rev 3006)
+++ branches/drbd-8.0/documentation/drbdsetup.sgml 2007-08-02 12:58:32 UTC (rev 3007)
@@ -103,16 +103,18 @@
<cmdsynopsis>
<command>drbdsetup</command>
<arg choice="req"><replaceable>device</replaceable></arg>
- <arg choice="req">wait_connect</arg>
+ <arg choice="req">wait-connect</arg>
<arg>-t<arg choice="req"><replaceable>wfc_timeout</replaceable></arg></arg>
<arg>-d<arg choice="req"><replaceable>degr_wfc_timeout</replaceable></arg></arg>
+ <arg>-w</arg>
</cmdsynopsis>
<cmdsynopsis>
<command>drbdsetup</command>
<arg choice="req"><replaceable>device</replaceable></arg>
- <arg choice="req">wait_sync</arg>
+ <arg choice="req">wait-sync</arg>
<arg>-t<arg choice="req"><replaceable>wfc_timeout</replaceable></arg></arg>
<arg>-d<arg choice="req"><replaceable>degr_wfc_timeout</replaceable></arg></arg>
+ <arg>-w</arg>
</cmdsynopsis>
<cmdsynopsis>
<command>drbdsetup</command>
@@ -817,8 +819,8 @@
</para>
</refsect2>
<refsect2>
- <title>wait_connect</title>
- <indexterm><primary>drbdsetup</primary><secondary>wait_connect</secondary></indexterm>
+ <title>wait-connect</title>
+ <indexterm><primary>drbdsetup</primary><secondary>wait-connect</secondary></indexterm>
<para>
Returns as soon as the <replaceable>device</replaceable> can
communicate with its partner device.
@@ -829,6 +831,7 @@
<option>--wfc-timeout <replaceable>wfc_timeout</replaceable></option></term>
<term><option>-d</option>,
<option>--degr-wfc-timeout <replaceable>degr_wfc_timeout</replaceable></option></term>
+ <term><option>-w</option>, <option>--wait-after-sb</option></term>
<listitem>
<para>
This command will fail if the
@@ -841,18 +844,22 @@
The default value for <replaceable>wfc_timeout</replaceable>
is 0 which means to wait forever. The default for
<replaceable>degr_wfc_timeout</replaceable> is 120 seconds.
+ In case the connection status goes down to StandAlone because
+ the peer appeared but the devices had a split brain situation,
+ the default for the command is to terminate. You can change this
+ behaviour with the <option>--wait-after-sb</option> option.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2>
- <title>wait_sync</title>
- <indexterm><primary>drbdsetup</primary><secondary>wait_sync</secondary></indexterm>
+ <title>wait-sync</title>
+ <indexterm><primary>drbdsetup</primary><secondary>wait-sync</secondary></indexterm>
<para>
Returns as soon as the <replaceable>device</replaceable> leaves any
synchronisation into connected state. The options
- are the same as with the <replaceable>wait_connect</replaceable>
+ are the same as with the <replaceable>wait-connect</replaceable>
command.
</para>
</refsect2>
Modified: branches/drbd-8.0/scripts/drbd.conf
===================================================================
--- branches/drbd-8.0/scripts/drbd.conf 2007-08-02 09:35:17 UTC (rev 3006)
+++ branches/drbd-8.0/scripts/drbd.conf 2007-08-02 12:58:32 UTC (rev 3007)
@@ -161,6 +161,15 @@
# is rebooted, this timeout value is used.
#
degr-wfc-timeout 120; # 2 minutes.
+
+ # In case there was a split brain situation the devices will
+ # drop their network configuration instead of connecting. Since
+ # this means that the network is working, the cluster manager
+ # should be able to communicate as well. Therefore the default
+ # of DRBD's init script is to terminate in this case. To make
+ # it to continue waiting in this case set this option.
+ #
+ # wait-after-sb;
}
disk {
Modified: branches/drbd-8.0/user/drbdadm_scanner.fl
===================================================================
--- branches/drbd-8.0/user/drbdadm_scanner.fl 2007-08-02 09:35:17 UTC (rev 3006)
+++ branches/drbd-8.0/user/drbdadm_scanner.fl 2007-08-02 12:58:32 UTC (rev 3007)
@@ -88,6 +88,7 @@
al-extents { DP; CP; RC(AL_EXTENTS); return TK_SYNCER_OPTION;}
wfc-timeout { DP; CP; RC(WFC_TIMEOUT); return TK_STARTUP_OPTION;}
degr-wfc-timeout { DP; CP; RC(DEGR_WFC_TIMEOUT); return TK_STARTUP_OPTION;}
+wait-after-sb { DP; CP; return TK_STARTUP_SWITCH; }
pri-on-incon-degr { DP; CP; return TK_HANDLER_OPTION; }
pri-lost-after-sb { DP; CP; return TK_HANDLER_OPTION; }
pri-lost { DP; CP; return TK_HANDLER_OPTION; }
Modified: branches/drbd-8.0/user/drbdsetup.c
===================================================================
--- branches/drbd-8.0/user/drbdsetup.c 2007-08-02 09:35:17 UTC (rev 3006)
+++ branches/drbd-8.0/user/drbdsetup.c 2007-08-02 12:58:32 UTC (rev 3007)
@@ -124,7 +124,8 @@
} gp; // for generic_get_cmd, get_usage
struct {
struct option *options;
- int (*proc_event)();
+ int (*proc_event)(unsigned int, int,
+ struct drbd_nl_cfg_reply *);
} ep; // for events_cmd, events_usage
};
};
@@ -191,9 +192,9 @@
void show_string(struct drbd_option *od, unsigned short* tp);
// sub functions for events_cmd
-int print_state(unsigned int seq, struct drbd_nl_cfg_reply *reply);
-int w_connected_state(unsigned int seq, struct drbd_nl_cfg_reply *reply);
-int w_synced_state(unsigned int seq, struct drbd_nl_cfg_reply *reply);
+int print_state(unsigned int seq, int, struct drbd_nl_cfg_reply *reply);
+int w_connected_state(unsigned int seq, int, struct drbd_nl_cfg_reply *reply);
+int w_synced_state(unsigned int seq, int, struct drbd_nl_cfg_reply *reply);
const char *on_error[] = {
[PassOn] = "pass_on",
@@ -240,6 +241,7 @@
struct option wait_cmds_options[] = {
{ "wfc-timeout",required_argument, 0, 't' },
{ "degr-wfc-timeout",required_argument,0,'d'},
+ { "wait-after-sb",no_argument,0,'w'},
{ 0, 0, 0, 0 }
};
@@ -1187,7 +1189,8 @@
return rv;
}
-int print_state(unsigned int seq, struct drbd_nl_cfg_reply *reply)
+int print_state(unsigned int seq, int u __attribute((unused)),
+ struct drbd_nl_cfg_reply *reply)
{
drbd_state_t state;
char* str;
@@ -1239,6 +1242,7 @@
}
int w_connected_state(unsigned int seq __attribute((unused)),
+ int wait_after_sb,
struct drbd_nl_cfg_reply *reply)
{
drbd_state_t state;
@@ -1246,6 +1250,7 @@
if(reply->packet_type == P_get_state) {
if(consume_tag_int(T_state_i,reply->tag_list,(int*)&state.i)) {
if(state.conn >= Connected) return 0;
+ if(!wait_after_sb && state.conn < Unconnected) return 0;
} else fprintf(stderr,"Missing tag !?\n");
}
@@ -1253,14 +1258,15 @@
}
int w_synced_state(unsigned int seq __attribute((unused)),
+ int wait_after_sb,
struct drbd_nl_cfg_reply *reply)
{
drbd_state_t state;
if(reply->packet_type == P_get_state) {
if(consume_tag_int(T_state_i,reply->tag_list,(int*)&state.i)) {
- if(state.conn == Connected || state.conn < Unconnected )
- return 0;
+ if(state.conn == Connected) return 0;
+ if(!wait_after_sb && state.conn < Unconnected) return 0;
} else fprintf(stderr,"Missing tag !?\n");
}
return 1;
@@ -1278,6 +1284,7 @@
int unfiltered=0, all_devices=0;
int wfc_timeout=0, degr_wfc_timeout=0,timeout_ms;
struct timeval before,after;
+ int wasb=0;
lo = cm->ep.options;
@@ -1307,6 +1314,9 @@
return 20;
}
break;
+ case 'w':
+ wasb=1;
+ break;
}
}
@@ -1381,7 +1391,7 @@
}
if( all_devices || minor == reply->minor ) {
- cont=cm->ep.proc_event(cn_reply->seq, reply);
+ cont=cm->ep.proc_event(cn_reply->seq, wasb, reply);
}
} while(cont);
More information about the drbd-cvs
mailing list