[DRBD-cvs] svn commit by lars - r2322 - trunk/user - disable check_uniq once the config file is sucessfully

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Aug 1 14:45:10 CEST 2006


Author: lars
Date: 2006-08-01 14:45:09 +0200 (Tue, 01 Aug 2006)
New Revision: 2322

Modified:
   trunk/user/drbdadm_adjust.c
   trunk/user/drbdadm_main.c
   trunk/user/drbdadm_parser.c
Log:
disable check_uniq once the config file is sucessfully validated,
so it won't interfere with parsing the output of drbdsetup show.


Modified: trunk/user/drbdadm_adjust.c
===================================================================
--- trunk/user/drbdadm_adjust.c	2006-08-01 12:29:59 UTC (rev 2321)
+++ trunk/user/drbdadm_adjust.c	2006-08-01 12:45:09 UTC (rev 2322)
@@ -179,6 +179,7 @@
 	int do_attach=0;
 	int do_connect=0;
 	int do_syncer=0;
+	char config_file_dummy[250];
 
 	argv[argc++]=drbdsetup;
 	argv[argc++]=res->me->device;
@@ -187,8 +188,9 @@
 
 	yyin = m_popen(&pid,argv);
 	line = 1;
-	config_file = "drbdsetup/show";
-	running = parse_resource("drbdsetup/show");
+	sprintf(config_file_dummy,"drbdsetup %s show", res->me->device);
+	config_file = config_file_dummy;
+	running = parse_resource(config_file_dummy);
 	fclose(yyin);
 	waitpid(pid,0,0);
 

Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c	2006-08-01 12:29:59 UTC (rev 2321)
+++ trunk/user/drbdadm_main.c	2006-08-01 12:45:09 UTC (rev 2322)
@@ -1291,6 +1291,11 @@
   ENTRY e, *ep;
   e.key = e.data = ep = NULL;
 
+  /* if we are done parsing the config file,
+   * switch off this paranoia */
+  if (config_valid >= 2)
+	  return 1;
+
   va_start(ap, fmt);
   rv=vasprintf(&e.key,fmt,ap);
   va_end(ap);
@@ -1562,6 +1567,10 @@
 
   if(!config_valid) exit(E_config_invalid);
 
+  /* disable check_uniq, so it won't interfere
+   * with parsing of drbdsetup show output */
+  config_valid = 2;
+
   if (config == NULL) {
     fprintf(stderr, "no resources defined!\n");
     exit(0); /* THINK exit here? what code? */

Modified: trunk/user/drbdadm_parser.c
===================================================================
--- trunk/user/drbdadm_parser.c	2006-08-01 12:29:59 UTC (rev 2321)
+++ trunk/user/drbdadm_parser.c	2006-08-01 12:45:09 UTC (rev 2322)
@@ -368,8 +368,7 @@
 			EXP(TK_INTEGER);
 			host->port = yylval.txt;
 			range_check(R_PORT, "port", yylval.txt);
-			if (!require_all) /* if not drbdsetup_dump */
-				check_uniq("IP", "%s:%s", host->address, host->port);
+			check_uniq("IP", "%s:%s", host->address, host->port);
 			EXP(';');
 			break;
 		case TK_META_DISK:



More information about the drbd-cvs mailing list