Repository navigation
Conversation
KVM-hosted VM disks had no way to configure libvirt/QEMU's error_policy
(rerror/werror). Every disk defaulted to QEMU's "report" policy, so any
I/O error from backing storage -- even a brief, otherwise-recoverable
one -- was passed straight through to the guest as a real disk error.
During a planned, successful NFS HA failover (VIP moved in ~6s, well
within normal client timeouts), this caused a guest's ext4 filesystem
to abort its journal and remount read-only within 3-4 seconds, long
before storage-side recovery had a chance to run.
Adds error_policy as a first-class disk/compute offering attribute,
following the existing cacheMode plumbing end to end:
- Schema: new disk_offering.error_policy column (default 'report'),
added to disk_offering_view/service_offering_view/volume_view.
- Domain model: DiskOffering.DiskErrorPolicy enum (REPORT, STOP,
IGNORE, ENOSPACE), getter/setter on DiskOffering/DiskOfferingVO.
- API: new errorpolicy param on createDiskOffering/updateDiskOffering
and the compute-offering equivalents, surfaced on
DiskOfferingResponse/ServiceOfferingResponse.
- Orchestration: value carried DiskOfferingVO -> VolumeObject ->
VolumeObjectTO -> hypervisor command.
- KVM agent: LibvirtVMDef.DiskDef renders error_policy='<value>' on
the <driver> element, set from the volume's offering in
KVMStorageProcessor next to the existing cache mode handling.
- UI: errorpolicy exposed on the Add/Clone Disk Offering and
Add/Clone Compute Offering forms, defaulting to 'report'.
Default is 'report' (fully backward compatible); supported on both
disk and compute offerings, matching cacheMode's precedent. Alerting
on a long-paused domain is left to operators/monitoring.
Verified end-to-end with error_policy=stop against a real production
NFS HA failover and a disk-full/ENOSPC test, on both Linux and
Windows guests across local, self-hosted NFS, and production-NFS
storage: VMs pause on the real I/O error and resume cleanly with zero
data loss. Also identified and documented a related limitation: a
hard-mounted NFS backend that goes silently unreachable (vs. a real
I/O error) bypasses this feature entirely, since the guest's I/O just
hangs rather than erroring -- confirmed protocol-independent across
NFSv3 and NFSv4.
Fixes Issue: apache#14366
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #14499 +/- ##
=============================================
- Coverage 20.63% 3.74% -16.90%
=============================================
Files 6489 493 -5996
Lines 590136 42573 -547563
Branches 72361 8068 -64293
=============================================
- Hits 121788 1595 -120193
+ Misses 455100 40749 -414351
+ Partials 13248 229 -13019
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…join DAOs, LibvirtCreateCommandWrapper, LibvirtComputingResource
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 19723 |
…sting in LibvirtVMDef disk rendering
|
@blueorangutan package |
|
@fermosan a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19726 |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
Description
KVM-hosted VM disks have no way to configure libvirt/QEMU's
error_policy(rerror/werror).Every disk defaults to QEMU's
reportpolicy, so any I/O error from backing storage — even abrief, otherwise-recoverable one — is passed straight through to the guest as a real disk
error. This PR adds first-class
error_policysupport to disk/compute offerings, modeled onthe existing
cacheModeoffering attribute, end to end: schema, domain model, API, KVM agent,and the Vue UI (Add/Clone offering forms).
Problem. Tested against a KVM cluster backed by NFS primary storage during a planned,
successful storage-side HA failover (floating IP moved in ~6s, well within normal NFS client
timeouts): a VM with a continuous write workload hit a hard
blk_update_request: I/O erroronits data disk within 3-4 seconds — long before any NFS-level recovery had a chance to run. The
guest's ext4 filesystem aborted its journal and remounted read-only. Root cause: the disk's
libvirt XML carries no
rerror/werrorattribute at all, so QEMU's defaultreportpolicyapplies unconditionally, independent of how well the storage/HA layer itself is tuned.
Manually patching a live domain's XML with
error_policy='stop'and re-running the samefailover eliminated the problem entirely — identical failover, zero guest-visible impact.
Today the only way to get this is manually patching each VM's persisted domain XML outside
CloudStack's orchestration, which gets silently overwritten the next time CloudStack redefines
the domain.
What this adds:
disk_offering.error_policycolumn (default'report'), propagated todisk_offering_view/service_offering_view/volume_view.DiskOffering.DiskErrorPolicyenum (REPORT,STOP,IGNORE,ENOSPACE), getter/setter onDiskOffering/DiskOfferingVO.errorpolicyparam oncreateDiskOffering/updateDiskOfferingand thecompute-offering equivalents, surfaced on
DiskOfferingResponse/ServiceOfferingResponse.DiskOfferingVO->VolumeObject/VolumeObjectTO->hypervisor command, mirroring the existing
cacheModepath.LibvirtVMDef.DiskDefrenderserror_policy='<value>'on the<driver>element, set from the volume's offering in
KVMStorageProcessor.errorpolicyexposed on the Add/Clone Disk Offering and Add/Clone Compute Offeringforms, defaulting to
report.libvirt/QEMU-specific concept.
Functional behavior change: none for existing offerings/VMs (default
reportis the currentimplicit behavior). Opt-in per offering going forward.
Default is
report(fully backward compatible); supported on both disk and compute offerings,matching
cacheMode's precedent; alerting on a long-paused domain is intentionally left tooperators/monitoring, not part of this feature.
Fixes: #14366
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Extensive manual, end-to-end testing on a real KVM cluster with three storage backends: local
disk, a self-hosted NFS pool, and a real production HA NFS cluster (Pacemaker-managed,
active/standby).
error_policy=stoppauses the VM on a real I/O error (via both adisk-full/ENOSPC test and a real production NFS HA failover) and resumes cleanly with zero
data loss end-to-end (API -> DB -> KVM agent -> libvirt -> QEMU). Without the fix (default
report), the same failover caused the guest to remount read-only within 3-4 seconds.virsh update-device --liverejects changingerror_policyon a running domain —it only takes effect from the persisted definition at next (re)start; a full stop/redefine is
required for an already-running VM to pick up a changed offering.
local-NFS, and production-NFS, mirrored for both Linux and Windows guests, to rule out
cross-contamination between disks on different pools on the same VM.
virtio-blk driver is installed (Windows has no built-in virtio drivers, so a virtio-bus data
disk is otherwise invisible to the guest).
disks spanned both outaged pools actually paused; data integrity verified via a continuous
per-second write-and-verify loop on every VM throughout, confirmed via the resulting log
sequence rather than just checking VM state.
How did you try to break this feature and the system with this change?
correctly paused under
stopand resumed with zero data loss.Linux and Windows, specifically to look for cross-contamination between a VM's own disks.
VMs paused but verifying actual data integrity afterward, not just final VM state.
root-caused a related gap via live, controlled fault injection — a storage backend that goes
silently unreachable under a
hardNFS mount (as opposed to returning a real I/O error)bypasses
error_policy=stopentirely, since the guest's I/O just hangs rather than erroring,with no visible signal to libvirt/CloudStack. Confirmed this is protocol-independent (same
behavior under NFSv3 and NFSv4) via a dedicated isolated test. Worth documenting as a known
limitation alongside this feature rather than treating it as a blocker — it's outside what
error_policycan address by itself.are set correctly.