Changeset 2134 for trunk/packages/invirt-base/scripts/invirt-setquotas
- Timestamp:
- Feb 17, 2009, 1:54:26 AM (16 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-base/scripts/invirt-setquotas
r2132 r2134 2 2 3 3 """ 4 invirt-setquota allows an administrator to set the RAM quotas for an owner.5 Invoking with only an owner name returns the current quotas for that owner. 6 Setting a parameter to -1 restores the default.4 invirt-setquota allows an administrator to set memory, disk, and VM quotas 5 for an owner. Invoking with only an owner name returns the current quotas for 6 that owner. Setting a parameter to -1 restores the default. 7 7 8 8 Examples: 9 9 10 invirt-setquota joeuser - t 512 -s None10 invirt-setquota joeuser -mt 512 -ms None 11 11 """ 12 12 … … 21 21 parser = OptionParser(usage = '%prog owner [options]', 22 22 description = __doc__.strip().split('\n\n')[0]) 23 parser.add_option('- t', '--total',23 parser.add_option('-m', '--mem-total', 24 24 type = 'int', 25 dest = ' total',26 help = 'set t he total concurrent RAM quota')27 parser.add_option('- s', '--single',25 dest = 'memtotal', 26 help = 'set total concurrent RAM quota') 27 parser.add_option('-n', '--mem-single', 28 28 type = 'int', 29 dest = 'single', 30 help = 'set the single VM RAM quota') 29 dest = 'memsingle', 30 help = 'set single VM RAM quota') 31 parser.add_option('-d', '--disk-total', 32 type = 'int', 33 dest = 'disktotal', 34 help = 'set total disk quota') 35 parser.add_option('-e', '--disk-single', 36 type = 'int', 37 dest = 'disksingle', 38 help = 'set single VM disk quota') 39 parser.add_option('-v', '--vms-total', 40 type = 'int', 41 dest = 'vmstotal', 42 help = 'set total VM quota') 43 parser.add_option('-w', '--vms-active', 44 type = 'int', 45 dest = 'vmsactive', 46 help = 'set active VM quota') 31 47 opts, args = parser.parse_args() 32 48 49 print opts 33 50 if len(args) != 1: 34 51 raise invirt_exception(__doc__.strip()) … … 40 57 41 58 edited = False 42 if opts. total != None:43 total = int(opts. total)59 if opts.memtotal != None: 60 total = int(opts.memtotal) 44 61 if total == -1: 45 62 x.ram_quota_total = None … … 48 65 edited = True 49 66 50 if opts. single != None:51 single = int(opts. single)67 if opts.memsingle != None: 68 single = int(opts.memsingle) 52 69 if single == -1: 53 70 x.ram_quota_single = None 54 71 else: 55 72 x.ram_quota_single = single 73 edited = True 74 75 if opts.disktotal != None: 76 total = int(opts.disktotal) 77 if total == -1: 78 x.disk_quota_total = None 79 else: 80 x.disk_quota_total = total 81 edited = True 82 83 if opts.disksingle != None: 84 single = int(opts.disksingle) 85 if single == -1: 86 x.disk_quota_single = None 87 else: 88 x.disk_quota_single = single 89 edited = True 90 91 if opts.vmstotal != None: 92 total = int(opts.vmstotal) 93 if total == -1: 94 x.vms_quota_total = None 95 else: 96 x.vms_quota_total = total 97 edited = True 98 99 if opts.vmsactive != None: 100 active = int(opts.vmsactive) 101 if active == -1: 102 x.vms_quota_active = None 103 else: 104 x.vms_quota_active = active 56 105 edited = True 57 106
Note: See TracChangeset
for help on using the changeset viewer.