1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 20:26:48 +00:00

feat(instances): a VM's RNG device and crash action in its options

Two settings the owner chose to add to Settings > Options after the
page's review with Codex. Both change the persistent definition, so
they are saved while the VM runs and used from its next start.

- Random number generator: a switch for a virtio RNG device fed from
  the host's /dev/urandom, so a new VM does not wait for entropy at
  boot. Another RNG device, or the panel's with a rate or driver, is
  shown as the VM's own and left to the XML editor.
- When the guest crashes: Restart or Stop (on_crash restart or
  destroy); libvirt's default, Stop, when the definition has none.
  Stop keeps a VM that crashes again and again down for a look. Any
  other action is shown and left to the XML editor.
This commit is contained in:
catborise 2026-10-30 16:20:32 +03:00
parent a993c12db0
commit 1150b941be
8 changed files with 177 additions and 0 deletions

View file

@ -275,6 +275,14 @@ class Instance(models.Model):
"""Whether the next start has hotpluggable vCPUs; the hot plug form shows it."""
return any(vcpu["hotpluggable"] == "yes" for vcpu in self.proxy.get_vcpus(config=True).values())
@cached_property
def config_rng(self) -> str | None:
return self.proxy.get_rng()
@cached_property
def config_on_crash(self) -> str:
return self.proxy.get_on_crash()
@cached_property
def guest_agent_ready(self) -> bool:
return self.proxy.is_agent_ready()