Pulumi lets you auto-configure some infrastructure and then interact with it.
I'm interested in accomplishing this with local resources compared to cloud resources (which is the norm).
There is a libvirt
provider that
allows this to work using libvirt
which itself is a wrapper around various
virtualization platforms.
In main.go
is my best attempt so far at running a simple ubuntu VM on top of
qemu on macos (arm64).
brew install libvirt qemu
brew services libvirt start
The qemu
session string is currently hardcoded to the macos location of the
socket.
Currently this code fails because its generating xml for kvm
, not qemu
(or
ideally hvf
?)
Ran with pulumi up -d -v=3 --tracing $PWD/out.log
debug: Generated XML for libvirt domain:
debug: <domain type="kvm">
debug: <name>HelloUbuntu</name>
debug: <memory unit="MiB">512</memory>
debug: <vcpu>1</vcpu>
debug: <os firmware="efi">
debug: <type>hvm</type>
debug: </os>
debug: <features>
debug: <pae></pae>
debug: <acpi></acpi>
debug: <apic></apic>
debug: </features>
debug: <cpu></cpu>
debug: <devices>
debug: <channel type="unix">
debug: <target type="virtio" name="org.qemu.guest_agent.0"></target>
debug: </channel>
debug: <rng model="virtio">
debug: <backend model="random">/dev/urandom</backend>
debug: </rng>
debug: </devices>
debug: </domain>
I'm beginning to think that it isn't currently possible with pulumi-libvirt
to
spin up a local VM on qemu on macos arm64.
No matter what DomainArgs
I provide, it is always generating a domain type="kvm"
.
It seems that pulumi-libvirt
is generated by
pulumi-terraform-bridge
from terraform-provider-libvirt
.
In terraform-provider-libvirt
, the domain type seems to only support kvm
or
v
(which is some libvirt test something something)
src
As speculated in this
comment,
it seems as though the terraform-provider-libvirt
package was primarily
designed to manage linux KVM servers remotely, rather than macos locally.
I'm guessing there would need to be bigger changes to the pulumi-libvirt
integration to be able to make this work.
Various articles I've referenced while trying to get this working
- https://dustinspecker.com/posts/ubuntu-vm-pulumi-libvirt/
- https://github.com/thomasklein94/packer-plugin-libvirt/tree/9641013629b99d8732d00c550794ae02bb83976b
- https://libvirt.org/formatdomain.html
- https://www.naut.ca/blog/2021/12/09/arm64-vm-on-macos-with-libvirt-qemu/
- https://stackoverflow.com/questions/66833240/libvirt-on-apple-silicon-with-qemu-system-aarch64
libvirt mac m1 support