[libvirt] [PATCH 06/14] qemu: Store prAlias and prPath in status XML
Peter Krempa
pkrempa at redhat.com
Mon Feb 12 16:44:41 UTC 2018
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 <mprivozn at 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;
> +}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180212/5d4f764b/attachment-0001.sig>
More information about the libvir-list
mailing list