[libvirt] [PATCH] lxc: fix show the wrong xml when guest start failed

Michal Privoznik mprivozn at redhat.com
Tue Jan 6 14:11:26 UTC 2015


On 22.12.2014 08:21, Luyao Huang wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1176503
>
> When guest start failed, libvirt will keep the current vm->def,
> this will make a issue that we cannot get a right xml after guest
> start failed. Pass the newDef to def will make it work well.
>
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---
>   src/lxc/lxc_process.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
> index 1c0d4e5..b7171ac 100644
> --- a/src/lxc/lxc_process.c
> +++ b/src/lxc/lxc_process.c
> @@ -1353,10 +1353,6 @@ int virLXCProcessStart(virConnectPtr conn,
>           VIR_FREE(veths[i]);
>       }
>       if (rc != 0) {
> -        if (vm->newDef) {
> -            virDomainDefFree(vm->newDef);
> -            vm->newDef = NULL;
> -        }
>           if (priv->monitor) {
>               virObjectUnref(priv->monitor);
>               priv->monitor = NULL;
> @@ -1373,6 +1369,12 @@ int virLXCProcessStart(virConnectPtr conn,
>               VIR_FREE(vm->def->seclabels[0]->label);
>               VIR_FREE(vm->def->seclabels[0]->imagelabel);
>           }
> +        if (vm->newDef) {
> +            virDomainDefFree(vm->def);
> +            vm->def = vm->newDef;
> +            vm->def->id = -1;
> +            vm->newDef = NULL;
> +        }
>       }
>       for (i = 0; i < nttyFDs; i++)
>           VIR_FORCE_CLOSE(ttyFDs[i]);
>

Shouldn't this be in virLXCProcessStop() like it is in other drivers, 
e.g. qemu?

Michal




More information about the libvir-list mailing list