[DRBD-user] [PATCH] disk size in drbd.conf

Per Liden per at fukt.bth.se
Fri Dec 17 17:23:34 CET 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


Hi,

Here's a patch that enables the "disk { size ...; }" option in drbd.conf. 
I've found it highly useful since it removes the need to manually poke 
around with drbdsetup on systems setup to use a small portion of a 
partition.

/Per

diff -ru drbd-0.7.6/user/drbdadm_main.c drbd-0.7.6-new/user/drbdadm_main.c
--- drbd-0.7.6/user/drbdadm_main.c	2004-11-29 09:44:49.000000000 +0100
+++ drbd-0.7.6-new/user/drbdadm_main.c	2004-12-15 17:47:18.325748752 +0100
@@ -462,8 +462,11 @@
   argv[argc++]=res->me->disk;
   argv[argc++]=res->me->meta_disk;
   argv[argc++]=res->me->meta_index;
-  opt=res->disk_options;
-  make_options(opt);
+  opt=find_opt(res->disk_options,"size");
+  if(opt) {
+	  argv[argc++]="-d";
+	  ssprintf(argv[argc++],"%s",opt->value);
+  }
   argv[argc++]=0;
 
   return m_system(argv,SLEEPS_LONG);
@@ -490,7 +493,10 @@
   argv[argc++]=res->me->device;
   argv[argc++]="resize";
   opt=find_opt(res->disk_options,"size");
-  if(opt) ssprintf(argv[argc++],"--%s=%s",opt->name,opt->value);
+  if(opt) {
+	  argv[argc++]="-d";
+	  ssprintf(argv[argc++],"%s",opt->value);
+  }
   argv[argc++]=0;
 
   return m_system(argv,SLEEPS_SHORT);
diff -ru drbd-0.7.6/user/drbdadm_scanner.fl drbd-0.7.6-new/user/drbdadm_scanner.fl
--- drbd-0.7.6/user/drbdadm_scanner.fl	2004-10-28 14:44:25.000000000 +0200
+++ drbd-0.7.6-new/user/drbdadm_scanner.fl	2004-12-15 17:27:23.260426296 +0100
@@ -227,7 +227,8 @@
 
 <DISK>{
   on-io-error		do_assign(IO_ERROR); CP; return TK_ON_IO_ERROR;
-  {NDELIM}		expect_error("'on-io-error'");
+  size			do_assign(NUM); CP; return TK_SIZE;
+  {NDELIM}		expect_error("one of 'on-io-error|size'");
 }
 
 <IO_ERROR>{



More information about the drbd-user mailing list