Revision 4dcfe1c4
b/snf-astakos-app/astakos/im/management/commands/user-set-initial-quota.py | ||
---|---|---|
41 | 41 |
from astakos.im.models import AstakosUser |
42 | 42 |
|
43 | 43 |
AddResourceArgs = namedtuple('AddQuotaArgs', ('resource', |
44 |
'quantity', |
|
45 | 44 |
'capacity', |
45 |
'quantity', |
|
46 | 46 |
'import_limit', |
47 | 47 |
'export_limit')) |
48 | 48 |
|
49 | 49 |
class Command(BaseCommand): |
50 |
help = "Import account quota policies" |
|
50 |
args = "<exported_quotas>" |
|
51 |
help = """Import user quota limits from file |
|
52 |
|
|
53 |
The file must contain non-empty lines, and each line must |
|
54 |
contain a single-space-separated list of values: |
|
55 |
|
|
56 |
<user> <resource name> <capacity> <quantity> <import_limit> <export_limit> |
|
57 |
|
|
58 |
For example to grant the following user with 10 private networks |
|
59 |
(independent of any he receives from projects): |
|
60 |
|
|
61 |
6119a50b-cbc7-42c0-bafc-4b6570e3f6ac cyclades.network.private 10 0 1000000 1000000 |
|
62 |
|
|
63 |
The last two values are arbitrarily large to represent no |
|
64 |
import/export limit at all. |
|
51 | 65 |
|
66 |
""" |
|
52 | 67 |
def handle(self, *args, **options): |
53 | 68 |
if len(args) != 1: |
54 | 69 |
raise CommandError('Invalid number of arguments') |
b/snf-cyclades-app/synnefo/api/management/commands/cyclades-export-quota.py | ||
---|---|---|
59 | 59 |
except IOError as e: |
60 | 60 |
raise CommandError(e) |
61 | 61 |
|
62 |
INF = str(10**30) |
|
62 | 63 |
for user, value in vms_per_user.items(): |
63 |
f.write(' '.join([user, "cyclades.vm", "%s" % value, '0', '0',
|
|
64 |
'0']))
|
|
64 |
f.write(' '.join([user, "cyclades.vm", "%s" % value, '0', INF,
|
|
65 |
INF]))
|
|
65 | 66 |
f.write('\n') |
66 | 67 |
for user, value in nets_per_user.items(): |
67 | 68 |
f.write(' '.join([user, "cyclades.network.private", "%s" % value, |
68 |
'0', '0', '0']))
|
|
69 |
'0', INF, INF]))
|
|
69 | 70 |
f.write('\n') |
70 | 71 |
|
71 | 72 |
f.close() |
b/snf-pithos-app/pithos/api/management/commands/pithos-export-quota.py | ||
---|---|---|
72 | 72 |
except IOError, e: |
73 | 73 |
raise CommandError(e) |
74 | 74 |
|
75 |
INF = str(10**30) |
|
75 | 76 |
for p in conn.execute(s).fetchall(): |
76 | 77 |
f.write(' '.join( |
77 |
[p.path, 'pithos+.diskspace', p.value, '0', '0', '0']))
|
|
78 |
[p.path, 'pithos+.diskspace', p.value, '0', INF, INF]))
|
|
78 | 79 |
f.write('\n') |
79 | 80 |
f.close() |
80 | 81 |
backend.close() |
Also available in: Unified diff