[libvirt] [PATCH v3 12/14] conf: fix virDomainDefParseXML for parallels

Michal Privoznik mprivozn at redhat.com
Fri Apr 10 12:01:05 UTC 2015


On 07.04.2015 22:35, Dmitry Guryanov wrote:
> Handle input devices in virDomainDefParseXML properly
> in case of parallels containers and VMs.
> 
> Parallels containers support only
> VIR_DOMAIN_INPUT_BUS_PARALLELS. And if VNC is enabled
> we should add implicit mouse and keyboard.
> 
> For VMs we should add implicit PS/2 mouse and
> keyboard.
> 
> BTW, is it worth to refactor code and move
> all this code to drivers, to *DomainDefPostParse
> functions?
> 
> Signed-off-by: Dmitry Guryanov <dguryanov at parallels.com>
> ---
>  src/conf/domain_conf.c | 40 +++++++++++++++++++++++++++++++++++++---
>  1 file changed, 37 insertions(+), 3 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index fbf8052..b8a6b84 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -9458,7 +9458,7 @@ virDomainInputDefParseXML(const virDomainDef *dom,
>                                 bus);
>                  goto error;
>              }
> -        } else {
> +        } else if (STREQ(dom->os.type, "xen")) {
>              if (def->bus != VIR_DOMAIN_INPUT_BUS_XEN) {
>                  virReportError(VIR_ERR_INTERNAL_ERROR,
>                                 _("unsupported input bus %s"),
> @@ -9472,6 +9472,29 @@ virDomainInputDefParseXML(const virDomainDef *dom,
>                                 type);
>                  goto error;
>              }
> +        } else {
> +            if (dom->virtType == VIR_DOMAIN_VIRT_PARALLELS) {
> +                if (def->bus != VIR_DOMAIN_INPUT_BUS_PARALLELS) {
> +                    virReportError(VIR_ERR_INTERNAL_ERROR,
> +                                   _("parallels containers don't support "
> +                                     "input bus %s"),
> +                                   bus);
> +                    goto error;
> +                }
> +
> +                if (def->type != VIR_DOMAIN_INPUT_TYPE_MOUSE &&
> +                    def->type != VIR_DOMAIN_INPUT_TYPE_KBD) {
> +                    virReportError(VIR_ERR_INTERNAL_ERROR,
> +                                   _("parallels bus does not support "
> +                                     "%s input device"),
> +                                   type);
> +                    goto error;
> +                }
> +            } else {
> +                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                               _("Input devices are not supported by this "
> +                                 "virtualization driver."));

Missing 'goto error;'

Michal




More information about the libvir-list mailing list