Hi,
I created pull request containing initial implementation of VM Monitoring and Management for Cockpit, joint effort of Martin Betak and me.
The plugin is far from being finished, but it shows main ideas regarding UI structure, transitions and code design.
I'm pushing present code to hear feedback and ideas regarding UI and ongoing functional priorities.
In general, the goal is to have sort of virt-manager in Cockpit some day in the future.
In the short-term, I strive for a VM monitoring and basic troubleshooting tool.
Since defining new VM is a very complex task, let's start from the VM monitoring and add VM definition afterwards.
== What Is Done
Please have a look at attached screenshots.
The plugin lists VMs defined on the host. The user can see their status, basic properties and initiate basic actions (start, stop, restart).
By clicking on a VM, its detail is displayed.
The VM Detail shows additional properties, actions and history charts.
The VM Detail page can be invoked via URL '.../vms#/vm/[VMNAME]', as it might be useful for embedding.
== Internals
Recent implementation is based on polling of libvirt (virsh).
The plugin is open to add additional data/action providers, i.e. the oVirt is planed.
On the plugin's initialization, host capabilities are checked and so the appropriate provider is selected.
Added value of the oVirt provider will be in
- guest agents (monitoring and actions)
- migration
- performance (once the VDSM is already installed)
- DBus once implemented (maybe)
- access to the oVirt's engine managing whole cluster, so additional complex functionality is available and host-local changes are not in contrary to the cluster manager effort
A very first implementation was based on machined/dbus, but there was no added value, so I dropped that code.
== Code
The plugin is based on React/Redux.
React-lite is being reused, since it's already part of the Cockpit's bower.json.
The Redux part can become 'an example' for ongoing more complex plugins.
The Plugin follows ES6 syntax, so Babel has to be used.
In general, we can see a big benefit in use of webpack for the JavaScript in Cockpit.
Anyway, we tried to keep dependencies on third-party JavaScript libraries/tools at minimum and we follow recent Cockpit build conventions.
Does it make sense for Cockpit to move to webpack? We want to check beforehand whether it's worth of making effort...
== Ongoing Work
Enhance the VMs List for
- charts showing actual cpu, mem, net and disk utilization
- screenshot of a running VM
- get console
- sorting and searching
- initiate VM migration (complex task, not to be implemented in the short-term)
- dashboard-like view: show aggregated statistics
- running VMs count
- total resource consumption by VMs
- button to shut down all vms (before host maintenance)
Enhance the VM Detail page for
- VM's cpu, mem, net, disk utilization history charts (since plugin start)
- show more VM properties
- get console
Allow VM definition - since it's complex, let's start simple
- wrap basic options of 'qemu-img create' and virt-install
- accept copy&paste libvirt XML definition
- ongoing work can concentrate on related more complex topics
Add 'oVirt' as an optional provider
- use VDSM if running on the host
- use oVirt engine if accessible (add SSO or login form)
- leverage VM definition, migration and complex configuration
== How to play
I've updated the Vagrantfile to allow nested virtualization for libvirt.
The qemu and libvirt are added to the 'dnf install'.
As mentioned above, recently the plugin does not support new VM definition.
To add a testing nested-vm, you can:
$ sudo vagrant ssh
In the vagrant:
$ sudo su
$ cd /tmp
$ NAME=subVmTest1 && qemu-img create -f qcow2 ${NAME}.img 256M && virt-install -r 128 --pxe --force --nographics --noautoconsole -f ${NAME}.img -n ${NAME}
Log into Cockpit as the 'root' user (pwd 'foobar').
Please note, the created VM is for vms plugin testing only, it provides no real OS. It's purpose is 'just to be listed by the libvirt'.
--
Marek