Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
dd56628f
Commit
dd56628f
authored
Feb 28, 2013
by
Georgios D. Tsoukalas
Browse files
fix and better document quota export/import
parent
4ce3054b
Changes
3
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/management/commands/user-set-initial-quota.py
View file @
dd56628f
...
...
@@ -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'
)
...
...
snf-cyclades-app/synnefo/api/management/commands/cyclades-export-quota.py
View file @
dd56628f
...
...
@@ -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
()
...
...
snf-pithos-app/pithos/api/management/commands/pithos-export-quota.py
View file @
dd56628f
...
...
@@ -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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment