Anton,

I have a couple of requests, the code it self looks okay but could you please
resend wach patch individually and with a more descriptive changelog.

Thanks,

Eric

On Thu, 15 Jul 2010, Anton Arapov wrote:

> Eric,
> 
>   I hope you are fine with attached ones, don't want to send them
> separately.
> 
> thanks much,
> Anton.

> From 6be42cbe394d6315e4fccd679f96af67dfb97383 Mon Sep 17 00:00:00 2001
> From: Anton Arapov <[email protected]>
> Date: Thu, 15 Jul 2010 11:39:54 +0200
> Subject: [PATCH] setup_helper: whitespace fixes
> 
>   ssia. important thing in python...
> 
> Signed-off-by: Anton Arapov <[email protected]>
> ---
>  huge_page_setup_helper.py |   11 +++++------
>  1 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/huge_page_setup_helper.py b/huge_page_setup_helper.py
> index cdf3121..737b3d9 100755
> --- a/huge_page_setup_helper.py
> +++ b/huge_page_setup_helper.py
> @@ -95,13 +95,13 @@ while not userIn:
>      try:
>          userIn = raw_input("How much memory would you like to allocate for 
> huge pages? "
>                             "(input in MB, unless postfixed with GB): ")
> -     if userIn[-2:] == "GB":
> +        if userIn[-2:] == "GB":
>              userHugePageReqMB = int(userIn[0:-2]) * 1024
> -     elif userIn[-1:] == "G":
> +        elif userIn[-1:] == "G":
>              userHugePageReqMB = int(userIn[0:-1]) * 1024
> -     elif userIn[-2:] == "MB":
> +        elif userIn[-2:] == "MB":
>              userHugePageReqMB = int(userIn[0:-2])
> -     elif userIn[-1:] == "M":
> +        elif userIn[-1:] == "M":
>              userHugePageReqMB = int(userIn[0:-1])
>          else:
>              userHugePageReqMB = int(userIn)
> @@ -159,7 +159,7 @@ if userGIDReq > -1:
>      print "Group %s (gid %d) already exists, we'll use it" % (userGroupReq, 
> userGIDReq)
>  else:
>      if debug == False:
> -     os.popen("/usr/sbin/groupadd %s" % userGroupReq)
> +        os.popen("/usr/sbin/groupadd %s" % userGroupReq)
>      else:
>          print "/usr/sbin/groupadd %s" % userGroupReq
>      groupNames = os.popen("/usr/bin/getent group %s" % 
> userGroupReq).readlines()
> @@ -326,4 +326,3 @@ print " * Remaining System Memory..: %6d MB" % (memTotal 
> - userHugePageReqMB)
>  print " * Huge Page User Group.....:  %s (%d)" % (userGroupReq, userGIDReq)
>  print
> 
> -
> -- 
> 1.7.1
> 

> From ae308ad56a9ffa6e1a90a64454cdfb845d2650e5 Mon Sep 17 00:00:00 2001
> From: Anton Arapov <[email protected]>
> Date: Thu, 15 Jul 2010 11:46:45 +0200
> Subject: [PATCH] setup_helper: fix the minor arithmetic issue.
> 
>   we do want compare MiB with MiB.
> 
> Reported-by: CAI Qian <[email protected]>
> Signed-off-by: Anton Arapov <[email protected]>
> ---
>  huge_page_setup_helper.py |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/huge_page_setup_helper.py b/huge_page_setup_helper.py
> index 737b3d9..b8545ed 100755
> --- a/huge_page_setup_helper.py
> +++ b/huge_page_setup_helper.py
> @@ -109,7 +109,7 @@ while not userIn:
>          if userHugePageReqMB > (memTotal - 128):
>              userIn = None
>              print "Refusing to allocate %d, you must leave at least 128MB 
> for the system" % userHugePageReqMB
> -        elif userHugePageReqMB < (hugePageSize / 1024):
> +        elif userHugePageReqMB < (hugePageSize / (1024 * 1024)):
>              userIn = None
>              print "Sorry, allocation must be at least a page's worth!"
>          else:
> -- 
> 1.7.1
> 

> From 6ecf2a6dbf1484082527df03b658e3822bda21fc Mon Sep 17 00:00:00 2001
> From: Anton Arapov <[email protected]>
> Date: Thu, 15 Jul 2010 11:55:16 +0200
> Subject: [PATCH] setup_helper: check for permission and disable default debug 
> mode
> 
>   1. fallback gracefully with explanation;
>   2. do actual work; not just print out; // *debug*mode* off.
> 
> Signed-off-by: Anton Arapov <[email protected]>
> ---
>  huge_page_setup_helper.py |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/huge_page_setup_helper.py b/huge_page_setup_helper.py
> index b8545ed..9de0739 100755
> --- a/huge_page_setup_helper.py
> +++ b/huge_page_setup_helper.py
> @@ -10,7 +10,12 @@
>  #
>  import os
> 
> -debug = True
> +debug = False
> +
> +# must be executed under the root to operate
> +if os.geteuid() != 0:
> +    print "You must be root to setup hugepages!"
> +    os._exit(1)
> 
>  # config files we need access to
>  sysctlConf = "/etc/sysctl.conf"
> -- 
> 1.7.1
> 

> From 165958248e123bbff8f91b35f12e354267ac6d58 Mon Sep 17 00:00:00 2001
> From: Anton Arapov <[email protected]>
> Date: Thu, 15 Jul 2010 12:51:51 +0200
> Subject: [PATCH] setup_helper: make r/w ops of security/limits.d/*.conf more 
> robust.
> 
>     previous routine led to failures on
>       \n, whitespace, comment
>     in configuration file.
> 
> Reported-by: CAI Qian <[email protected]>
> Signed-off-by: Anton Arapov <[email protected]>
> ---
>  huge_page_setup_helper.py |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/huge_page_setup_helper.py b/huge_page_setup_helper.py
> index 9de0739..c4b3b16 100755
> --- a/huge_page_setup_helper.py
> +++ b/huge_page_setup_helper.py
> @@ -296,8 +296,13 @@ if debug == False:
>      for line in limitsConfLines:
>          cfgExist = False
>          for hugeUser in hugePageUserList:
> -            if line.split()[0] == hugeUser:
> -                cfgExist = True
> +            try:
> +                if line.split()[0] == hugeUser:
> +                    cfgExist = True
> +            except IndexError:
> +                # hit either white or comment line, it is safe not to take
> +                # any action and continue.
> +                pass
>          if cfgExist == True:
>              continue
>          else:
> -- 
> 1.7.1
> 


-- 
Eric B Munson
IBM Linux Technology Center
[email protected]

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to