Revision 5083fc47 snf-cyclades-app/synnefo/quotas/__init__.py

b/snf-cyclades-app/synnefo/quotas/__init__.py
46 46
DEFAULT_SOURCE = 'system'
47 47
RESOURCES = [
48 48
    "cyclades.vm",
49
    "cyclades.total_cpu",
49 50
    "cyclades.cpu",
50
    "cyclades.active_cpu",
51 51
    "cyclades.disk",
52
    "cyclades.total_ram",
52 53
    "cyclades.ram",
53
    "cyclades.active_ram",
54 54
    "cyclades.network.private",
55 55
    "cyclades.floating_ip",
56 56
]
......
280 280
    if isinstance(resource, VirtualMachine):
281 281
        flavor = resource.flavor
282 282
        resources = {"cyclades.vm": 1,
283
                     "cyclades.cpu": flavor.cpu,
283
                     "cyclades.total_cpu": flavor.cpu,
284 284
                     "cyclades.disk": 1073741824 * flavor.disk,
285
                     "cyclades.ram": 1048576 * flavor.ram}
286
        online_resources = {"cyclades.active_cpu": flavor.cpu,
287
                            "cyclades.active_ram": 1048576 * flavor.ram}
285
                     "cyclades.total_ram": 1048576 * flavor.ram}
286
        online_resources = {"cyclades.cpu": flavor.cpu,
287
                            "cyclades.ram": 1048576 * flavor.ram}
288 288
        if action == "BUILD":
289 289
            resources.update(online_resources)
290 290
            return resources
......
311 311
            beparams = action_fields.get("beparams")
312 312
            cpu = beparams.get("vcpus", flavor.cpu)
313 313
            ram = beparams.get("maxmem", flavor.ram)
314
            return {"cyclades.cpu": cpu - flavor.cpu,
315
                    "cyclades.ram": 1048576 * (ram - flavor.ram)}
314
            return {"cyclades.total_cpu": cpu - flavor.cpu,
315
                    "cyclades.total_ram": 1048576 * (ram - flavor.ram)}
316 316
        else:
317 317
            #["CONNECT", "DISCONNECT", "SET_FIREWALL_PROFILE"]:
318 318
            return None

Also available in: Unified diff