Start / Stop / Suspend marche

This commit is contained in:
Julien Duponchelle
2016-04-14 12:22:10 +02:00
parent 2841b5769e
commit 3185baff0d
3 changed files with 23 additions and 14 deletions

View File

@ -243,12 +243,12 @@ class Route(object):
if vm_id is None:
vm_id = request.match_info["device_id"]
if "controller" in request.path:
type = "controller"
else:
if "hypervisor" in request.path:
type = "compute"
else:
type = "controller"
lock_key = "{}:{}:{}".format(type, request.match_info["project_id"], vm_id)
print(lock_key)
cls._vm_locks.setdefault(lock_key, {"lock": asyncio.Lock(), "concurrency": 0})
cls._vm_locks[lock_key]["concurrency"] += 1