Make app-kimchi Check and Fix Missing KVM Settings

Make app-kimchi Check and Fix Missing KVM Settings
Reported by
ClearOS (deprecated)
Kimchi (including KVM)

For some reason, RPM installation of KVM/Libvirtd missies the "default" net and pool settings. This results in errors and hence hides the "Virtualization" tab in the Wok/Kimchi Admin Console.

In order to overcome this problem, I suggest adding a feature to the app to check for default settings. If they don't exist, then the app should ask for user's permission to generate them, as in the attached mockup.

The app may use libvirt-php or may directly execute virsh commands in order to do the settings' checking and generation.

1. Check for net default setting:
If shell_exec("virsh -c qemu:///system net-info default") is null, then it's missing.

If it exits, then the app should also check its activeness, as inactive default setting may also hinders prober functionality of Kimchi (see #3 below).

2. Check for pool default setting:
If shell_exec("virsh -c qemu:///system pool-info default") is null, then it's missing.

3. Add net default settings:
virsh -c qemu:///system net-define /usr/share/libvirt/networks/default.xml
virsh -c qemu:///system net-start default
virsh -c qemu:///system net-autostart default

The app may incorporate the default.xml file instead of relaying on the one that comes with the libvirt installation.

The default net setting may result in conflict between ClearOS' dnsmasq and Libvirtd's dnsmasq as explained here: https://wiki.libvirt.org/page/Libvirtd_and_dnsmasq . The app can adopt the solution in the given link, but I'm not sure how this solution will affect ClearOS. So, this needs farther testing.

4. Add pool default settings:
No default.xml pool settings file comes with KVM installation, so:

virsh -c qemu:///system pool-define /dev/stdin <<EOF

<pool type='dir'>





virsh -c qemu:///system pool-start default
virsh -c qemu:///system pool-autostart default

PS: this feature request originated from here: https://github.com/WikiSuite/app-kimchi/issues/3#issuecomment-349730319

  1. Screen Shot 2017 12 08 At 5.12.21 AM Copy
Thursday December 7, 2017 21:53:16 EST
by techana
Thursday December 7, 2017 22:22:49 EST

Show PHP error messages