1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 12:16:49 +00:00

fix(virtsecrets): a secret in use is not deleted, and a password is stored as typed

- A secret is in use when a VM names it in a disk, a host device or its
  vTPM, or a pool in its source, by UUID or by its usage within the usage
  type, as they run and as saved. The vTPM, host devices and pools' saved
  definitions were not checked before.
- A Ceph key is taken in base64, as `ceph auth get-key` prints it; any other
  value is a password or passphrase stored as typed, spaces included.
- A new secret takes its value at once; a value refused leaves no secret.
- TLS and vTPM secrets can be created; the usage has no length limit.
- Every POST redirects; the list is read once and only with its users; a
  secret, VM or pool gone meanwhile is left out.
- domain_trees() is shared by the in-use checks of secrets, network filters,
  networks and pools; the storage page's Ceph secret picker reads the same
  listing.
This commit is contained in:
catborise 2026-10-29 09:29:20 +03:00
parent 0014b5f240
commit a95ec40f69
17 changed files with 429 additions and 249 deletions

View file

@ -1,11 +1,13 @@
from django import forms
from django.utils.translation import gettext_lazy as _
class AddSecret(forms.Form):
ephemeral = forms.ChoiceField(required=True, choices=(("no", "no"), ("yes", "yes")))
private = forms.ChoiceField(required=True, choices=(("no", "no"), ("yes", "yes")))
usage_type = forms.ChoiceField(
required=True,
choices=(("ceph", "ceph"), ("volume", "volume"), ("iscsi", "iscsi")),
choices=(("ceph", "Ceph"), ("iscsi", "iSCSI"), ("volume", _("Volume")), ("tls", "TLS"), ("vtpm", "vTPM")),
)
data = forms.CharField(max_length=100, required=True)
usage = forms.CharField()
# a password keeps its spaces; none defines the secret without a value
value = forms.CharField(required=False, strip=False)
ephemeral = forms.BooleanField(required=False)
private = forms.BooleanField(required=False)