mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 09:26:03 +00:00
feat(instances): a guest that crashes or hangs is restarted or stopped
The VM Settings "When the guest crashes" choice (on_crash, restart for new VMs) never acted: a guest reports a crash through a panic device, and the panel gave VMs none. A guest whose kernel panicked stayed "running" until someone noticed. - new VMs get the panic device the host offers (get_panic_model: x86 ISA pvpanic, which Linux has built in and Windows gets with virtio-win; the PCI one elsewhere; ISA on x86 when libvirt does not tell), and an x86 machine without a watchdog of its own (not q35, which has the iTCO; not microvm, which has no PCI bus) an i6300esb - choosing Restart or Stop adds the panic device to a VM without one, an i6300esb when it has no watchdog (libvirt before 9.1 shows no iTCO on q35), and gives its watchdogs the matching action (reset, poweroff): a guest that arms its watchdog and hangs is met as one that crashed. A VM without these devices shows no choice made and says it cannot report a crash or a hang yet. From the next start, as before Checked live on a Vagrant host with a guest whose init exits (kernel panic): without the device it stayed "running (booted)"; after Stop it ended "shut off (crashed)", after Restart it booted again.
This commit is contained in:
parent
bdc5569cc8
commit
ede9e0bca7
14 changed files with 179 additions and 25 deletions
|
|
@ -4,6 +4,7 @@ import string
|
|||
|
||||
import pycdlib
|
||||
from vrtManager import util
|
||||
from vrtManager.util import WATCHDOG_ACTIONS, needs_watchdog
|
||||
from vrtManager.connection import wvmConnect
|
||||
from vrtManager.storage import rbd_source_children, wvmStorage
|
||||
|
||||
|
|
@ -103,10 +104,12 @@ class wvmCreate(wvmConnect):
|
|||
add_cdrom="sata",
|
||||
add_input="default",
|
||||
tpm_model=None,
|
||||
panic_model=None,
|
||||
):
|
||||
"""
|
||||
Create VM function. firmware: BIOS, UEFI or UEFI Secure Boot, of
|
||||
get_firmwares; tpm_model: an emulated TPM 2.0 of get_tpm_model, or none.
|
||||
get_firmwares; tpm_model: an emulated TPM 2.0 of get_tpm_model, or none;
|
||||
panic_model: the guest's panic device (get_panic_model), or none.
|
||||
"""
|
||||
caps = self.get_capabilities(arch)
|
||||
dom_caps = self.get_dom_capabilities(arch, machine)
|
||||
|
|
@ -269,6 +272,11 @@ class wvmCreate(wvmConnect):
|
|||
</video>"""
|
||||
if tpm_model:
|
||||
xml += f"""<tpm model='{tpm_model}'><backend type='emulator' version='2.0'/></tpm>"""
|
||||
# on_crash restart acts on a crash the guest reports and the watchdog on a hang, once the guest arms it
|
||||
if panic_model:
|
||||
xml += f"""<panic model='{panic_model}'/>"""
|
||||
if needs_watchdog(arch, machine):
|
||||
xml += f"""<watchdog model='i6300esb' action='{WATCHDOG_ACTIONS["restart"]}'/>"""
|
||||
# q35 plugs each PCIe device (a virtio disk, a NIC) into a root port of
|
||||
# its own and libvirt makes only as many as the VM is defined with: as
|
||||
# virt-install, 14 ports, so a running VM can take more devices
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue