AF:
NF:0
PS:10
SRH:1
SFN:
DSR:
MID:<20080318192123.017a0f8f@ripper.onstor.net>
CFG:
PT:0
S:andy.sharp@onstor.com
RQ:
SSV:onstor-exch02.onstor.net
NSV:
SSH:
R:<sripal.surendiran@onstor.com>,<sudharsan@onstor.com>,<tim.gardner@onstor.com>,<paul.hammer@onstor.com>,<narain.ramadass@onstor.com>
MAID:1
X-Sylpheed-Privacy-System:
X-Sylpheed-Sign:0
SCF:#mh/Mailbox/sent
RMID:#imap/andys@onstor.net@onstor-exch02.onstor.net/INBOX	0	BB375AF679D4A34E9CA8DFA650E2B04E02025662@onstor-exch02.onstor.net
X-Sylpheed-End-Special-Headers: 1
Date: Tue, 18 Mar 2008 19:25:04 -0700
From: Andrew Sharp <andy.sharp@onstor.com>
To: "Sripal Surendiran (HCL)" <sripal.surendiran@onstor.com>
Cc: "Sudharsan Srinivasan" <sudharsan@onstor.com>, "Tim Gardner"
 <tim.gardner@onstor.com>, "Paul Hammer" <paul.hammer@onstor.com>, "Narain
 Ramadass" <narain.ramadass@onstor.com>
Subject: Re: FTI code + Migration script review
Message-ID: <20080318192504.3540ade5@ripper.onstor.net>
In-Reply-To: <BB375AF679D4A34E9CA8DFA650E2B04E02025662@onstor-exch02.onstor.net>
References: <BB375AF679D4A34E9CA8DFA650E2B04E05B95C4A@onstor-exch02.onstor.net>
	<20080314183550.70e594cc@ripper.onstor.net>
	<BB375AF679D4A34E9CA8DFA650E2B04E02025662@onstor-exch02.onstor.net>
Organization: Onstor
X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

linux/rootfs/Makefile


     See Larry Scheer's review of this file.


linux/rootfs/etc/init.d/onstor


     please preserve the code from initial-config that performed the
     auto-upgrade function, and keep that functionality here.

     line 40, the grep regex is fuzzy.  it doesn't skip over comment
     lines and i don't know why the 'inet' part is in there.

         grep -v '^#' /etc/network/interfaces |
             egrep "iface eth[01][ ]+.*dhcp"

     while you're here, please get rid of line 12 "... emrs crap ..."

     line 45, this comment seems to contradict what's happening in
     the code, or what should be happening?  if INITIALCONFIG=no,
     shouldn't pmtabfile be the standard one?

     line 68-69 this should be sda and sdb, not hda and hdc.

     line 92,112 again, this logic seems backwards, should be if
     INTIALCONFIG=no.  not to mention trailing whitespace on both
     these lines.

     why all the gratuitous whitespace changes starting from line 141
     to the end of the file?


linux/rootfs/etc/init.d/onstor-config


     looks ok


linux/rootfs/etc/onstor/initial-config


     excellent


linux/rootfs/sbin/dhclient-script

     i need to know some design factors here.  what's this file supposed
     to be doing?  how is it different from the standard one?

     it would seem to need a lot of comments.

     whitespace on 309, 312-314


nfx-tree/Makefile

     possibly ok

nfx-tree/code/sm-sct/taskmgr.c

     looks good

nfx-tree/code/ssc-initial-config/Makefile


     line 24,39 trailing whitespace



nfx-tree/code/ssc-initial-config/initial-config-linux.c



     >>add nfx-tree/code/ssc-initial-config/initial-config-linux.c

     line 309 function initconf_updateInterfaceConf()
     	Instead of writing shell scripts on the fly like
     	this, create a library of commonly used shell
     	functions for yourself that do these common tasks,
     	and then just invoke from your C code like so:
     	do_system(". /onstor/lib/system-config-lib.sh;
     	function_name %s %s", argument, argument);

     	Many of these functions can be culled from the current
     	initial-config script, and other places.  See my comments
     	for onstor-config.
     Sripal> Deferred for now.
     OK.  Sigh.

     line 385, this is a bogus route command.  you can let the route
     program figure out the netmask, or specify it correctly, but
     0.0.0.0 is never right, obviously.  to let route figure it out,
     which is probably best, use this:

     fprintf(fp, "route add default gw %s", gateway);

     obviously that also implies that you change the variable name to
     gateway, which is what it really is.

     Sripal>Deferred. This is how initial-config script works.
     Nack.   What is INITCONF_ROUTE_FILE?


nfx-tree/code/ssc-initial-config/initial-config-openbsd.c



     >>add nfx-tree/code/ssc-initial-config/initial-config-openbsd.c

     looks ok

nfx-tree/code/ssc-initial-config/initial-config.c


     overall very large improvement to the code in this file.

     line 265 ifdef OpenBSD normally not allowed, but i might be
     prepared to accept this one.  there are exceptions to the rule.
     perhaps put a comment above it saying what this chunk of BSD-only
     code is for.

     line 355 is there really a macro with the name
     INITCONF_INIT_CONF_FILE?  seriously.

     line 435,436, space afer '-'.  no, i'm not checking the logic of
     all those strcmp's and strcpy's ~:^)


     line 514,549 this logic is broken in several ways.  you can fix
     these like you fixed the other one.  i realize it wasn't part of
     this change, but hey.

     line 891, what does this comment mean?  what's a zombie in this
     context?

     lines 885, 909/10, 916 fix spacing



nfx-tree/code/ssc-initial-config/initial-config.h

     looks good

nfx-tree/code/ssc-initial-config/migrate.sh



     >>add nfx-tree/code/ssc-initial-config/migrate.sh

     line 274 and friends, we don't need no parens
	cat <<END >$LINUX_INT_CONF
	foo
	END

     line 388,413, please include the official list(s) of config
     files, in /onstor/lib.  see flash_install.sh or initial-config
     for examples.
     Sripal> Certain config files are irrelevant to migration.
     Nack.
     Use the lists.  They are there to support accurate maintenance of
     the code -- a developer has to be able to count on changing the
     list(s) and having that work for everything. If there is a file you
     can't tolerate copying, deal with that in tar arguments/options or
     use sed to remove it or something.

     updateCrontab() - cannot emrscron be used for this?  in conjunction
     with the modify-cron command, of course.  that way, you don't have
     to "upgrade" the crontab file.  on boot up, root crontab file is
     wiped and rebuilt every time, so this should be necessary at all.
     Sripal>I am importing only audit export details. Currently we do
     not have audit export details in cluster DB and these entry will
     not be added if we wipe crontab. Probably bug in "audit export"
     Andy> Of all the stupid....storing configuration information
     in crontab.  Jeez.  Someday this will be fixed....

     line 396, move most of this code into the reInstallCorruptFile
     function so that input md5sum does not have to be calculated twice.
     in other words, have the function do the check, issue the message
     and attempt the reinstall.

     line 456, no "" needed

     line 486, the device file might not exist for a couple of reasons,
     one of which is they forgot to insert the CF card.  perhaps you
     can output a message to that effect and ask the user to make sure
     the card is inserted, and then continue on.  also offer the option
     to exit.

     line 514 The root password

     line 516 s/get the factory default password/reset the root
     password./

     line 517 replace with "Please store the root password in a safe,
     secure place."

nfx-tree/code/ssc-initial-config/minlabel.c



     >>add nfx-tree/code/ssc-initial-config/minlabel.c

     looks ok



nfx-tree/code/ssc-initial-config/minlabel.h



     >>add nfx-tree/code/ssc-initial-config/minlabel.h

     looks ok


nfx-tree/code/ssc-nfxsh/Makefile



     looks good



nfx-tree/code/ssc-nfxsh/cmd_flash.c



     looks good



nfx-tree/code/ssc-nfxsh/vtysh-linux.c


     >>delete nfx-tree/code/ssc-nfxsh/vtysh-linux.c

     ok

nfx-tree/code/ssc-nfxsh/vtysh-openbsd.c



     >>delete nfx-tree/code/ssc-nfxsh/vtysh-openbsd.c

     ok

nfx-tree/code/ssc-nfxsh/vtysh_initial.c



     >>add nfx-tree/code/ssc-nfxsh/vtysh_initial.c

     this should have been done as an integrate of vtysh-openbsd.c,
     not a delete/add.  makes it much harder to review this way.

     please fix trailing whitespace

     line 137, why was this section of the code changed from a pipe
     to a temporary file?  there is nothing wrong with the pipe as
     far as i can see.



nfx-tree/code/ssc-pm/rc.onstor



     looks good



openbsd/src/etc/Makefile

     looks ok

openbsd/src/etc/rc


     line 224, whitespace

     line 233 i thought we weren't going to do this anymore?  pmtab and
     pmtab.init were staying put, no more copying.

openbsd/src/etc/rc.initial

     super excellent.  thank you.







On Tue, 18 Mar 2008 09:33:02 -0700 "Sripal Surendiran (HCL)"
<sripal.surendiran@onstor.com> wrote:

> Thanks Andy,
> 
> I have incorporated your review comments. Request you to re-review.
> 
> Please see my inline comments.
> 
> Thanks again,
> Sripal.
> 
> -----Original Message-----
> From: Andy Sharp 
> Sent: Saturday, March 15, 2008 7:06 AM
> To: Sudharsan Srinivasan
> Cc: Tim Gardner; Paul Hammer; Sripal Surendiran (HCL); Narain Ramadass
> Subject: Re: FTI code + Migration script review
> 
> On Thu, 13 Mar 2008 08:18:48 -0700 "Sudharsan Srinivasan"
> <sudharsan@onstor.com> wrote:
> 
> > Hi Andy,
> > While you continue your review of FTI, please pass on any review
> > comments that you have so far. Sripal can take care of these
> > comments. Also, I guess Larry has reviewed the makefiles. Kindly
> > pass on any review comments that Larry might have. 
> > Regards
> > Sudharsan
> 
> Here you go.  There is some work to do.  ifdef {OpenBSD,Linux} has to
> be removed, plus some other stuff.  I think there are one or two files
> that appear to have been a name change and not much more, but they are
> showing up as adds from perforce.  Did they start as integrates or
> were they just done as adds?
> 
> 
> 
> linux/rootfs/Makefile
> 
> 
>      See Larry Scheer's review of this file.
> 
> Sripal> No comments found
> 
> 
> linux/rootfs/etc/init.d/onstor
> 
> 
>      not happy with removal of initial-config script, but am happy
>      with emrscron related changes.
> 
>      please preserve the code from initial-config that performed the
>      auto-upgrade function, and keep that functionality here.
> Sripal>Done. Performed similar movement in BSD also.
> Affected files:
> //depot/cg_fti/openbsd/src/etc/rc
> //depot/cg_fti/openbsd/src/etc/rc.initial
> //depot/cg_fti/openbsd/src/etc/Makefile
> 
>      line 40, the grep regex is hair-raising.  please make it sane
>      and as simple as possible.  something like
> 
>      grep -v '^#' /etc/network/interfaces | egrep "iface
> eth[01][[space]]\+ dhcp"
> Sripal>Done
> 
> 
> 
> linux/rootfs/etc/init.d/onstor-config
> 
> 
>      I think someone else said this already, but I'll repeat it: fix
>      the name and/or the logic surrounding the variable INITIALCONFIG.
>      It is not intuitive or self-documenting as is.  For example,
> change the name to NOT_INITIALCONFIG or change the logic, or even
> better, change the possible values to yes/no, and have
> INITIALCONFIG=yes when the filer is in an initial config state.
> Sripal>Done
> 
>      line 38, seriously dense sed script.  for maintainability,
>      please turn it into 3 separate scripts, or better yet,
>      three separate shell functions like "interfaces_reset_type",
>      "interfaces_reset_address", "interfaces_reset_netmask" and
>      call them from this function, for greater code reuseability.
> Sripal>Done
> 
>      line 76, you can remove the call to newaliases, it is a no-op
> Sripal>Done
> 
>      line 86, add back auto-upgrade logic from
>      /etc/onstor/initial-config here.
> Sripal>Done
> 
> 
> linux/rootfs/etc/onstor/initial-config
> 
> 
>      >>delete linux/rootfs/etc/onstor/initial-config
> 
>      don't delete it, just remove it from makefile for now
> Sripal>File is preserved. Removed stuff other than auto upgrade 
> 
> 
> nfx-tree/code/sm-sct/taskmgr.c
> 
> 
>      line 93-94; 112-113 indentation style does not match surrounding
>      code.
> 
> Sripal> Nothing part of my change
> 
>      line 2333-2336, what does this do?
> 
> Sripal> added comment in code
> 
> nfx-tree/code/ssc-initial-config/Makefile
> 
> 
>      line 23 make this based on the value of $(OS) rather than
> $(PROD).
> Sripal>Done
> 
> 
> nfx-tree/code/ssc-initial-config/initial-config-linux.c
> 
> 
>      >>add nfx-tree/code/ssc-initial-config/initial-config-linux.c
> 
>      this should be an integrate of initial-config-linux.c
> Sripal> This is new file added in this branch
> 
>      please pare down that massive list of includes to only those that
>      are actually needed.
> Sripal>Done
> 
>      line 85, many whitespace violations, including trailing
> whitespace
> Sripal>Done
> 
>      line 93, return the errno, not -1.  adjust callers accordingly.
> Sripal>Changed return value to NFX_ERR and NFX_OK.
> 
>      line 99,151 not needed, fgets does this
> Sripal>Done
> 
>      line 136,233,244 trailing whitespace
> Sripal>Done
> 
>      line 142,156,164,173,177,188,196,203,207 return some kind of
>      errno value, like ENOTFOUND.  ok, i just made that up, but you
>      know what i mean. EINVAL, ENOENT, something like that.
> Sripal>Changed return value to NFX_ERR and NFX_OK
> 
>      line 244, spacing?  operators should be surrounded with a space,
>      like ==, ?, : and so on.  and of course fix the trailing space.
> Sripal>Done
> 
>      line 250 why not return the actual errno? same for all the
> returns in this function.
> Sripal>Changed return value to NFX_ERR and NFX_OK
> 
>      line function initconf_updateInterfaceConf()
>      Instead of writing shell scripts on the fly like
>      this, create a library of commonly used shell
>      functions for yourself that do these common tasks,
>      and then just invoke from your C code like so:
>      do_system(". /onstor/lib/system-config-lib.sh;
>      function_name %s %s", argument, argument);
> 
>      Many of these functions can be culled from the current
>      initial-config script, and other places.  See my comments
>      for onstor-config.
> 
> Sripal> Deferred for now. This has to been put to my todo list. Will
> take up later.
> 
>      line 361 the description text and the argument variable name
>      could use some clarifying.  This method updates the default
>      gateway address in the configuration file.  gateway - ip address
>      of the gateway.  you get the idea.
> Sripal>Done
>      line 374, trailing whitespace
> Sripal>Done
>      line 385, this is a bogus route command.  you can let the route
>      program figure out the netmask, or specify it correctly, but
>      0.0.0.0 is never right, obviously.  to let route figure it out,
>      which is probably best, use this:
> 
>      fprintf(fp, "route add default gw %s", gateway);
> 
>      obviously that also implies that you change the variable name to
>      gateway, which is what it really is.
> Sripal>Deferred. This is how initial-config script works. This format
> is also used by ipmd libraries. Not sure of side effects.
> 
> nfx-tree/code/ssc-initial-config/initial-config-openbsd.c
> 
> 
>      >>add nfx-tree/code/ssc-initial-config/initial-config-openbsd.c
> 
>      I seriously doubt you need all these include files.  Please pare
>      these down to the absolute minimum.  Same goes for the Linux
>      version of this file.
> 
>      same comments as for the Linux version.
> Sripal>Done
> 
>      much trailing whitespace as well.
> Sripal>Done
> 
> 
> nfx-tree/code/ssc-initial-config/initial-config.c
> 
> 
>      Please do not use if[n]def OpenBSD or Linux, or variants thereof.
>      Read the porting guide wiki page under the Cougar project if you
>      need pointers on how to do that.
> Sripal>Done
> 
>      please clean up trailing whitespace.
> Sripal>Done
> 
>      Error return paths: in initial-config-$(OS) I said return errno
>      value instead of -1.  Well, you can do that, or you can return
>      some NFX_error_value that is appropriate.  Your choice.
> Sripal>used NFX_ERR and NFX_OK as return value
> 
>      line 10 spelling
> Sripal>Done
> 
> 
>      line 381 do not use parens in return statements.  return is not
>      a function call.
> Sripal>Done
> 
> 
>      line 385, this logic is broken in several ways.  just because a
>      string in the file is longer than INITCONF_MAX_STR_SIZE, whatever
>      the heck that is, doesn't mean an automatic error.  errors should
>      only come from the parsing part of the code. not to mention that
> if (buf[0] != '\0' && buf[strlen(buf) - 1] == '\n') might fail but the
>      string be complete.  and the assignement on line 386 is
> redundant.
> Sripal>Done
> 
>      line 458, is there some reason the last argument in this function
>      call is on another line?
> Sripal>Done
> 
>      line 519 there is a standard scanf way to specify a variable
>      field width.  please use that.  barring that, at least add a
>      comment about what this code is doing.
> Sripal>That requires you hardcode the field width in format specifier.
>        I used my MACRO for specifying the field width.
> 
>      these (void) casts are not needed.
> Sripal>Done
> 
>      line 529,564, why did these lines change?
> Sripal>Could not understand the comment
> 
>      line 646, all operators should be surrounded by space, like '|'
> Sripal>Done
> 
> 
>      After these issues have been addressed I'll re-review.
> 
> nfx-tree/code/ssc-initial-config/initial-config.h
> 
> 
>      line 22 no ifdef OpenBSD/Linux, please.  portable files should
>      remain that way, not to mention that we don't build on the target
>      system, so these macros shouldn't be counted on.  put OS specific
>      defines in $(OS).h.
> Sripal>Done
> 
>      line 95 ditto
> Sripal>Done
> 
> 
> 
> nfx-tree/code/ssc-initial-config/migrate.sh
> 
> 
>      >>add nfx-tree/code/ssc-initial-config/migrate.sh
> 
>      please clean up trailing whitespace.
> Sripal>Done
> 
>      line 117,147 do something like this instead: /bin/mount -o
>      ro,ufstype=44bsd "$SEC_DEV_FILE"4 $MOUNT_PT > /dev/null 2>&1
> Sripal>Done
> 
>      line 119,149 please use proper spacing -- operators like ']' and
>      ';' should have space around them.
> Sripal>Done
> 
>      line 229,242 use spaces or tabs to indent, not both.  tabs are
>      always preferred, of course.
> Sripal>Changed to spaces.
> 
>      line 388, please include the official list(s) of config files, in
>      /onstor/lib.  see flash_install.sh or initial-config for
> examples.
> Sripal> Certain config files are irrelevant to migration. Hence having
> my
> 	  own list.
> 
>      updateCrontab() - cannot emrscron be used for this?  in
> conjunction with the modify-cron command, of course.  that way, you
> don't have to "upgrade" the crontab file.  on boot up, root crontab
> file is wiped and rebuilt every time, so this should be necessary at
> all.
> Sripal>I am importing only audit export details. Currently we do not
> have
> 	 audit export details in cluster DB and these entry will not
>        be added if we wipe crontab. Probably bug in "audit export"
> 
>      line 513 s/send/set/
> Sripal>Done
> 
>      I like the fact that you've added code to have the user set the
>      root password in addition to the admin password.  Please put a
>      message in here to the user informing them that we cannot recover
>      this password if they lose it, so they should make a record of
>      it and keep it in a safe place;  only a system config reset will
>      allow them to get the root password again, and of course all
>      config info will be lost.
> Sripal>Done
> 
> 
> 
> 
> nfx-tree/code/ssc-initial-config/minlabel.c
> 
> 
>      >>add nfx-tree/code/ssc-initial-config/minlabel.c
> 
>      looks ok
> 
> 
> nfx-tree/code/ssc-initial-config/minlabel.h
> 
> 
>      >>add nfx-tree/code/ssc-initial-config/minlabel.h
> 
>      looks ok
> 
> nfx-tree/code/ssc-nfxsh/Makefile
> 
> 
>      looks good
> 
> 
> nfx-tree/code/ssc-nfxsh/cmd_flash.c
> 
> 
>      looks good
> 
> 
> nfx-tree/code/ssc-nfxsh/vtysh-linux.c
> 
> 
>      >>delete nfx-tree/code/ssc-nfxsh/vtysh-linux.c
> 
>      looks good
> 
> 
> nfx-tree/code/ssc-nfxsh/vtysh-openbsd.c
> 
> 
>      >>delete nfx-tree/code/ssc-nfxsh/vtysh-openbsd.c
> 
>      looks good
> 
> 
> nfx-tree/code/ssc-nfxsh/vtysh_initial.c
> 
> 
>      >>add nfx-tree/code/ssc-nfxsh/vtysh_initial.c
> 
>      this should have been done as an integrate of vtysh-openbsd.c,
>      not a delete/add
> 
>      opening description: please fix
> Sripal>Done
> 
> 
> nfx-tree/code/ssc-pm/rc.onstor
> 
> 
>      looks good
> 
> 
> openbsd/src/usr.sbin/dhcp/dhclient/scripts/dhclient-script
> 
>      revert unchanged file?
> 
> Sripal>sent you wrong file. It should be
> //depot/cg_fti/linux/rootfs/sbin/dhclient-script
> 
