]> xenbits.xensource.com Git - libvirt.git/commit
qemuDomainChrInsertPreAlloced: Fix adding implicit console
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 12 Apr 2023 10:41:35 +0000 (12:41 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 18 Apr 2023 14:02:35 +0000 (16:02 +0200)
commit9129643d26c275a7a25bae8757d7f0d1cd86433c
treebe5afda663f5b98021dba00080cbb029bfeec07f
parent985f78e804d80357bce0a4b70034a37ad0611181
qemuDomainChrInsertPreAlloced: Fix adding implicit console

When hotpluging a <serial/> device, we might need to add a
<console/> device with it (because of some crazy backcompat).
Now, hotplugging is done in several phases. In one of them,
qemuDomainChrPreInsert() allocates space for both devices, and
then qemuDomainChrInsertPreAlloced() actually inserts the device
into domain definition and sets up the <console/> device with it.
Except, the condition that checks whether to create the aliased
<console/> is wrong as it compares nconsoles against 0.
Surprisingly, qemuDomainChrInsertPreAllocCleanup() doesn't suffer
from the same error.

Fixes: daf51be5f1b0f7b41c0813d43d6b66edfbe4f6d9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_hotplug.c