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

Re: [PATCH v2 1/4] bhyve: support parsing fbuf PCI device



  Roman Bogorodskiy wrote:

> From: Fabian Freyer <fabian freyer physik tu-berlin de>
> 
> Add a new helper function, bhyveParsePCIFbuf, to parse the bhyve-argv
> parameters for a frame-buffer device to <graphics/> and <video/>
> definitions.
> 
> For now, only the listen address, port, and vga mode are detected.
> Unsupported parameters are silently skipped.
> 
> This involves upgrading the private API to expose the
> virDomainGraphicsDefNew helper function, which is used by
> bhyveParsePCIFbuf.
> 
> Signed-off-by: Fabian Freyer <fabian freyer physik tu-berlin de>
> Signed-off-by: Roman Bogorodskiy <bogorodskiy gmail com>
> ---
>  src/bhyve/bhyve_parse_command.c               | 91 ++++++++++++++++++-
>  src/libvirt_private.syms                      |  1 +
>  .../bhyveargv2xml-vnc-listen.args             | 10 ++
>  .../bhyveargv2xml-vnc-listen.xml              | 22 +++++
>  .../bhyveargv2xml-vnc-vga-io.args             | 10 ++
>  .../bhyveargv2xml-vnc-vga-io.xml              | 22 +++++
>  .../bhyveargv2xml-vnc-vga-off.args            | 10 ++
>  .../bhyveargv2xml-vnc-vga-off.xml             | 23 +++++
>  .../bhyveargv2xml-vnc-vga-on.args             | 10 ++
>  .../bhyveargv2xml-vnc-vga-on.xml              | 23 +++++
>  .../bhyveargv2xmldata/bhyveargv2xml-vnc.args  | 10 ++
>  tests/bhyveargv2xmldata/bhyveargv2xml-vnc.xml | 22 +++++
>  tests/bhyveargv2xmltest.c                     |  5 +
>  13 files changed, 258 insertions(+), 1 deletion(-)
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc-listen.args
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc-listen.xml
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc-vga-io.args
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc-vga-io.xml
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc-vga-off.args
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc-vga-off.xml
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc-vga-on.args
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc-vga-on.xml
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc.args
>  create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-vnc.xml
> 
> diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c
> index 50a5e88408..388c565317 100644
> --- a/src/bhyve/bhyve_parse_command.c
> +++ b/src/bhyve/bhyve_parse_command.c
> @@ -4,7 +4,7 @@
>   * Copyright (C) 2006-2016 Red Hat, Inc.
>   * Copyright (C) 2006 Daniel P. Berrange
>   * Copyright (c) 2011 NetApp, Inc.
> - * Copyright (C) 2016 Fabian Freyer
> + * Copyright (C) 2020 Fabian Freyer
>   *
>   * This library is free software; you can redistribute it and/or
>   * modify it under the terms of the GNU Lesser General Public
> @@ -553,6 +553,93 @@ bhyveParsePCINet(virDomainDefPtr def,
>      return -1;
>  }
>  
> +static int
> +bhyveParsePCIFbuf(virDomainDefPtr def,
> +                  virDomainXMLOptionPtr xmlopt,
> +                  unsigned caps G_GNUC_UNUSED,
> +                  unsigned bus,
> +                  unsigned slot,
> +                  unsigned function,
> +                  const char *config)
> +{
> +    /* -s slot,fbuf,wait,vga=on|io|off,rfb=<ip>:port,w=width,h=height */
> +
> +    virDomainVideoDefPtr video = NULL;
> +    virDomainGraphicsDefPtr graphics = NULL;
> +    char **params = NULL;
> +    char *param = NULL, *separator = NULL;
> +    size_t nparams = 0;
> +    unsigned int i = 0;

Interesting, some of the CI jobs complain that this should be "size_t"
(which I'll fix before merging), and some don't (including my local
environment). Wondering if that's caused by different sed versions or
something else.

> +
> +    if (!(video = virDomainVideoDefNew(xmlopt)))
> +        goto cleanup;
> +
> +    if (!(graphics = virDomainGraphicsDefNew(xmlopt)))
> +        goto cleanup;
> +
> +    graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
> +    video->info.addr.pci.bus = bus;
> +    video->info.addr.pci.slot = slot;
> +    video->info.addr.pci.function = function;

Roman Bogorodskiy

Attachment: signature.asc
Description: PGP signature


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