Repository navigation
[KVM] Native support for QEMU disk error policy (rerror/werror) via disk/compute offering #14366
Description
The required feature described as a wish
Summary
KVM-hosted VM disks in CloudStack have no way to configure libvirt/QEMU's error_policy (rerror/werror in domain XML). Every disk defaults to QEMU's report policy, which means any I/O error from the backing storage — even a brief, otherwise-recoverable one — is passed straight through to the guest as a real disk error. This proposes adding first-class error_policy support to disk/compute offerings, modeled on the existing cacheMode offering attribute.
Problem / Motivation
Tested against a KVM cluster backed by NFS primary storage during a planned, successful storage-side HA failover (floating IP moved between NFS nodes in ~6s, well within normal NFS client timeouts): a VM with a continuous write workload hit a hard blk_update_request: I/O error on its data disk within 3-4 seconds of the failover starting — long before any NFS-level recovery (RPC retry, lock reclaim, grace period) had a chance to run. The guest's ext4 filesystem aborted its journal and remounted read-only (JBD2: Error -5, EXT4-fs: Remounting filesystem read-only).
Root cause: the disk's libvirt XML is <driver name='qemu' type='qcow2' cache='none'/> with no rerror/werror attribute, so QEMU's default report error policy applies — any hiccup on the backing file (NFS, iSCSI, etc.) is surfaced to the guest immediately and unconditionally. This is independent of how well the storage/HA layer itself is tuned: the guest reacts and can corrupt its own filesystem state before storage-level recovery even starts.
We confirmed (manually patching a live domain's persisted XML with error_policy='stop' and re-running the same failover) that QEMU's stop policy — which pauses the VM on I/O error and auto-resumes once the backing storage responds, instead of surfacing the error to the guest — eliminates the problem entirely: identical failover, zero guest-visible impact, domain never even needed to pause.
This affects any KVM deployment where primary storage can have a brief interruption that the storage layer itself would otherwise recover from transparently: HA/failover storage (our case), network blips to NFS/iSCSI targets, storage maintenance, etc. Today the only way to get error_policy='stop' is manually patching each VM's persisted domain XML outside of CloudStack's orchestration — which gets silently overwritten the next time CloudStack redefines the domain.
Current state (verified against main)
LibvirtVMDef.DiskDef (plugins/hypervisors/kvm/.../LibvirtVMDef.java) has no error_policy/rerror/werror field at all today — only cache, discard, io, iothread, block-size, etc. are supported on the <driver> element.
Proposed solution
Add error_policy as a first-class disk/compute offering attribute, following the exact existing plumbing for cacheMode (DiskOffering.DiskCacheMode) end to end:
- Schema: new
disk_offering.error_policycolumn (VARCHAR(16), default'report'), added todisk_offering_view,service_offering_view,volume_view— same pattern as thecache_modecolumn. - Domain model:
DiskOffering.DiskErrorPolicyenum (REPORT,STOP,IGNORE,ENOSPACE— QEMU's validerror_policyvalues),getErrorPolicy()/setErrorPolicy()onDiskOffering/DiskOfferingVO. - API: new
errorpolicyparam oncreateDiskOffering/updateDiskOffering(and compute-offering equivalents), surfaced onDiskOfferingResponse/ServiceOfferingResponse, validated inConfigurationManagerImplthe same waycacheModeis today. - Orchestration: carry the value
DiskOfferingVO→VolumeObject/VolumeObjectTO→ hypervisor command, mirroringgetCacheMode()'s path throughVolumeObjectTO. - KVM agent:
LibvirtVMDef.DiskDefgets an_errorPolicyfield + setter, rendered aserror_policy='<value>'on the<driver>element intoString(), set from the volume's offering inLibvirtComputingResource/KVMStorageProcessornext to the existingsetCacheMode(...)calls. - Other hypervisors: this is a libvirt/QEMU-specific concept; XenServer/VMware plugins would simply ignore the new offering field, consistent with other KVM-only offering attributes.
Open questions for discussion
- Should this live on disk offering only, or also on compute offering (root disk)?
cacheModesupports both — proposing the same here. - Default value:
report(current implicit behavior, fully backward compatible) vs. defaulting new offerings tostopfor safety? Leaning towardreportas default to avoid surprising existing deployments with VMs that can now pause. - Operational concern: a VM with
stoppolicy can sit paused indefinitely if the underlying storage problem never clears. Should this feature ship with (or require) companion alerting on paused-domain state, or is that left to operators?
Happy to put together a PR for this if the general direction sounds right — wanted to float the approach first since it touches the offering schema/API surface.
Activity
github-actions commentedon Oct 8, 2026
🎯 Triage report
Feature request to add a configurable QEMU
error_policy(rerror/werror) to disk/compute offerings on KVM, modeled after the existingcacheModeattribute. The reporter provides a concrete motivating scenario (brief NFS failover causing guest filesystem corruption under the defaultreportpolicy) and a detailed, well-scoped implementation proposal touching schema, domain model, API, orchestration, and the KVM agent.📊 Assessment
cacheMode), making it largely self-contained, but the reporter explicitly raises open design questions (compute vs. disk offering scope, default value, pause/alerting behavior) that need maintainer/community decisions before implementation should start.No similar or duplicate issues were found in the repository.
💡 Notes and suggestions
reportvsstop; whether paused-domain alerting should be a prerequisite) are policy/design decisions best resolved via mailing list or PR discussion before committing to an implementation.rerror/werrordomain XML disk driver element]((libvirt.org/redacted) for implementers to reference when adding the enum/validation.Add this agentic workflows to your repo
To install this agentic workflow, run
fermosan commentedon Oct 9, 2026
@DaanHoogland Hey, can you kindly evaluate this ?
DaanHoogland commentedon Oct 12, 2026
Sorry @fermosan , I have a terrible backlog.
fermosan commentedon Oct 14, 2026
@weizhouapache
DaanHoogland commentedon Oct 20, 2026
@fermosan , I had a quick scan of your request. It seems to me to be useful. It will require some effort that needs to be picked up, so no guarantees on anything :( I marked it for 25 for now.
fermosan commentedon Oct 20, 2026
Hello @DaanHoogland, thanks for looking at it. If the team can address the open questions we can develop it with priority and speed things up and hopefully make it to release 24.
DaanHoogland commentedon Oct 21, 2026
well, if you can create a PR that would be great. I am not sure if we have test resources (or you do?) but those two phases are where the work hogs usually.
Also see the Notes and suggestions part of the automated triage report.
I do think 24 will be highly optiomitic. The planned freeze date is the first week of november... 🤔
fermosan commentedon Oct 23, 2026
We have test resources since we found that while debugging a customer issue. We have also made some design before hand. For further testing any setup with primary nfs storage could work by actually making NFS Server go offline for a while and resuming. VMs should get paused and then automatically resumed. For real NFS Failover setups that would be also the case and if secondary NFS server becomes primary the interruption will be much less noticeable but again there will be a short pause/resume action. Let's start and see how it goes.
fermosan commentedon Oct 25, 2026
@DaanHoogland we have submitted the PR and also one more small fix for a completeley irrelevant to this case bug we found. #14498