Skip to content

[Tech Debt]: chaos-disk mountpoint is hardcoded in two places that can drift apart #63

Description

@mrhillsman

Category

Hardcoded values

Description

internal/workloads/chaos_disk.go references /mnt/data in two independent places:

  1. The shared diskSetupScript("virtwork-chdisk", "/mnt/data") call — mounts the data disk at /mnt/data.
  2. The chaosDiskScript constant — reads ${CHAOS_DISK_MOUNT:-/mnt/data} and writes chaos-disk-fill there.

The script-side env var allows the fill location to be changed (in principle), but the disk is always mounted at /mnt/data. If a user ever sets CHAOS_DISK_MOUNT (or the documented params.mount once it's wired up — see the separate chaos-params issue), the fill script will try to write to a directory that isn't a mountpoint, and df / fallocate behavior will be wrong.

Severity

Medium — increases maintenance burden or risk of future bugs

Affected Files

  • internal/workloads/chaos_disk.go — the diskSetupScript(...) call passes a literal; the chaosDiskScript script uses a separate env var with the same default

Proposed Fix

Plumb a single mountpoint value through ChaosDiskWorkload (sourced from Config.Params["mount"] once that work lands) and pass it to both:

  • diskSetupScript("virtwork-chdisk", mountpoint)
  • The rendered fill script, by sprintf'ing the mountpoint into chaosDiskScript rather than relying on env defaults

This way the disk is always mounted where the fill script writes, and there is one source of truth for the mountpoint.

Area

Workloads

Architecture Layer

Layer 3 - Workload Definitions (workloads, registry)

Additional Context

Should land alongside or after the broader chaos-params wiring issue, since this consolidation is naturally part of that work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    size/SDenotes a PR that changes 10-29 lines, ignoring generated files.tech-debtTechnical debt, code quality, or maintenance concerntriage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions