This patch series adds a feature that enables libvirt domains to have other
domains as dependencies.
One possible target is the simulation of a complex computing system composed of
multiple CPUs, each of which represented by a different libvirt domain. CPUs in
this example are virtualized separately, by a dedicated QEMU instance, because
all of them are booting independently. Moreover, if those CPU must share some
physical property (for example power supply or ACPI), it is meaningful to
consider them as a group.
Another possible target is Asymmetric Multi Processor (AMP) systems. Where a
master processor uses one or more slave processors to offload computation.
Master and slave have often different architectures. This patch series makes
possible to define the slave domains as dependencies of the master domain. And
the whole system to be booted with one single libvirt command.
A use-case for this libvirt extension are the recent patch series in QEMU that
enable modeling an AMP-like system with multiple QEMU instances.
[RFC v2 0/6] SDM Interface
[RFC v2 0/6] QEMU shared-memory-backend
[RFC v2 1/1] backend: multi-client-socket
Features :
----------
- When a domain A depends on a domain B (A=>B), signals are
forward-propagated from A to B. So, when a user asks the domain A to be:
- instantiated
- destroyed
- suspended
- resumed
domain B will automatically receive the same signal.
- Single-level dependency:
By construction domain dependencies are restricted to one single level,
so to avoid wrong recursive (infinite) domain dependencies. This is also
because there is no clear benefit in supporting multiple level of
dependencies between domains.
More specifically, given to domains, A and B, if A depends on B
(A=>B), then B can not have any dependency (B => C is forbidden).
How to test this patch series :
-------------------------------
The source code can be downloaded by:
git clone
https://git.virtualopensystems.com/dev/libvirt.git \
-b domain-dependency
Note: The patch series relies on the commit 95ca4fe, but with the patch
proposed by Michal Privoznik,
"[PATCH]qemuBuildVideoCommandLine: Don't access def->videos without
check"
that resolves a critical bug.
To add a dependency between two domains (for example between domaninA
and domainB), it suffices to add in the XML description of the first one:
domainA.xml:
<devices>
...
<domaindependency> /absolute/path/to/the/domainB.xml
</domaindependency>
...
</devices>
Note: The two domains mus be virtualized thanks to QEMU, and be hosted
on the same filesystem.
Finally, instanciate domainA with the command:
virsh create domainA.xml
And observe that both domains are running in the same time with:
virsh list
You can trigger the implemented signals and check that both domains
are working as one:
virsh suspend domainA
virsh resume domainA
virsh destroy domainA
Note: as mentioned, all signals are forward-propagated, so if you manipulate
the domainB directly, domainA will not be affected.
This work has been sponsored by Huawei Technologies Duesseldorf GmbH.
Valentin BOUSSON (4):
Add XML description of the new dependency device
Add the inner structure managing dependency devices
Add primitives for manipulation of dependency structures
Implement signal propagation to dependancy domains
docs/schemas/domaincommon.rng | 5 ++
src/conf/domain_conf.c | 83 +++++++++++++++++++++++++-
src/conf/domain_conf.h | 18 ++++++
src/qemu/qemu_driver.c | 135 ++++++++++++++++++++++++++++++++++++++++--
src/qemu/qemu_hotplug.c | 1 +
5 files changed, 237 insertions(+), 5 deletions(-)
--
1.9.1