On Thu, May 22, 2025 at 21:27:34 -0400, Aaron M. Brown wrote:
This change fixes an issue with virito console port assignment on
vioserial buses.
Currently, a virtio console device cannot be assigned to a port greater than 0 on
vioserial buses. When trying to add more than one virtio console device on a single
vioserial bus, you will get a port already exists with id 0 error.
Ideally paste the error verbatim here rather than paraphrasing it, so
that it can be looked up.
Therefore, the data needs to be passed back into info when allowZero
is true
Fixes: 16db8d2ec540 ("Add functions to track virtio-serial addresses")
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
Signed-off-by: Aaron M. Brown <aaronmbr(a)linux.ibm.com>
---
src/conf/domain_addr.c | 6 ++++++
A change in address allocation really requires a test case showing
what's happening and more importantly prevents regressions in the
future.
Ideally add the test before this change showing old behaviour and this
patch will then modify it to show how it was fixed.
qemuxmlconftest should be able to demonstrate what's going on [1]
1 file changed, 6 insertions(+)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 8dfa8feca0..bc2b0f50e8 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1737,6 +1737,12 @@ virDomainVirtioSerialAddrAssign(virDomainDef *def,
if (virDomainVirtioSerialAddrNextFromController(addrs,
&ptr->addr.vioserial)
< 0)
return -1;
+
+ if (ptr == &nfo) {
+ /* pass the vioserial data back into info */
The comment should also say why you're passing it back
+ info->addr.vioserial = ptr->addr.vioserial;
+ }
+
} else {
if (virDomainVirtioSerialAddrNext(def, addrs, &ptr->addr.vioserial,
allowZero) < 0)
[1]:
- add xml to tests/qemuxmlconfdata/ with configuration that shows the
problem
- invoke it from tests/qemuxmlconftest.c
- use VIR_TEST_REGENERATE_OUTPUT=1
PATH_TO_BUILDDIR/tests/qemuxmlconftest to generate required output
files