diff options
| author | Harshavardhana Ranganath <harsha@gluster.com> | 2010-02-18 09:55:48 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2010-02-18 08:40:15 -0800 | 
| commit | d655a395d24eed54f48ba8d3398ddefcdea554db (patch) | |
| tree | 592c901aacbc1e327bfba81ac3f3c187fdd96efc | |
| parent | 82a03894386000d89e431e95d67d43ced4a5dc50 (diff) | |
Add quota support to volgen
New options on command line
1. --volume-size-server  - Volume sizes for server side posix exports
2. --volume-size-client  - Volume sizes for client side exports
Signed-off-by: Harshavardhana <harsha@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 611 (Add quota support to volgen)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=611
| -rw-r--r-- | extras/volgen/CreateVolfile.py | 39 | ||||
| -rwxr-xr-x | extras/volgen/glusterfs-volgen.in | 5 | 
2 files changed, 41 insertions, 3 deletions
diff --git a/extras/volgen/CreateVolfile.py b/extras/volgen/CreateVolfile.py index 87ed7465952..6b12ea8ebff 100644 --- a/extras/volgen/CreateVolfile.py +++ b/extras/volgen/CreateVolfile.py @@ -26,6 +26,8 @@ class CreateVolfile:          self.host_array = server_array          self.unused = options.unused          self.debug = options.debug +        self.volume_size_server = options.size_server +        self.volume_size_client = options.size_client      def create_mount_volfile (self): @@ -151,6 +153,18 @@ class CreateVolfile:              mount_fd.write ("end-volume\n\n")              subvolumes[0] = "distribute" +        if self.volume_size_client: +            mount_fd.write ("volume quota\n") +            mount_fd.write ("    type features/quota\n") +            mount_fd.write ("    option disk-usage-limit %s\n" % self.volume_size_client) +            if self.unused: +                mount_fd.write ("#  option minimum-free-disk-limit 10GB " +                                "# minimum free disk value (default) 0\n") +                mount_fd.write ("#  option refresh-interval 10\n") +            mount_fd.write ("    subvolumes %s\n" % subvolumes[0]) +            mount_fd.write ("end-volume\n\n") + +          mount_fd.write ("volume writebehind\n")          mount_fd.write ("    type performance/write-behind\n")          mount_fd.write ("    option cache-size 4MB\n") @@ -158,8 +172,11 @@ class CreateVolfile:              mount_fd.write ("#   option enable-trickling-writes yes # Flush final write calls when network is free\n")              mount_fd.write ("#   option enable-O_SYNC yes # Enable O_SYNC for write-behind\n")              mount_fd.write ("#   option disable-for-first-nbytes 1 # Disable first nbytes with very small initial writes\n") +        if self.volume_size_client: +            mount_fd.write ("    subvolumes quota\n") +        else: +            mount_fd.write ("    subvolumes %s\n" % subvolumes[0]) -        mount_fd.write ("    subvolumes %s\n" % subvolumes[0])          mount_fd.write ("end-volume\n\n")          mount_fd.write ("volume readahead\n") @@ -192,6 +209,8 @@ class CreateVolfile:          mount_fd.write ("    subvolumes quickread\n")          mount_fd.write ("end-volume\n\n") + +          return      def create_export_volfile (self): @@ -227,12 +246,26 @@ class CreateVolfile:              exp_fd.write ("  option directory %s\n" % export)              exp_fd.write ("end-volume\n\n") +            if self.volume_size_server: +                exp_fd.write ("volume quota%d\n" % i) +                exp_fd.write ("  type features/quota\n") +                exp_fd.write ("  option disk-usage-limit %s\n" % self.volume_size_server) +                if self.unused: +                    exp_fd.write ("#  option minimum-free-disk-limit 10GB " +                                  "# minimum free disk value (default) 0\n") +                    exp_fd.write ("#  option refresh-interval 10\n") +                exp_fd.write ("  subvolumes posix%d\n" % i) +                exp_fd.write ("end-volume\n\n") + +              exp_fd.write ("volume locks%d\n" % i)              exp_fd.write ("    type features/locks\n")              if self.unused:                  exp_fd.write ("#   option mandatory on # Default off, used in specific applications\n") - -            exp_fd.write ("    subvolumes posix%d\n" % i) +            if self.volume_size_server: +                exp_fd.write ("    subvolumes quota%d\n" % i) +            else: +                exp_fd.write ("    subvolumes posix%d\n" % i)              exp_fd.write ("end-volume\n\n")              exp_fd.write ("volume brick%d\n" % i) diff --git a/extras/volgen/glusterfs-volgen.in b/extras/volgen/glusterfs-volgen.in index 638ba79758f..7ba0718246e 100755 --- a/extras/volgen/glusterfs-volgen.in +++ b/extras/volgen/glusterfs-volgen.in @@ -101,6 +101,11 @@ def generate_volume_files ():                       default=1, help="Infiniband device number <N>")      group.add_option("-c", "--conf-dir", dest="conf_dir",                       help="output directory for volume files") +    group.add_option("--volume-size-server", dest="size_server", +                     help="volume size for each server") +    group.add_option("--volume-size-client", dest="size_client", +                     help="volume size for each client") +      parse.add_option_group(group)      group = OptionGroup(parse, "Extra Options")  | 
