Skip to content

feat(cloudhypervisor): make watchdog policy configurable - #199

Open
czmDeRepository wants to merge 4 commits into
cocoonstack:masterfrom
czmDeRepository:fix/windows-watchdog-reboot
Open

feat(cloudhypervisor): make watchdog policy configurable#199
czmDeRepository wants to merge 4 commits into
cocoonstack:masterfrom
czmDeRepository:fix/windows-watchdog-reboot

Conversation

@czmDeRepository

@czmDeRepository czmDeRepository commented Aug 22, 2026

Copy link
Copy Markdown

Problem

Some guest or driver combinations can mishandle an armed virtio watchdog during reboot. Disabling the watchdog automatically by operating-system type is too broad: it would also remove hang recovery from healthy guests.

Fix

  • keep the virtio watchdog enabled by default for every Cloud Hypervisor guest
  • add an explicit --no-watchdog compatibility opt-out when creating a VM
  • persist the policy in VM and snapshot configuration
  • make clones inherit the snapshot's watchdog policy; clone-time override is intentionally unavailable because restore uses the snapshot's fixed device topology
  • reject incompatible Firecracker configurations before create, clone, or debug performs backend side effects
  • document guest-reboot mitigation separately from the balloon workaround

This keeps automatic watchdog recovery as the safe default while allowing operators to opt out for a guest image with a demonstrated reboot incompatibility.

Validation

  • go test ./...
  • make fmt-check vet lint

Change-Id: I370363cfe432cbdc7d996a1ab62284cf5ebc1732
@czmDeRepository
czmDeRepository force-pushed the fix/windows-watchdog-reboot branch from dff28ac to ad22695 Compare August 22, 2026 07:08
Change-Id: I668e2f9642ae17a192cb92ba7ed77521015a5486
@czmDeRepository czmDeRepository changed the title fix(cloudhypervisor): disable watchdog for Windows guests feat(cloudhypervisor): make watchdog policy configurable Aug 22, 2026
Change-Id: Ifd73381c80fcdbec2451255e78cc1ee536ba5bac

@CMGS CMGS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall direction is right, keeping the watchdog on by default with an explicit opt out beats guessing by os type. the create side wiring is clean and adds zero cost on the boot path, and tests, lint and our layout gate all pass on the branch. the one real problem is the clone side: the override never reaches the restored device, details inline. once the clone flag is dropped this looks good.

Comment thread cmd/core/vmconfig.go Outdated
Comment thread cmd/vm/commands.go Outdated
Comment thread docs/cli.md Outdated
Comment thread cmd/core/vmconfig_test.go Outdated
Comment thread docs/known-issues.md Outdated
Change-Id: I4c4e36316cad6cac0a15008390a18014961fd6be

@CMGS CMGS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, that's the shape i had in mind. two small leftovers inline, then this is good to go.

Comment thread cmd/core/vmconfig.go
if cmd.Flags().Changed("no-direct-io") {
noDirectIO, _ = cmd.Flags().GetBool("no-direct-io")
}
noWatchdog := snapCfg.NoWatchdog

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this local only existed for the override branch. with that gone it's a plain pass through, inline it like the siblings: NoWatchdog: snapCfg.NoWatchdog in the literal below and drop this line.

Comment thread cmd/vm/run.go
if err = vmCfg.Validate(); err != nil {
return cloneSetup{}, err
}
if err = validateBackendFlags(conf, vmCfg); err != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the clone flag gone this call is unreachable by construction: every knob the switch gates is inherited from the snapshot on clone, and an fc snapshot can't carry any of them because create already rejects them. the test that covered it got removed too, so this is now an untested guard for a state that can't happen. please drop these three lines and put the godoc back to 'create and debug'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants