On Thu, Nov 30, 2023 at 09:36:00 +0100, Peter Krempa wrote:
On Wed, Nov 29, 2023 at 21:07:24 -0700, Vivek Kashyap wrote:
> XML parsing and formatting of vf-token attribute
>
> Signed-off-by: Vivek Kashyap <vivek.kashyap(a)linux.intel.com>
> ---
> src/conf/device_conf.c | 32 ++++++++++++++++++++++++++++++--
> src/conf/device_conf.h | 3 +++
> src/conf/domain_conf.c | 8 ++++++++
> src/conf/schemas/basictypes.rng | 7 +++++++
> src/libvirt_private.syms | 1 +
> src/util/virpci.c | 7 +++++++
> src/util/virpci.h | 3 +++
> 7 files changed, 59 insertions(+), 2 deletions(-)
[...]
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 22ad43e1d7..8bda81815a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -5403,6 +5403,14 @@ virDomainDeviceInfoFormat(virBuffer *buf,
> info->addr.pci.zpci.uid.value,
> info->addr.pci.zpci.fid.value);
> }
> +
> + if (virPCIVFIOTokenIDIsPresent(&info->addr.pci.token)) {
> + char uuidstr[VIR_UUID_STRING_BUFLEN];
> +
> + virBufferAsprintf(&childBuf, "<vf-token
uuid='%s'/>\n",
> + virUUIDFormat(info->addr.pci.token.uuid,
> + uuidstr));
Also this is the wrong place to format this data. This function formats
the frontend address. You are parsing the token inside the
<source><address> sub-element.
Also add a qemuxml2xmltest case with the same input to make sure you
actually test it.
> + }
> break;
>
> case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE: