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.
10 invirt-setquota joeuser -t 512 -s None
13 from invirt.database import *
14 from sys import argv, exit, stderr, stdout
15 from optparse import OptionParser
17 class invirt_exception(Exception): pass
21 parser = OptionParser(usage = '%prog owner [options]',
22 description = __doc__.strip().split('\n\n')[0])
23 parser.add_option('-t', '--total',
26 help = 'set the total concurrent RAM quota')
27 parser.add_option('-s', '--single',
30 help = 'set the single VM RAM quota')
31 opts, args = parser.parse_args()
34 raise invirt_exception(__doc__.strip())
39 x = Owner.query().filter_by(owner_id=owner).first()
42 if opts.total != None:
43 total = int(opts.total)
45 x.ram_quota_total = None
47 x.ram_quota_total = total
50 if opts.single != None:
51 single = int(opts.single)
53 x.ram_quota_single = None
55 x.ram_quota_single = single
62 except invirt_exception, ex:
66 if __name__ == '__main__':