Re: [libvirt] [PATCH] libxl: add support for memballoon device

2018-04-11 Thread Daniel P . Berrangé
On Tue, Apr 10, 2018 at 03:03:17PM -0600, Jim Fehlig wrote:
> All Xen PV and HVM with PV driver support a memory balloon device,
> which cannot be disabled through the toolstack. Model the device
> in the libxl driver, similar to the recently removed xend-based
> driver.
> 
> Signed-off-by: Jim Fehlig 
> ---
> 
> Apologies for the large amount of test file churn...
> 
> 
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 0ed914e4f..ed477330d 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -626,6 +626,32 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
>  return -1;
>  }
>  
> +/* only the 'xen' balloon device model is supported */
> +if (def->memballoon) {
> +int model = def->memballoon->model;
> +
> +switch ((virDomainMemballoonModel)model) {
> +case VIR_DOMAIN_MEMBALLOON_MODEL_XEN:
> +break;
> +case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
> +virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +   _("unsupported balloon device model '%s'"),
> +   virDomainMemballoonModelTypeToString(model));
> +return -1;
> +case VIR_DOMAIN_MEMBALLOON_MODEL_NONE:
> +virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +   "%s",
> +   _("balloon device cannot be disabled"));
> +return -1;
> +case VIR_DOMAIN_MEMBALLOON_MODEL_LAST:
> +default:
> +virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +   _("unexpected balloon device model '%d'"),
> +   model);

Just use virReportEnumRangeError(virDomainMemballoonModel, model);

Assuming that's changed

 Reviewed-by: Daniel P. Berrangé 

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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] libxl: add support for memballoon device

2018-04-10 Thread Jim Fehlig
All Xen PV and HVM with PV driver support a memory balloon device,
which cannot be disabled through the toolstack. Model the device
in the libxl driver, similar to the recently removed xend-based
driver.

Signed-off-by: Jim Fehlig 
---

Apologies for the large amount of test file churn...


 src/libxl/libxl_conf.c | 26 ++
 src/libxl/libxl_domain.c   | 10 +
 tests/sexpr2xmldata/sexpr2xml-boot-grub.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-curmem.xml   |  1 +
 .../sexpr2xml-disk-block-shareable.xml |  1 +
 tests/sexpr2xmldata/sexpr2xml-disk-block.xml   |  1 +
 .../sexpr2xml-disk-drv-blktap-qcow.xml |  1 +
 .../sexpr2xml-disk-drv-blktap-raw.xml  |  1 +
 .../sexpr2xml-disk-drv-blktap2-raw.xml |  1 +
 tests/sexpr2xmldata/sexpr2xml-disk-file.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml  |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml  |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml  |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml  |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml  |  1 +
 .../sexpr2xml-fv-serial-dev-2-ports.xml|  1 +
 .../sexpr2xml-fv-serial-dev-2nd-port.xml   |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml   |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml   |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml   |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml  |  1 +
 .../sexpr2xml-fv-serial-tcp-telnet.xml |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml   |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-sound.xml |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml  |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-utc.xml   |  1 +
 tests/sexpr2xmldata/sexpr2xml-fv-v2.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-fv.xml   |  1 +
 tests/sexpr2xmldata/sexpr2xml-net-bridged.xml  |  1 +
 tests/sexpr2xmldata/sexpr2xml-net-e1000.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-net-routed.xml   |  1 +
 tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml  |  1 +
 tests/sexpr2xmldata/sexpr2xml-pci-devs.xml |  1 +
 .../sexpr2xml-pv-bootloader-cmdline.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-pv-localtime.xml |  1 +
 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml |  1 +
 .../sexpr2xml-pv-vfb-new-vncdisplay.xml|  1 +
 tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml   |  1 +
 .../sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml  |  1 +
 tests/sexpr2xmldata/sexpr2xml-pv.xml   |  1 +
 tests/sexpr2xmldata/sexpr2xml-vif-rate.xml |  1 +
 tests/xlconfigdata/test-channel-pty.xml|  1 +
 tests/xlconfigdata/test-channel-unix.xml   |  1 +
 .../test-disk-positional-parms-full.xml|  1 +
 .../test-disk-positional-parms-partial.xml |  1 +
 tests/xlconfigdata/test-disk-qed.xml   |  1 +
 ...est-fullvirt-direct-kernel-boot-bogus-extra.xml |  1 +
 .../test-fullvirt-direct-kernel-boot-extra.xml |  1 +
 .../test-fullvirt-direct-kernel-boot.xml   |  1 +
 tests/xlconfigdata/test-fullvirt-hpet-timer.xml|  1 +
 tests/xlconfigdata/test-fullvirt-multi-timer.xml   |  1 +
 tests/xlconfigdata/test-fullvirt-multiserial.xml   |  1 +
 tests/xlconfigdata/test-fullvirt-multiusb.xml  |  1 +
 .../test-fullvirt-nestedhvm-disabled.xml   |  1 +
 tests/xlconfigdata/test-fullvirt-nestedhvm.xml |  1 +
 tests/xlconfigdata/test-fullvirt-nohap.xml |  1 +
 tests/xlconfigdata/test-fullvirt-ovmf.xml  |  1 +
 tests/xlconfigdata/test-fullvirt-tsc-timer.xml |  1 +
 tests/xlconfigdata/test-fullvirt-vnuma.xml |  1 +
 tests/xlconfigdata/test-new-disk.xml   |  1 +
 .../test-paravirt-cmdline-bogus-extra-root.xml |  1 +
 .../test-paravirt-cmdline-extra-root.xml   |  1 +
 tests/xlconfigdata/test-paravirt-cmdline.xml   |  1 +
 tests/xlconfigdata/test-paravirt-maxvcpus.xml  |  1 +
 tests/xlconfigdata/test-rbd-multihost-noauth.xml   |  1 +
 tests/xlconfigdata/test-spice-features.xml |  1 +
 tests/xlconfigdata/test-spice.xml  |  1 +
 tests/xlconfigdata/test-usb.xml|  1 +
 tests/xlconfigdata/test-usbctrl.xml|  1 +
 tests/xlconfigda