[virt-manager question] Advice on using libvirt with better default arguments
Cole Robinson
crobinso at redhat.com
Tue Apr 19 16:36:40 UTC 2022
On 4/8/22 11:01 PM, Cameron Showalter wrote:
> Hi,
>
> I'm trying to learn libvirt enough have a python library around it to
> manage VM's. I'm at the part where I'm trying to make almost any OS easy
> to run based solely on the ISO. (For example: If I try to start a
> Windows 10 VM, There's extra work to get the OS to see the qcow volume
> during the install. But by creating one through the virt-manager GUI, it
> see's it automatically. So this is something you've solved outside
> libvirt). I'd like to get the same defaults as virt-manager into my
> python package. To do this, any advice on the easiest / most stable
> path? A couple ways I thought of:
>
> - Maybe add virt-manager as a submodule, and call your python scripts to
> get the good default arguments? Is the back-end for your GUI stable
> enough long term for something like this?
>
> - Do those defaults come straight from the `Libosinfo` library? And by
> learning how to use that, it'll provide the default libvirt xml blocks I
> can use for libvirt?
For this type of thing most people call out directly to virt-install.
It's the closest thing to an API for 'create a VM and give me good
defaults'. Trying to use vendored virtinst/ code could work but you'll
end up reimplementing parts of virtinstall.py.
libosinfo is a critical piece but for virt-manager/virt-install usage
it's mostly 'does this OS support virtio or not' and 'give me known
install media location for OS $FOO'
- Cole
More information about the virt-tools-list
mailing list