Re: [PATCH 5/7] qemu: Wire up PR_MANAGER_STATUS_CHANGED event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 04, 2018 at 12:46:53 +0200, Michal Privoznik wrote:
> This event is emitted on the monitor if one of pr-managers lost
> connection to its pr-helper process. What libvirt needs to do is
> restart the pr-helper process iff it corresponds to managed
> pr-manager.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/qemu/qemu_monitor.c      | 15 +++++++++++++
>  src/qemu/qemu_monitor.h      | 11 +++++++++
>  src/qemu/qemu_monitor_json.c | 23 +++++++++++++++++++
>  src/qemu/qemu_process.c      | 53 ++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 102 insertions(+)

[...]


> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index f200729cb1..94b7de76d7 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -1615,6 +1615,58 @@ qemuProcessHandleDumpCompleted(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
>  }
>  
>  
> +static int
> +qemuProcessHandlePRManagerStatusChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
> +                                        virDomainObjPtr vm,
> +                                        const char *prManager,
> +                                        bool connected,
> +                                        void *opaque ATTRIBUTE_UNUSED)
> +{
> +    qemuDomainObjPrivatePtr priv;
> +    size_t i;
> +    int ret = -1;
> +
> +    virObjectLock(vm);
> +
> +    VIR_DEBUG("pr-manager %s status changed for domain %p %s connected=%d",
> +              prManager, vm, vm->def->name, connected);
> +
> +    if (connected) {
> +        /* Connect events are boring. */
> +        ret = 0;
> +        goto cleanup;
> +    }
> +    /* Disconnect events are more interesting. */
> +
> +    for (i = 0; i < vm->def->ndisks; i++) {
> +        const char *mgralias;
> +
> +        mgralias = virStorageSourceChainGetManagedPRAlias(vm->def->disks[i]->src);
> +
> +        if (STREQ_NULLABLE(prManager, mgralias))
> +            break;

I'm not a fan of this. We always know which is the managed alias and we
also know if it is supposed to be running.

The hotplug code already does not inspect disks to do this since there
is only one instance.

> +    }
> +
> +    if (i == vm->def->ndisks) {
> +        VIR_DEBUG("pr-manager %s not managed, ignoring event",
> +                  prManager);
> +        ret = 0;
> +        goto cleanup;
> +    }
> +
> +    priv = vm->privateData;
> +    priv->prDaemonRunning = false;
> +
> +    if (qemuProcessStartManagedPRDaemon(vm) < 0)

This has a timeout built in. Thus executing this from the event loop
will make the whole libvirtd get stuck until it starts. This should not
be in the event loop.

Also does every disconnect equal to the daemon crashing/stopping?

> +        goto cleanup;
> +
> +    ret = 0;

Attachment: signature.asc
Description: PGP signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux