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

Per Liden per at fukt.bth.se
Mon Jan 3 14:13:57 CET 2005

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


On Wed, 22 Dec 2004, Philipp Reisner wrote:

> On Friday 17 December 2004 17:23, Per Liden wrote:
> > 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
> >
> 
> I consider your patch for inclusion, but I have a question:
> 
> > 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;
> >
> 
> With chunk, the other disk options are left off from the command
> line. -- Why do you want to change anything here ?!?!

My misstake. I overlooked the on-io-error option.

> >    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;
> >
> 
> the old code makes "--size=1234" the new code makes "-d" "1234" was
> there a problem with the previous way ?

Again, my misstake. I was under the impression that the drbdsetup option 
was --disk-size (IIRC it used to be, right?), which is why I didn't think 
--size was going work.

> >    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'");
> >  }
> >
> 
> Probabely this is the only necessary chunk of this patch... as far as 
> I understand this...

Yep, since drbdsetup takes --size the last chunk would be enough.

/Per



More information about the drbd-user mailing list