Commit dd56628f authored by Georgios D. Tsoukalas's avatar Georgios D. Tsoukalas
Browse files

fix and better document quota export/import

parent 4ce3054b
......@@ -41,14 +41,29 @@ from django.core.management.base import BaseCommand, CommandError
from astakos.im.models import AstakosUser
AddResourceArgs = namedtuple('AddQuotaArgs', ('resource',
'quantity',
'capacity',
'quantity',
'import_limit',
'export_limit'))
class Command(BaseCommand):
help = "Import account quota policies"
args = "<exported_quotas>"
help = """Import user quota limits from file
The file must contain non-empty lines, and each line must
contain a single-space-separated list of values:
<user> <resource name> <capacity> <quantity> <import_limit> <export_limit>
For example to grant the following user with 10 private networks
(independent of any he receives from projects):
6119a50b-cbc7-42c0-bafc-4b6570e3f6ac cyclades.network.private 10 0 1000000 1000000
The last two values are arbitrarily large to represent no
import/export limit at all.
"""
def handle(self, *args, **options):
if len(args) != 1:
raise CommandError('Invalid number of arguments')
......
......@@ -59,13 +59,14 @@ class Command(NoArgsCommand):
except IOError as e:
raise CommandError(e)
INF = str(10**30)
for user, value in vms_per_user.items():
f.write(' '.join([user, "cyclades.vm", "%s" % value, '0', '0',
'0']))
f.write(' '.join([user, "cyclades.vm", "%s" % value, '0', INF,
INF]))
f.write('\n')
for user, value in nets_per_user.items():
f.write(' '.join([user, "cyclades.network.private", "%s" % value,
'0', '0', '0']))
'0', INF, INF]))
f.write('\n')
f.close()
......
......@@ -72,9 +72,10 @@ class Command(NoArgsCommand):
except IOError, e:
raise CommandError(e)
INF = str(10**30)
for p in conn.execute(s).fetchall():
f.write(' '.join(
[p.path, 'pithos+.diskspace', p.value, '0', '0', '0']))
[p.path, 'pithos+.diskspace', p.value, '0', INF, INF]))
f.write('\n')
f.close()
backend.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment