[libvirt] [PATCH v2 16/23] qemu: add a flag to the cookie to prevent slirp-helper setup

John Ferlan jferlan at redhat.com
Fri Sep 6 12:53:22 UTC 2019



On 8/8/19 10:55 AM, marcandre.lureau at redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> For VM started and migrated/saved without slirp-helpers, let's prevent
> the automatic setup (as it would fail to migrate otherwise).
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  src/qemu/qemu_domain.c | 30 ++++++++++++++++++++++++++++--
>  src/qemu/qemu_domain.h |  2 ++
>  src/qemu/qemu_driver.c |  8 ++++++++
>  3 files changed, 38 insertions(+), 2 deletions(-)
> 

[...]

> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index ff83d1c024..4b49203738 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -6971,6 +6971,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
>                             bool start_paused,
>                             qemuDomainAsyncJob asyncJob)
>  {
> +    qemuDomainObjPrivatePtr priv = vm->privateData;
>      int ret = -1;
>      bool restored = false;
>      virObjectEventPtr event;
> @@ -7011,6 +7012,9 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
>          qemuDomainFixupCPUs(vm, &cookie->cpu) < 0)
>          goto cleanup;
>  
> +    if (!cookie->slirpHelper)
> +        priv->disableSlirp = true;
> +

Coverity lets me know that the above will need to have a "cookie &&" in
the if statement (similar to the lines just above it and of course the
check just below for @cookie being NULL...

John

>      if (qemuProcessStart(conn, driver, vm, cookie ? cookie->cpu : NULL,
>                           asyncJob, "stdio", *fd, path, NULL,
>                           VIR_NETDEV_VPORT_PROFILE_OP_RESTORE,
> @@ -16654,6 +16658,10 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
>                  virCPUDefFree(priv->origCPU);
>                  VIR_STEAL_PTR(priv->origCPU, origCPU);
>              }
> +
> +            if (cookie && !cookie->slirpHelper)
> +                priv->disableSlirp = true;

hmm... yeah, just like this ;-)

> +
>          } else {
>              /* Transitions 2, 3 */
>          load:
> 




More information about the libvir-list mailing list