On Wed, May 12, 2021 at 10:01:31AM -0700, William Douglas wrote: > Cloud-Hypervisor is a KVM virtualization using hypervisor. It > functions similarly to qemu and the libvirt Cloud-Hypervisor driver > uses a very similar structure to the libvirt driver. > > The biggest difference from the libvirt perspective is that the > "monitor" socket is seperated into two sockets one that commands are > issued to and one that events are notified from. The current > implementation only uses the command socket (running over a REST API > with json encoded data) with future changes to add support for the > event socket (to better handle shutdowns from inside the VM). > > This patch adds support for the following initial VM actions using the > Cloud-Hypervsior API: > * vm.create > * vm.delete > * vm.boot > * vm.shutdown > * vm.reboot > * vm.pause > * vm.resume > > To use the Cloud-Hypervisor driver, the v15.0 release of > Cloud-Hypervisor is required to be installed. > > Some additional notes: > * The curl handle is persistent but not useful to detect ch process > shutdown/crash (a future patch will address this shortcoming) > * On a 64-bit host Cloud-Hypervisor needs to support PVH and so can > emulate 32-bit mode but it isn't fully tested (a 64-bit kernel and > 32-bit userspace is fine, a 32-bit kernel isn't validated) > > Signed-off-by: William Douglas <william.doug...@intel.com>
> --- > The original RFC is > https://listman.redhat.com/archives/libvir-list/2020-August/msg01040.html > > The v1 patch is > https://listman.redhat.com/archives/libvir-list/2021-April/msg01271.html > > Changes since v1: > * Removed specfile changes as cloud-hypervisor isn't included in > distros yet We still needed an arg in the spec: -Ddriver_ch=disabled because %meson force-enables all optional features by default. > +static int > +virCHDomainDefPostParseBasic(virDomainDef *def, > + void *opaque G_GNUC_UNUSED) > +{ > + /* check for emulator and create a default one if needed */ > + if (!def->emulator) { > + if (!(def->emulator = g_find_program_in_path(CH_CMD))) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, Needed "%s", to pass 'ninja test' > + _("No emulator found for cloud-hypervisor")); > + return 1; > + } > + } > +static int > +virCHMonitorDetectUnsupportedDevices(virDomainDef *vmdef) > +{ > + int ret = 0; > + > + if (vmdef->ngraphics > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support graphics")); > + ret = 1; > + } > + if (vmdef->ncontrollers > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support controllers")); > + ret = 1; > + } > + if (vmdef->nfss > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support fss")); > + ret = 1; > + } > + if (vmdef->ninputs > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support inputs")); > + ret = 1; > + } > + if (vmdef->nsounds > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support sounds")); > + ret = 1; > + } > + if (vmdef->naudios > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support audios")); > + ret = 1; > + } > + if (vmdef->nvideos > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support videos")); > + ret = 1; > + } > + if (vmdef->nhostdevs > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support hostdevs")); > + ret = 1; > + } > + if (vmdef->nredirdevs > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support redirdevs")); > + ret = 1; > + } > + if (vmdef->nsmartcards > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support smartcards")); > + ret = 1; > + } > + if (vmdef->nserials > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support serials")); > + ret = 1; > + } > + if (vmdef->nparallels > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support parallels")); > + ret = 1; > + } > + if (vmdef->nchannels > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support channels")); > + ret = 1; > + } > + if (vmdef->nconsoles > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support consoles")); > + ret = 1; > + } > + if (vmdef->nleases > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support leases")); > + ret = 1; > + } > + if (vmdef->nhubs > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support hubs")); > + ret = 1; > + } > + if (vmdef->nseclabels > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support seclabels")); > + ret = 1; > + } > + if (vmdef->nrngs > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support rngs")); > + ret = 1; > + } > + if (vmdef->nshmems > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support shmems")); > + ret = 1; > + } > + if (vmdef->nmems > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support mems")); > + ret = 1; > + } > + if (vmdef->npanics > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support panics")); > + ret = 1; > + } > + if (vmdef->nsysinfo > 0) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > + _("Cloud-Hypervisor doesn't support sysinfo")); > + ret = 1; > + } These all needed "%s" too FWIW, as a future improvement, you can register an impl of virDomainDeviceDefPostParseCallback this callback will be invoked immediately after XML parsing, once for each device. It is passed a 'virDomainDeviceDef' which lets you do switch ((virDomainDeviceType)dev->type) case VIR_DOMAIN_DEVICE_DISK: ... case VIR_DOMAIN_DEVICE_...: ... } which means that if we later add more types of device, this will get a compile time error to force us add the new 'case' for the new type of device I fixed the format and spec file bug, and updated the version number to 7.5.0 instead of 7.3.0, and have pushed this new driver. I look forward to seeing future enhancements for it. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|