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 <jfeh...@suse.com>
> ---
> 
> 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é <berra...@redhat.com>

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

Reply via email to