[DRBD-cvs] svn commit by phil - r2949 - in trunk: documentation
scripts user - T
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Tue Jun 26 17:55:38 CEST 2007
Author: phil
Date: 2007-06-26 17:55:37 +0200 (Tue, 26 Jun 2007)
New Revision: 2949
Modified:
trunk/documentation/drbd.conf.sgml
trunk/scripts/drbd
trunk/scripts/drbd.conf
trunk/user/drbdadm_main.c
trunk/user/drbdadm_scanner.fl
Log:
T
Modified: trunk/documentation/drbd.conf.sgml
===================================================================
--- trunk/documentation/drbd.conf.sgml 2007-06-26 15:53:21 UTC (rev 2948)
+++ trunk/documentation/drbd.conf.sgml 2007-06-26 15:55:37 UTC (rev 2949)
@@ -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>,
+ <option>become-primary-on</option>.
</para>
</listitem>
</varlistentry>
@@ -835,6 +836,17 @@
</varlistentry>
<varlistentry>
+ <term><option>become-primary-on <replaceable>host-name</replaceable></option></term>
+ <listitem><para>
+ <indexterm><primary>drbd.conf</primary><secondary>become-primary-on</secondary></indexterm>
+ States that this resource should be promoted to the primary role
+ by the init script after the connection get established. Do not use
+ this option if you want to entitle the management of the resources'
+ roles to a cluster manager (e.g. heartbeat).
+ </para></listitem>
+</varlistentry>
+
+<varlistentry>
<term><option>rate <replaceable>rate</replaceable></option></term>
<listitem><para>
<indexterm><primary>drbd.conf</primary><secondary>rate </secondary></indexterm>
Modified: trunk/scripts/drbd
===================================================================
--- trunk/scripts/drbd 2007-06-26 15:53:21 UTC (rev 2948)
+++ trunk/scripts/drbd 2007-06-26 15:55:37 UTC (rev 2949)
@@ -96,6 +96,9 @@
[ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd # for RedHat
echo "."
$DRBDADM wait-con-int # User interruptible version of wait-connect all
+ for RES in `$DRBDADM sh-pri-on-start`; do
+ $DRBDADM primary $RES
+ done
;;
stop)
echo -n "Stopping all DRBD resources"
Modified: trunk/scripts/drbd.conf
===================================================================
--- trunk/scripts/drbd.conf 2007-06-26 15:53:21 UTC (rev 2948)
+++ trunk/scripts/drbd.conf 2007-06-26 15:55:37 UTC (rev 2949)
@@ -161,6 +161,14 @@
# is rebooted, this timeout value is used.
#
degr-wfc-timeout 120; # 2 minutes.
+
+ # For GFS or OCFS, you want DRBD to become primary on its own.
+ # Use "all" to let it become primary all of your nodes, use
+ # the node name to let it become primary only on a named node.
+ # Do not use this option if you want to entitle the management
+ # of the resources' roles to a cluster manager (e.g. heartbeat).
+ #
+ # become-primary-on all;
}
disk {
Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c 2007-06-26 15:53:21 UTC (rev 2948)
+++ trunk/user/drbdadm_main.c 2007-06-26 15:55:37 UTC (rev 2949)
@@ -106,11 +106,13 @@
static int sh_ll_dev(struct d_resource* ,const char* );
static int sh_md_dev(struct d_resource* ,const char* );
static int sh_md_idx(struct d_resource* ,const char* );
+static int sh_pri_on_strt(struct d_resource* ,const char* );
static int admm_generic(struct d_resource* ,const char* );
static int adm_khelper(struct d_resource* ,const char* );
static int adm_generic_b(struct d_resource* ,const char* );
static int hidden_cmds(struct d_resource* ,const char* );
+static char* get_opt_val(struct d_option*,const char*,char*);
static struct ifreq* get_ifreq();
char ss_buffer[255];
@@ -234,6 +236,7 @@
{ "sh-md-dev", sh_md_dev, 2,1,0 },
{ "sh-md-idx", sh_md_idx, 2,1,0 },
{ "sh-ip", sh_ip, 0,1,0 },
+ { "sh-pri-on-start", sh_pri_on_strt,2,0,0 },
{ "pri-on-incon-degr", adm_khelper, 3,1,0 },
{ "pri-lost-after-sb", adm_khelper, 3,1,0 },
{ "outdate-peer", adm_khelper, 3,1,0 },
@@ -552,6 +555,26 @@
return 0;
}
+static int sh_pri_on_strt(struct d_resource* ignored __attribute((unused)),const char* unused __attribute((unused)))
+{
+ struct d_resource *res,*t;
+ char *val;
+ int first=1;
+
+ for_each_resource(res,t,config) {
+ val = get_opt_val(config->startup_options,"become-primary-on",NULL);
+ if(!val) continue;
+ if( strcmp(nodeinfo.nodename,val)==0 ||
+ strcmp(nodeinfo.nodename,"all")==0 ) {
+ printf(first?"%s":" %s",esc(res->name));
+ first=0;
+ }
+ }
+ printf("\n");
+
+ return 0;
+}
+
static void free_host_info(struct d_host_info* hi)
{
if(!hi) return;
@@ -908,8 +931,6 @@
return rv;
}
-static char* get_opt_val(struct d_option*,const char*,char*);
-
static int adm_khelper(struct d_resource* res ,const char* cmd)
{
int rv=0;
Modified: trunk/user/drbdadm_scanner.fl
===================================================================
--- trunk/user/drbdadm_scanner.fl 2007-06-26 15:53:21 UTC (rev 2948)
+++ trunk/user/drbdadm_scanner.fl 2007-06-26 15:55:37 UTC (rev 2949)
@@ -89,6 +89,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;}
+become-primary-on { DP; CP; return TK_STARTUP_OPTION; }
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; }
More information about the drbd-cvs
mailing list