[libvirt] [PATCH] qemu:Fix snapshot creating with vm xml persistent

Michal Privoznik mprivozn at redhat.com
Thu Aug 9 15:01:49 UTC 2018


On 08/07/2018 01:46 PM, Bobo Du wrote:
> the vm xml will be existed when the vm is undefined after started.
> blockcommit interface also has the bug with above.
> Step1:prepare a vm,eg:test1,start it and undefined
> Step2: virsh snapshot-create-as test1 --disk-only --no-metadata
> Step3:ls /etc/libvirt/qemu/test1.xml,then it will be exist here
> 
> Signed-off-by: Bobo Du <dubobo at didichuxing.com
> ---
>  src/qemu/qemu_driver.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index fb0d4a8..d977922 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -7570,6 +7570,7 @@ qemuDomainUndefineFlags(virDomainPtr dom,
>      if (!virDomainObjIsActive(vm))
>          qemuDomainRemoveInactive(driver, vm);
>  
> +    virDomainDefFree(vm->newDef);
>      ret = 0;
>   endjob:
>      qemuDomainObjEndJob(driver, vm);
> 

This doesn't feel right. Firstly, vm->newDef becomes a stale pointer
after this patch. But more importantly, if snapshot-create-as saves the
xml it is clearly not testing vm->persistent flag and the fix should
focus on that.

Michal




More information about the libvir-list mailing list