[DRBD-cvs] svn commit by phil - r3037 - in branches/drbd-8.0:
documentation scripts user - Implemented the
"become-primary-on" option for the star
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Thu Aug 30 21:45:30 CEST 2007
Author: phil
Date: 2007-08-30 21:45:14 +0200 (Thu, 30 Aug 2007)
New Revision: 3037
Modified:
branches/drbd-8.0/documentation/drbd.conf.sgml
branches/drbd-8.0/documentation/drbd.sgml
branches/drbd-8.0/documentation/drbdadm.sgml
branches/drbd-8.0/documentation/drbddisk.sgml
branches/drbd-8.0/documentation/drbdmeta.sgml
branches/drbd-8.0/documentation/drbdsetup.sgml
branches/drbd-8.0/scripts/drbd
branches/drbd-8.0/scripts/drbd.conf
branches/drbd-8.0/user/drbdadm_main.c
branches/drbd-8.0/user/drbdadm_scanner.fl
Log:
Implemented the "become-primary-on" option for the startup section.
Modified: branches/drbd-8.0/documentation/drbd.conf.sgml
===================================================================
--- branches/drbd-8.0/documentation/drbd.conf.sgml 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/documentation/drbd.conf.sgml 2007-08-30 19:45:14 UTC (rev 3037)
@@ -1,4 +1,4 @@
-<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" "/usr/share/xml/docbook/schema/dtd/3/docbookx.dtd" []>
+<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" []>
<refentry>
<docinfo><date>06 April 2006</date></docinfo>
@@ -217,8 +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> and
- <option>wait-after-sb</option>.
+ <option>wfc-timeout</option>, <option>degr-wfc-timeout</option>,
+ <option>wait-after-sb</option> and <option>become-primary-on</option>.
</para>
</listitem>
</varlistentry>
@@ -846,6 +846,18 @@
</varlistentry>
<varlistentry>
+ <term><option>become-primary-on <replaceable>node-name</replaceable></option></term>
+ <listitem><para>
+ Sets on which node the device should be promoted to primary role by
+ the init script. The <replaceable>node-name</replaceable> might either
+ be a host name or the key word <option>both</option>. When this option is
+ not set the devices stay in secondary role on both nodes. Usually
+ one deligates the role assignment 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: branches/drbd-8.0/documentation/drbd.sgml
===================================================================
--- branches/drbd-8.0/documentation/drbd.sgml 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/documentation/drbd.sgml 2007-08-30 19:45:14 UTC (rev 3037)
@@ -1,4 +1,4 @@
-<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" "/usr/share/xml/docbook/schema/dtd/3/docbookx.dtd" []>
+<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" []>
<refentry>
<docinfo><date>01 Oct 2001</date></docinfo>
Modified: branches/drbd-8.0/documentation/drbdadm.sgml
===================================================================
--- branches/drbd-8.0/documentation/drbdadm.sgml 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/documentation/drbdadm.sgml 2007-08-30 19:45:14 UTC (rev 3037)
@@ -1,4 +1,4 @@
-<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" "/usr/share/xml/docbook/schema/dtd/3/docbookx.dtd" []>
+<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" []>
<refentry>
<docinfo><date>09 Feb 2004</date></docinfo>
Modified: branches/drbd-8.0/documentation/drbddisk.sgml
===================================================================
--- branches/drbd-8.0/documentation/drbddisk.sgml 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/documentation/drbddisk.sgml 2007-08-30 19:45:14 UTC (rev 3037)
@@ -1,4 +1,4 @@
-<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" "/usr/share/xml/docbook/schema/dtd/3/docbookx.dtd" []>
+<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" []>
<refentry>
<docinfo><date>30 Aug 2005</date></docinfo>
Modified: branches/drbd-8.0/documentation/drbdmeta.sgml
===================================================================
--- branches/drbd-8.0/documentation/drbdmeta.sgml 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/documentation/drbdmeta.sgml 2007-08-30 19:45:14 UTC (rev 3037)
@@ -1,4 +1,4 @@
-<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" "/usr/share/xml/docbook/schema/dtd/3/docbookx.dtd" []>
+<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" []>
<refentry>
<docinfo><date>31 March 2006</date></docinfo>
Modified: branches/drbd-8.0/documentation/drbdsetup.sgml
===================================================================
--- branches/drbd-8.0/documentation/drbdsetup.sgml 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/documentation/drbdsetup.sgml 2007-08-30 19:45:14 UTC (rev 3037)
@@ -1,4 +1,4 @@
-<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" "/usr/share/xml/docbook/schema/dtd/3/docbookx.dtd" []>
+<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V3.0//EN" []>
<refentry>
<docinfo><date>30 March 2006</date></docinfo>
Modified: branches/drbd-8.0/scripts/drbd
===================================================================
--- branches/drbd-8.0/scripts/drbd 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/scripts/drbd 2007-08-30 19:45:14 UTC (rev 3037)
@@ -96,6 +96,8 @@
[ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd # for RedHat
echo "."
$DRBDADM wait-con-int # User interruptible version of wait-connect all
+
+ $DRBDADM sh-b-pri all # Become primary if configured
;;
stop)
echo -n "Stopping all DRBD resources"
Modified: branches/drbd-8.0/scripts/drbd.conf
===================================================================
--- branches/drbd-8.0/scripts/drbd.conf 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/scripts/drbd.conf 2007-08-30 19:45:14 UTC (rev 3037)
@@ -170,6 +170,11 @@
# it to continue waiting in this case set this option.
#
# wait-after-sb;
+
+ # In case you are using DRBD for GFS/OCFS2 you want that the
+ # startup script promotes it to primary. Nodenames are also
+ # possible instead of "both".
+ # become-primary-on both;
}
disk {
Modified: branches/drbd-8.0/user/drbdadm_main.c
===================================================================
--- branches/drbd-8.0/user/drbdadm_main.c 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/user/drbdadm_main.c 2007-08-30 19:45:14 UTC (rev 3037)
@@ -105,11 +105,14 @@
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_b_pri(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];
@@ -230,6 +233,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-b-pri", sh_b_pri, 2,1,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 },
@@ -537,7 +541,18 @@
return 0;
}
+static int sh_b_pri(struct d_resource *res,const char* unused __attribute((unused)))
+{
+ char* val;
+ val = get_opt_val(res->startup_options, "become-primary-on", NULL);
+ if ( val && ( !strcmp(val,nodeinfo.nodename) ||
+ !strcmp(val,"both") ) ) {
+ return adm_generic_s(res,"primary");
+ }
+ return 0;
+}
+
static int sh_mod_parms(struct d_resource* res __attribute((unused)),const char* unused __attribute((unused)))
{
int mc=global_options.minor_count;
@@ -759,6 +774,19 @@
OPT=OPT->next; \
}
+#define make_options_wait(OPT) \
+ while(OPT) { \
+ if(!strcmp(OPT->name,"become-primary-on")) {\
+ OPT=OPT->next; continue; \
+ } \
+ if(OPT->value) { \
+ ssprintf(argv[NA(argc)],"--%s=%s",OPT->name,OPT->value); \
+ } else { \
+ ssprintf(argv[NA(argc)],"--%s",OPT->name); \
+ } \
+ OPT=OPT->next; \
+ }
+
int adm_attach(struct d_resource* res,const char* unused __attribute((unused)))
{
char* argv[MAX_ARGS];
@@ -891,8 +919,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;
@@ -1012,7 +1038,7 @@
argv[NA(argc)]=res->me->device;
argv[NA(argc)]="wait-connect";
opt=res->startup_options;
- make_options(opt);
+ make_options_wait(opt);
argv[NA(argc)]=0;
rv = m_system(argv,SLEEPS_FOREVER);
@@ -1203,7 +1229,7 @@
argv[NA(argc)]=res->me->device;
argv[NA(argc)]="wait-connect";
opt=res->startup_options;
- make_options(opt);
+ make_options_wait(opt);
argv[NA(argc)]=0;
pids[i++]=m_system(argv,RETURN_PID);
@@ -1551,6 +1577,7 @@
void validate_resource(struct d_resource * res)
{
struct d_option* opt;
+ char *bpo;
if (!res->protocol) {
if (!common || !common->protocol) {
@@ -1607,6 +1634,16 @@
if ( (opt = find_opt(res->handlers, "outdate-peer")) ) {
if(strstr(opt->value,"drbd-peer-outdater")) sanity_check_perm();
}
+
+ bpo = get_opt_val(res->startup_options, "become-primary-on", "undef");
+ opt = find_opt(res->net_options, "allow-two-primaries");
+ if(!strcmp(bpo,"both") && opt == NULL) {
+ fprintf(stderr,
+ "In resource %s:\n"
+ "become-primary-on is set to both, but allow-two-primaries "
+ "is not set.\n", res->name);
+ config_valid = 0;
+ }
}
static void global_validate(void)
Modified: branches/drbd-8.0/user/drbdadm_scanner.fl
===================================================================
--- branches/drbd-8.0/user/drbdadm_scanner.fl 2007-08-29 10:11:47 UTC (rev 3036)
+++ branches/drbd-8.0/user/drbdadm_scanner.fl 2007-08-30 19:45:14 UTC (rev 3037)
@@ -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;}
+become-primary-on { DP; CP; 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; }
More information about the drbd-cvs
mailing list