[libvirt] [PATCH 10/14] qemu: Track PR daemons PIDs in status XML

Peter Krempa pkrempa at redhat.com
Mon Feb 12 16:56:46 UTC 2018


On Thu, Jan 18, 2018 at 17:04:42 +0100, Michal Privoznik wrote:
> We need to keep track of spawned processes so that we can kill
> them when qemu process dies.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_domain.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 130 insertions(+)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 97996b053..4079165f9 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -131,6 +131,10 @@ static virClassPtr qemuDomainSaveCookieClass;
>  static void qemuDomainLogContextDispose(void *obj);
>  static void qemuDomainSaveCookieDispose(void *obj);
>  
> +static void
> +qemuDomainDiskPRObjectHashFree(void *payload,
> +                               const void *name);
> +
>  static int
>  qemuDomainOnceInit(void)
>  {
> @@ -1954,6 +1958,46 @@ qemuDomainObjPrivateXMLFormatAllowReboot(virBufferPtr buf,
>  }
>  
>  
> +static int
> +qemuDomainObjPrivateXMLFormatOnePR(void *payload,
> +                                   const void *name,
> +                                   void *data)
> +{
> +    qemuDomainDiskPRObjectPtr prObj = payload;
> +    virBufferPtr buf = data;
> +
> +    virBufferAddLit(buf, "<manager>\n");
> +    virBufferAdjustIndent(buf, 2);
> +    virBufferAsprintf(buf, "<alias>%s</alias>\n", (const char *) name);
> +    virBufferAsprintf(buf, "<managed>%s</managed>\n",
> +                      virTristateBoolTypeToString(virTristateBoolFromBool(prObj->managed)));
> +    virBufferEscapeString(buf, "<path>%s</path>\n", prObj->path);
> +    virBufferAsprintf(buf, "<pid>%lld</pid>\n", (long long) prObj->pid);

You don't really need any of this data for the unmanaged ones and need
the PID and path for the managed manager. So this will also need some
tweaking.

-------------- 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/bd4c0288/attachment-0001.sig>


More information about the libvir-list mailing list