Re: [PATCH 2/2] libxl: allow an <emulator> to be selected in the domain config XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 29, 2013 at 03:49:41PM +0100, David Scott wrote:
> We cross-check the given path against the capabilties, and translate
> it into a libxl_device_model_version.
> 
> Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>
> ---
>  src/libxl/libxl_conf.c |   41 +++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 41 insertions(+), 0 deletions(-)
> 
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 472d116..868d0cf 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -75,6 +75,11 @@ static const char* emulator_lib32_path [] = {
>      EMULATOR_LIB32 EMULATOR_UPSTREAM,
>  };
>  
> +static const libxl_device_model_version emulator_to_device_model [] = {
> +    LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL,
> +    LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN,
> +};
> +
>  struct guest_arch {
>      virArch arch;
>      int bits;
> @@ -833,6 +838,38 @@ libxlMakeCapabilities(libxl_ctx *ctx)
>  }
>  
>  int
> +libxlMakeEmulator(virDomainDefPtr def, libxl_domain_config *d_config)
> +{
> +    virArch hostarch;
> +    const char *path;
> +    int i;
> +
> +    /* No explicit override means use the default */
> +    if (!def->emulator) {
> +        return 0;
> +    }
> +
> +    hostarch = virArchFromHost();
> +
> +    for (i = 0; i < emulator_last; ++i) {
> +       path = ((hostarch == VIR_ARCH_X86_64) ?
> +               emulator_lib64_path[i] :
> +               emulator_lib32_path[i]);
> +       if (STREQ(path, def->emulator)) {
> +           d_config->b_info.device_model_version =
> +               emulator_to_device_model[i];
> +           return 0;
> +       }
> +    }
> +
> +    virReportError(VIR_ERR_INTERNAL_ERROR,
> +                   _("libxenlight doesn't support emulator '%s'"),
> +                   def->emulator);
> +    return -1;

This check is bogus.  The capabilities XML is only intended to
list the recommended default emulator. It is perfectly aceptable
for apps to pass emulator paths that are not present in the
capabilities.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]