VM creation through libvirt domain xml format
This merge request implements VM creation using the libvirt domain XML format and removes virt-install as a dependency, addressing some of issue #5 (closed) as well as a few other things listed below.
Summary of changes:
- general domain properties of domain.cpp extracted to domainconfig.cpp
- more domain config properties are stored and can be parsed from xml file
- installer feature - attempts to identify the os of user given disk image using libosinfo, otherwise prompts user to provide an os short-id
- uses libosinfo to get data of os properties (architecture, id, ...) for the xml file
- uses qdomdocument to generate a basic domain XML file (QEMU/KVM only),
-
does not use CLI of virt-install anymore. see
domaininstaller::generateXML()
for xml elements supported - uses qemu-img CLI to generate a virtual disk of specified size
- exposes objects to qml through qmlmodules (changes to cmake)
NOTE: certain devices configuration are minimal and also things are hardcoded to only work with QEMU/KVM. I have tested with making vms of fedora40, win10, and ubuntu22.04, and a few others.
Stores files in:
-
xml path: /home/{username}/.local/share/libvirt/kde-karton/config
-
virtual disk path: /home/{username}/.local/share/libvirt/images
Example: a config created by karton
New dependencies: libosinfo-1.0, glib
TODO:
-
finish extracting domain configuration from domain.cpp to new class -
finish hardcode of all elements of domain xml -
parameterize device, architecture, os id etc elements using libosinfo -
redo config object -
refreshing libvirt vms by parsing xml files for some info rather than getting from libvirt api
Later:
- properly use and store libvirt objects of network and storage pools
- support for controller devices
- extract and group domain configuration classes more
- rework ui, add properties tabs to have room for newer domain properties
- test and ensure compatibility with GNOME Boxes
Edited by Derek Lin