Revision f600b74e snf-cyclades-app/synnefo/quotas/util.py
b/snf-cyclades-app/synnefo/quotas/util.py | ||
---|---|---|
123 | 123 |
return qs |
124 | 124 |
|
125 | 125 |
|
126 |
def get_qh_project_holdings(projects=None): |
|
127 |
qh = Quotaholder.get() |
|
128 |
if projects is None or len(projects) != 1: |
|
129 |
req = None |
|
130 |
else: |
|
131 |
req = projects[0] |
|
132 |
quotas = qh.service_get_project_quotas(req) |
|
133 |
|
|
134 |
if projects is None: |
|
135 |
return quotas |
|
136 |
|
|
137 |
qs = {} |
|
138 |
for project in projects: |
|
139 |
try: |
|
140 |
qs[project] = quotas[project] |
|
141 |
except KeyError: |
|
142 |
pass |
|
143 |
return qs |
|
144 |
|
|
145 |
|
|
126 | 146 |
def transform_quotas(quotas): |
127 | 147 |
d = {} |
128 | 148 |
for resource, counters in quotas.iteritems(): |
... | ... | |
131 | 151 |
pending = counters['pending'] |
132 | 152 |
d[resource] = (used, limit, pending) |
133 | 153 |
return d |
154 |
|
|
155 |
|
|
156 |
def transform_project_quotas(quotas): |
|
157 |
d = {} |
|
158 |
for resource, counters in quotas.iteritems(): |
|
159 |
used = counters['project_usage'] |
|
160 |
limit = counters['project_limit'] |
|
161 |
pending = counters['project_pending'] |
|
162 |
d[resource] = (used, limit, pending) |
|
163 |
return d |
Also available in: Unified diff