= 009 VM Sources
:page-parent: Architecture Decision Records
:page-grand_parent: About Spectrum

// SPDX-FileCopyrightText: 2022 Unikie
// SPDX-License-Identifier: GFDL-1.3-no-invariants-or-later OR CC-BY-SA-4.0

== Status

Proposed

== Context

It should be possible for Spectrum VMs to come from the root
filesystem (for built-in VMs), or one or more
xref:../appendices/user-partition.adoc[user partitions].  One part of
making this work will be to have the system search multiple sources of
VM definitions, to produce a single view of what VMs are available.

== Decision

The system will scan /usr/img/builtin, as well as the svc/data
partition on each user partition, for VM definitions.  A single s6-rc
service directory will contain generated services for VMs from all
sources, so that tools like vm-start don't have to be aware of where
VMs come from.  (This will continue to be distinct from the s6-rc
database used for host system services.)  When a new source of VMs is
discovered, an updated database will be generated and atomically
replace the old one using
xref:https://www.skarnet.org/software/s6-rc/s6-rc-update.html[s6-rc-update].

Changes to how user partitions will be discovered and mounted, to
support having multiple user partitions, will be determined later.

== Consequences

Built-in VMs can be moved into the root filesystem, allowing the
default user partition to be empty.  This will make it easier for
people making custom Spectrum images to add custom VMs without having
to build Spectrum itself themselves -- they can simply replace the
default, empty, partition with a custom one they can produce however
they like.
