Problem / Motivation
Currently, aos-unit processes directly access storage paths on the host filesystem, leading to several issues:
Tight coupling to host filesystem : Storage layout changes require script updates throughout codebase
Difficult overlay management : Integration with overlay storage (issue Support per-node writable overlay disks on top of a base image #1 ) and TPM state (issue Add optional TPM 2.0 emulation for QEMU nodes (swtpm + QEMU tpm-tis) #5 ) requires careful path coordination
Future multi-instance complexity : Supporting multiple instances (issue Support multiple aos-unit instances on one host #3 ) will require extensive path logic
Proposed Solution
Use Linux Mount Namespaces to provide a uniform filesystem view for aos-unit processes, decoupling scripts from the physical storage layout.
Key Benefits for Single Instance
Uniform paths : All scripts use same paths regardless of actual storage location
Path isolation : Processes cannot accidentally access directories outside their designated storage
Clean abstraction : Physical storage location hidden from application layer
Easier overlay integration : Overlays (issue Support per-node writable overlay disks on top of a base image #1 ) and TPM state (issue Add optional TPM 2.0 emulation for QEMU nodes (swtpm + QEMU tpm-tis) #5 ) use predictable paths
Future-proof : Enables multiple instance support (issue Support multiple aos-unit instances on one host #3 ) without script changes
Storage Layout
Host Filesystem
/var/lib/aos-unit/
├── aos-vm-main-amd64.qcow2 # Base images at root (backward compatible)
├── aos-vm-secondary-amd64.qcow2
├── aos-vm-custom-amd64.qcow2
│
└── overlays/
└── default/ # Default instance storage
└── <all the stored data>
/var/log/aos-unit/
└── default/ # Default instance logs
└── <all the logs>
/run/aos-unit/
└── default/ # Default instance runtime
└── <all the runtime files>
Inside Mount Namespace
/var/lib/aos-unit/
├── aos-vm-main-amd64.qcow2 # Same as host (naturally visible)
├── aos-vm-secondary-amd64.qcow2
│
└── overlays/ # Bind mounted from default/overlays/
└── <all the stored data>
/var/log/aos-unit/ # Bind mounted from default/
└── <all the logs>
/run/aos-unit/ # Bind mounted from default/
└── <all the runtime files>
Acceptance Criteria
Functional Requirements
Mount namespace created on aos-unit startup
Bind mounts correctly map instance directories to uniform paths
Base images accessible at /var/lib/aos-unit/*.qcow2 inside namespace
Overlay storage works with mount namespace
TPM state stored in correct location
Logs written to correct location
Problem / Motivation
Currently, aos-unit processes directly access storage paths on the host filesystem, leading to several issues:
Proposed Solution
Use Linux Mount Namespaces to provide a uniform filesystem view for aos-unit processes, decoupling scripts from the physical storage layout.
Key Benefits for Single Instance
Storage Layout
Host Filesystem
Inside Mount Namespace
Acceptance Criteria
Functional Requirements
/var/lib/aos-unit/*.qcow2inside namespace