AF:
NF:0
PS:10
SRH:1
SFN:
DSR:
MID:
CFG:
PT:0
S:andy.sharp@onstor.com
RQ:
SSV:mail.onstor.net
NSV:
SSH:
R:<ed.kwan@onstor.com>,<jan.seidel@onstor.com>
MAID:1
X-Sylpheed-Privacy-System:
X-Sylpheed-Sign:0
SCF:#mh/Mailbox/sent
RMID:#imap/andys@onstor.net@exch1.onstor.net/INBOX	0	2779531E7C760D4491C96305019FEEB52AD1E6D5AD@exch1.onstor.net
X-Sylpheed-End-Special-Headers: 1
Date: Fri, 17 Jul 2009 12:07:55 -0700
From: Andrew Sharp <andy.sharp@onstor.com>
To: Ed Kwan <ed.kwan@onstor.com>
Cc: Jan Seidel <jan.seidel@onstor.com>
Subject: Re: please review code change for TED 26919
Message-ID: <20090717120755.4cdcc84d@ripper.onstor.net>
In-Reply-To: <2779531E7C760D4491C96305019FEEB52AD1E6D5AD@exch1.onstor.net>
References: <2779531E7C760D4491C96305019FEEB52AD1E6D583@exch1.onstor.net>
	<2779531E7C760D4491C96305019FEEB52AD1B31CA4@exch1.onstor.net>
	<2779531E7C760D4491C96305019FEEB52AD1E6D596@exch1.onstor.net>
	<20090715171129.247f1649@ripper.onstor.net>
	<2779531E7C760D4491C96305019FEEB52AD1E6D5AD@exch1.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


= Change 32884 by edk@edk-dev on 2009/07/15 15:32:25 *pending*
= 
= 	For TED 26919 LSI - /var fills up with vscan logs - Case 12588
= 	Issue a warning if the user changes the elog/vscan/quota
facility = 	to something already in use.
= 	Reviewed by 
= 


We should do more than issue a warning -- we should not allow it.



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


     line 320, separate variables, separate line (convention)

     line 349, bzero is deprecated, please use memset

     So, at line 347, you're getting the current elog config.  What's
     happening in the block starting at line 356?  I guess I'd like
     a quick and dirty thumbnail of what is the algorithm at work here
     and in this change in general.  Is this a way to check that the
     syslog file hasn't been broken by the user, or a way to keep the
     user from entering a broken config from the UI?


nfx-tree/test/t/all/features/nfxsh/elog/001_facility.t


     >>add nfx-tree/test/t/all/features/nfxsh/elog/001_facility.t


     9,17,37,44,49,57,62,70,75  trailing ws

     44,49,62,75  run-on line length


nfx-tree/test/t/test-sets/automated_run/test_config.yaml


     looks good





On Wed, 15 Jul 2009 17:20:05 -0700 Ed Kwan <ed.kwan@onstor.com> wrote:

> Same change list number: 32884.
> The test cases are done.
> 
> -----Original Message-----
> From: Andy Sharp 
> Sent: Wednesday, July 15, 2009 5:11 PM
> To: Ed Kwan
> Cc: Jan Seidel
> Subject: Re: please review code change for TED 26919
> 
> Send me the changelist # when you get those tests squared away ~:^)
> 
> Thanks,
> 
> a
> 
> 
> On Wed, 15 Jul 2009 16:22:22 -0700 Ed Kwan <ed.kwan@onstor.com> wrote:
> 
> > I think the current tests covers all the code paths, but there's
> > certainly no harm in adding the tests you mentioned.  I'll make the
> > changes now.
> > 
> > ________________________________
> > From: Jan Seidel
> > Sent: Wednesday, July 15, 2009 4:06 PM
> > To: Ed Kwan; Andy Sharp
> > Subject: RE: please review code change for TED 26919
> > 
> > 1 question about the .t file you added:
> > You only verify that a warning is issued for "elog facility" and
> > "vscan log facility". Don't you want to test the same for
> > "filesystem quota log facility"?
> > 
> > Regards,
> > Jan
> > 
> > ________________________________
> > From: Ed Kwan
> > Sent: Wednesday, July 15, 2009 3:57 PM
> > To: Andy Sharp
> > Cc: Jan Seidel
> > Subject: please review code change for TED 26919
> > 
> > [edk@edk-linux ssc-nfxsh]$ p4 describe 32884
> > Change 32884 by edk@edk-dev on 2009/07/15 15:32:25 *pending*
> > 
> >         For TED 26919 LSI - /var fills up with vscan logs - Case
> > 12588 Issue a warning if the user changes the elog/vscan/quota
> > facility to something already in use.
> >         Reviewed by
> > 
> > Affected files ...
> > 
> > ... //depot/dev/nfx-tree/code/ssc-nfxsh/cmd_elog.c#12 edit
> > ... //depot/dev/nfx-tree/test/t/all/features/nfxsh/elog/001_facility.t#1
> > add ... //depot/dev/nfx-tree/test/t/test-sets/automated_run/test_config.yaml#11
> > edit
> > 
> > [edk@edk-linux ssc-nfxsh]$ p4 info
> > User name: edk
> > Client name: edk-dev
> > Client host: edk-linux.onstor.net
> > Client root: /homes/edk/p4/dev
> > Current directory: /homes/edk/p4/dev/nfx-tree/code/ssc-nfxsh
> > Client address: 10.0.0.137:51753
> > Server address: liszt.onstor.net:1717
> > Server root: /p4data/p4root
> > Server date: 2009/07/15 15:33:33 -0700 PDT
> > Server version: P4D/LINUX26X86_64/2007.2/122958 (2007/05/23)
> > Server license: ONStor 40 users (support expired 2009/05/20)
> > [edk@edk-linux ssc-nfxsh]$ p4 diff -dc ...
> > ==== //depot/dev/nfx-tree/code/ssc-nfxsh/cmd_elog.c#12
> > - /homes/edk/p4/dev/nfx-tree/code/ssc-nfxsh/cmd_elog.c ====
> > *************** *** 317,323 ****
> >   {
> >       int rc;
> >       int rsp;
> > !     elog_configNtfy_t   elogCfgReq;
> > 
> >       bzero((void *) &elogCfgReq, sizeof(elog_configNtfy_t));
> > 
> > --- 317,325 ----
> >   {
> >       int rc;
> >       int rsp;
> > !     elog_configNtfy_t   elogCfgReq,elogCurrCfgReq;
> > !     int rsplen;
> > !     elog_config_t       elogCfg;
> > 
> >       bzero((void *) &elogCfgReq, sizeof(elog_configNtfy_t));
> > 
> > ***************
> > *** 342,347 ****
> > --- 344,389 ----
> >       }
> > 
> >       /*
> > +      * Get the current elog configuration
> > +      */
> > +     bzero((void *) &elogCurrCfgReq, sizeof(elog_configNtfy_t));
> > +     elogCurrCfgReq.msgType = ELOG_CONFIG_VIEW_REQ;
> > +     rsplen = utils_send(&elogCurrCfgReq,
> > sizeof(elog_configNtfy_t),
> > +                     "elog", NFX_SSC_UNIX, SSC_SLOT, MGMTPLANE,
> > +                     _1min_4sec, &elogCfg, sizeof(elog_config_t),
> > +                     UTILS_SEND_AGILE);
> > +
> > +     if (rsplen == sizeof(elog_config_t)) {
> > +         char *elogFacility, *quotaFacility, *vscanFacility;
> > +
> > +         elogFacility = elogFacilityStr[LOG_FAC(elogCfg.facility) -
> > +                                        LOG_FAC(LOG_LOCAL0)];
> > +         quotaFacility =
> > elogFacilityStr[LOG_FAC(elogCfg.quotaFacility) -
> > +                                         LOG_FAC(LOG_LOCAL0)];
> > +         vscanFacility =
> > elogFacilityStr[LOG_FAC(elogCfg.vscanFacility) -
> > +                                         LOG_FAC(LOG_LOCAL0)];
> > +
> > +         /*
> > +          *  See if the facility is being used.
> > +          */
> > +
> > +         if (strcmp(req_option, OPTIONS_ELOG_FACILITY) &&
> > +             !strcmp(facility, elogFacility)) {
> > +             printf("Warning: facility %s already used by elog.\n",
> > facility);
> > +         }
> > +
> > +         if (strcmp(req_option, OPTIONS_ELOG_QUOTAFACILITY) &&
> > +             !strcmp(facility, quotaFacility)) {
> > +             printf("Warning: facility %s already used by quota
> > log.\n", facility);
> > +         }
> > +
> > +         if (strcmp(req_option, OPTIONS_ELOG_VSCANFACILITY) &&
> > +             !strcmp(facility, vscanFacility)) {
> > +             printf("Warning: facility %s already used by vscan
> > log.\n", facility);
> > +         }
> > +     }
> > +
> > +     /*
> >        * Send the request to ELOG daemon on SSC
> >        */
> >       rc = utils_send(&elogCfgReq, sizeof(elog_configNtfy_t),
> > 
> > [edk@edk-linux ssc-nfxsh]$ cat
> > ~/p4/dev/nfx-tree/test/t/all/features/nfxsh/elog/001_facility.t
> > #!/usr/bin/perl
> > 
> > use strict;
> > use warnings;
> > 
> > use ONStor::Test::Env;
> > use Test::Most tests => 4;
> > use ONStor::Test::Config qw(available_resources_config
> >                             log_file
> >                             );
> > use ONStor::Expect::GW::Nfxsh;
> > use Data::Dumper;
> > 
> > exit main();
> > 
> > sub main
> > {
> >     my $gw  = available_resources_config->gateway;
> >     my $nfxsh = ONStor::Expect::GW::Nfxsh->new(
> >         addr => $gw,
> >         wait_time => 30,
> >         log_stdout => 0,
> >         exp_internal => 0,
> >         log_file => [ log_file("$gw"), "w"], # 'w' truncates the log
> > file. );
> > 
> > #vscan log show config
> > #elog show config
> > #filesystem quota log show config
> > 
> > $nfxsh->elog->show("config") =~ /ELOG Facility: (\S+)/;
> > my $elog_facility = $1;
> > 
> > $nfxsh->vscan->log("show config") =~ /Vscan Log Facility: (\S+)/;
> > my $vscan_facility = $1;
> > 
> > $nfxsh->filesystem->quota("log show config") =~
> >     /Filesystem Quota Log Facility: (\S+)/;
> > my $quota_facility = $1;
> > 
> > my $output;
> > 
> >     $output = $nfxsh->elog->facility($vscan_facility);
> >     ok ($output =~ /Warning: facility $vscan_facility already used
> > by vscan log./, "Got warning when setting elog faciltiy to vscan
> > $vscan_facility" );
> > 
> >     $output = $nfxsh->elog->facility($quota_facility);
> >     ok ($output =~ /Warning: facility $quota_facility already used
> > by quota log./, "Got warning when setting elog faciltiy to quota
> > $quota_facility" );
> > 
> >     # set elog facility back to default
> >     $nfxsh->elog->facility($elog_facility);
> > 
> >     $output = $nfxsh->vscan->log("facility $elog_facility");
> >     ok ($output =~ /Warning: facility $elog_facility already used by
> > elog./, "Got warning when setting vscan faciltiy to elog
> > $elog_facility" );
> > 
> >     $output = $nfxsh->vscan->log("facility $quota_facility");
> >     ok ($output =~ /Warning: facility $quota_facility already used
> > by quota log./, "Got warning when setting vscan faciltiy to quota
> > $quota_facility" );
> > 
> >     # set vscan facility back to default
> >     $nfxsh->vscan->log("facility $vscan_facility");
> >     return 0;
> > }
> > 
> > [edk@edk-linux ssc-nfxsh]$ p4 diff
> > ~/p4/dev/nfx-tree/test/t/test-sets/automated_run/test_config.yaml
> > ==== //depot/dev/nfx-tree/test/t/test-sets/automated_run/test_config.yaml#11
> > - /homes/edk/p4/dev/nfx-tree/test/t/test-sets/automated_run/test_config.yaml
> > ==== 61a62 ?                   - "t/all/features/nfxsh/elog" ?
