mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix: a network, pool or secret a VM needs is not stopped or deleted
Stopping a network cut the running VMs on it off, deleting one or a secret kept the VMs that name it from starting, and stopping a pool took the disks of running VMs away, all without a word. Each is now refused with the VMs (and, for a secret, the pools) that need it: stopping while a running VM uses it, deleting while a VM's definition names it. A disk given by its file path does not need its pool's definition. The API's pool stop is refused the same way. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ef1faf57c8
commit
887b807451
9 changed files with 268 additions and 3 deletions
|
|
@ -11,6 +11,7 @@ from libvirt import (
|
|||
VIR_SECRET_USAGE_TYPE_VOLUME,
|
||||
libvirtError,
|
||||
)
|
||||
from vrtManager.util import OperationError
|
||||
from vrtManager.virtsecrets import wvmSecrets
|
||||
|
||||
from virtsecrets.forms import AddSecret
|
||||
|
|
@ -68,7 +69,10 @@ def secrets(request, compute_id):
|
|||
messages.error(request, msg_err.as_text())
|
||||
if "delete" in request.POST:
|
||||
uuid = request.POST.get("uuid", "")
|
||||
conn.delete_secret(uuid)
|
||||
try:
|
||||
conn.delete_secret(uuid)
|
||||
except OperationError as err: # a VM disk or a pool needs it
|
||||
messages.error(request, str(err))
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
if "set_value" in request.POST:
|
||||
uuid = request.POST.get("uuid", "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue