Revision a1623327
b/snf-cyclades-app/synnefo/logic/server_attachments.py | ||
---|---|---|
65 | 65 |
|
66 | 66 |
if volume.status == "CREATING": |
67 | 67 |
action_fields = {"disks": [("add", volume, {})]} |
68 |
else: |
|
69 |
action_fields = {} |
|
68 | 70 |
comm = commands.server_command("ATTACH_VOLUME", |
69 | 71 |
action_fields=action_fields) |
70 | 72 |
return comm(_attach_volume)(vm, volume) |
b/snf-cyclades-app/synnefo/quotas/__init__.py | ||
---|---|---|
308 | 308 |
if action == "BUILD": |
309 | 309 |
new_volumes = resource.volumes.filter(status="CREATING") |
310 | 310 |
new_volumes_size = new_volumes.aggregate(Sum("size"))["size__sum"] |
311 |
resources["cyclades.disk"] = new_volumes_size << 30
|
|
311 |
resources["cyclades.disk"] = int(new_volumes_size) << 30
|
|
312 | 312 |
resources.update(online_resources) |
313 | 313 |
return resources |
314 | 314 |
if action == "START": |
... | ... | |
329 | 329 |
elif action == "DESTROY": |
330 | 330 |
volumes = resource.volumes.filter(deleted=False) |
331 | 331 |
volumes_size = volumes.aggregate(Sum("size"))["size__sum"] |
332 |
resources["cyclades.disk"] = volumes_size << 30 |
|
333 |
resources.update(online_resources) |
|
332 |
if volumes_size is None: |
|
333 |
volumes_size = 0 |
|
334 |
resources["cyclades.disk"] = int(volumes_size) << 30 |
|
334 | 335 |
if resource.operstate in ["STARTED", "BUILD", "ERROR"]: |
335 | 336 |
resources.update(online_resources) |
336 | 337 |
return reverse_quantities(resources) |
b/snf-cyclades-app/synnefo/quotas/util.py | ||
---|---|---|
50 | 50 |
vms = vms.filter(userid=user) |
51 | 51 |
networks = networks.filter(userid=user) |
52 | 52 |
floating_ips = floating_ips.filter(userid=user) |
53 |
volumes = volumes.filter(userid=user) |
|
53 | 54 |
|
54 | 55 |
# Get resources related with VMs |
55 | 56 |
vm_resources = vms.values("userid")\ |
Also available in: Unified diff