On Thu, Jan 18, 2018 at 17:04:38 +0100, Michal Privoznik wrote:
> Now that we generate pr-manger alias and socket path store them
> in status XML so that they are preserved across daemon restarts.
> 
> Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
> ---
>  src/qemu/qemu_domain.c | 72 
> ++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 70 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index e8d2adf56..97996b053 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -2449,6 +2449,74 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
>  }
>  
>  
> +static int
> +qemuStorageSourcePrivateDataParsePR(xmlXPathContextPtr ctxt,
> +                                    virStorageSourcePtr src)
> +{
> +    qemuDomainStorageSourcePrivatePtr srcPriv;
> +
> +    if (!src->pr ||
> +        src->pr->enabled != VIR_TRISTATE_BOOL_YES)
> +        return 0;

This logic should not be here. If there is the field parse it. If it's
not don't parse it.

> +
> +    if (!src->privateData &&
> +        !(src->privateData = qemuDomainStorageSourcePrivateNew()))
> +        return -1;

Hmmm, we probably should make sure that this is always allocated in the
qemu driver as a separate patch preceeding this series.

> +
> +    srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
> +
> +    if (!(srcPriv->prAlias = virXPathString("string(./prAlias)", ctxt)))
> +        return -1;
> +
> +    return 0;
> +}
> +
> +
> +static int
> +qemuStorageSourcePrivateDataFormatPR(virStorageSourcePtr src,
> +                                     virBufferPtr buf)
> +{
> +    qemuDomainStorageSourcePrivatePtr srcPriv;
> +
> +    if (!src->pr ||
> +        src->pr->enabled != VIR_TRISTATE_BOOL_YES)
> +        return 0;

Same here, this logic should not be here. Presence of the alias should
be the key.

> +
> +    srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
> +
> +    virBufferAsprintf(buf, "<prAlias>%s</prAlias>\n", srcPriv->prAlias);
> +    return 0;
> +}

Attachment: signature.asc
Description: PGP signature

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

Reply via email to