[libvirt PATCH] qemu: Fix domain ID allocation

Peter Krempa pkrempa at redhat.com
Fri Jan 31 15:07:42 UTC 2020


On Fri, Jan 31, 2020 at 15:43:14 +0100, Ján Tomko wrote:
> The rewrite to use GLib's atomic ops functions changed the behavior
> of virAtomicIntInc - before it returned the pre-increment value.
> 
> Most of the callers using its value were adjusted, but the one
> in qemuDriverAllocateID was not. If libvirtd would reconnect to
> a running domain during startup, the next started domain would get
> the same ID:
> 
> $ virsh list
>  Id   Name       State
> --------------------------
>  1    f28live    running
>  1    f28live1   running
> 
> Use the g_atomic_add function directly (as recommended in viratomic.h)
> and add 1 to the result.
> 
> This also restores the usual numbering from 1 instead of 0.
> 
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> Fixes: 7b9645a7d127a374b8d1c83fdf9789706dbab2c9
> ---
>  src/qemu/qemu_conf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Peter Krempa <pkrempa at redhat.com>




More information about the libvir-list mailing list