[libvirt] [PATCH v9 05/11] qemu: Implement the driver backend for virNodeGetSEVInfo()

Erik Skultety eskultet at redhat.com
Mon Jun 11 14:05:25 UTC 2018


On Fri, Jun 08, 2018 at 09:40:55AM -0500, Brijesh Singh wrote:
> Signed-off-by: Brijesh Singh <<brijesh.singh at amd.com>>
> ---
>  src/qemu/qemu_capabilities.c |  7 ++++
>  src/qemu/qemu_capabilities.h |  4 +++
>  src/qemu/qemu_driver.c       | 82 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 93 insertions(+)
>

...

> +
> +static int
> +qemuNodeGetSEVInfo(virConnectPtr conn,
> +                   virTypedParameterPtr *params,
> +                   int *nparams,
> +                   unsigned int flags)
> +{
> +    virQEMUDriverPtr driver = conn->privateData;
> +    virCapsPtr caps = NULL;
> +    virQEMUCapsPtr qemucaps = NULL;
> +    int ret = -1;
> +
> +    if (virNodeGetSevInfoEnsureACL(conn) < 0)
> +        return ret;
> +
> +    if (!(caps = virQEMUDriverGetCapabilities(driver, true)))

you don't need ^this, I'll remove it before merging...

> +        return ret;
> +
> +    qemucaps = virQEMUCapsCacheLookupByArch(driver->qemuCapsCache,
> +                                            virArchFromHost());
> +    if (!qemucaps)
> +        goto cleanup;
> +
> +    if (!virQEMUCapsGet(qemucaps, QEMU_CAPS_SEV_GUEST)) {
> +        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
> +                       _("QEMU does not support SEV guest"));
> +        goto cleanup;
> +    }
> +
> +    if (qemuGetSEVInfoToParams(qemucaps, params, nparams, flags) < 0)
> +        goto cleanup;
> +
> +    ret = 0;
> +
> + cleanup:
> +    virObjectUnref(qemucaps);
> +    virObjectUnref(caps);

...neither ^this single unref (and the variable itself for that matter)...

Erik




More information about the libvir-list mailing list