[libvirt] [PATCHv2 24/62] qemu: domain: Add infrastructure to generate block node names

Ján Tomko jtomko at redhat.com
Wed Aug 15 11:49:29 UTC 2018


On Mon, Aug 13, 2018 at 05:59:58PM +0200, Peter Krempa wrote:
>Node names for block objects in qemu need to be unique for an instance
>of the qemu process. Add a counter to generate objects sequentially and
>store it in the status XML so that we can restore it.
>
>The helpers added allow to create new node names and reset the counter
>after the VM process terminates.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_domain.c  | 38 ++++++++++++++++++++++++++++++++++++++
> src/qemu/qemu_domain.h  |  6 ++++++
> src/qemu/qemu_process.c |  3 +++
> 3 files changed, 47 insertions(+)
>
>diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>index e5f055f203..032ad80baa 100644
>--- a/src/qemu/qemu_domain.c
>+++ b/src/qemu/qemu_domain.c
>@@ -2438,6 +2438,9 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf,
>
>     qemuDomainObjPrivateXMLFormatPR(buf, priv);
>
>+    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
>+        virBufferAsprintf(buf, "<nodename next='%llu'/>\n", priv->nodenameindex);

Given that it's icremented before usage, shouldn't this be
<nodename last='%llu'/>
or, to match the internal variable name:
<nodename index='%llu'/>

>+
>     if (qemuDomainObjPrivateXMLFormatBlockjobs(buf, vm) < 0)
>         return -1;

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180815/0136af70/attachment-0001.sig>


More information about the libvir-list mailing list