Some people prefer to manage their hypervisors entirely via the libvirt control plane. At the moment these people are forced to choose the KVM hypervisor, even though libvirt also supports the Xen hypervisor. This design extends CloudStack to support management of hosts running Xen via libvirt as well as KVM. No change will be made to the XenServer plugin.
Bug Reference
None
Branch
Work in progress (ugly) patches are here:
https://github.com/djs55/cloudstack/tree/virsh-capabilities
Summary: This design extends the existing KVM/libvirt plugin to be able to manage Xen/libvirt hosts.
This work will depend on changes and improvements in other open-source projects:
Todo: document minimum Xen, libvirt versions
A cloud admin wishes to manage hosts with the libvirt control-plane (e.g. virt-manager, virsh etc) using the Xen hypervisor. The admin installs Xen and libvirt via their favourite Linux distribution. The admin logs into the CloudStack UI and creates a cluster with hypervisor type "XEN". The admin then adds a host to the cluster. A user is requests an instance and a VM is spawned on the Xen host via libvirt.
Architecture and Design description
On the choice of system VM image format: there is no need to choose a different format for Xen vs KVM as they are both able to use the same disk drivers via qemu. Therefore the Xen system VM image format should be set to .qcow2 to minimise divergence.
On using the host <-> guest private <channel> for configuration: this mechanism is used by KVM today and is a sensible design choice and a real missing feature in the libvirt libxl driver. Therefore we should implement the missing feature.
On extending the HypervisorType enum: this is a bit ugly because conceptually we have a single "libvirt" type with 2 subtypes for "Xen" and "KVM". All the code which currently says "if kvm`' needs to become "if kvm || xen".
On detecting hypervisors on the host: it would be better to always use /sys/hypervisor/type, but this doesn't appear to be populated by the KVM module. Another option is to query "virsh capabilities" but this requires the libvirt daemon to be already started, which is not required today.
No new APIs are needed
UI flow
No change to the UI flow is needed
No new dependencies need to be added to CloudStack