mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 20:26:48 +00:00
refactor(computes): the lock helpers take claims instead of file locks
This commit is contained in:
parent
fca4a5d91c
commit
68812ddbdf
18 changed files with 545 additions and 318 deletions
|
|
@ -311,8 +311,9 @@ class CreateInstanceViewSet(viewsets.ViewSet):
|
|||
raise
|
||||
return Response({"status": str(err)}, status=status.HTTP_400_BAD_REQUEST)
|
||||
# After the definition: the VM uses the volume, so no rollback here.
|
||||
with utils.libvirt_compute_lock(compute):
|
||||
utils.refresh_instance_database(compute)
|
||||
# The refresh claims the compute itself and skips it when busy; the
|
||||
# VM exists either way, so a busy compute must not refuse the request.
|
||||
utils.refresh_instance_database(compute)
|
||||
msg = f"Instance {serializer.validated_data['name']} is created"
|
||||
return Response({"status": msg})
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue