mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
qemu_passt: Format portForward device even without address
It's almost like we've anticipated this. Our XML parser and formatter handles @address and @dev attributes of <portForward/> element completely independent of each other. And as of commit 2023_03_29.b10b983~3 passt allows handling these two separately too. All that's left is generate the cmd line according to this new fact. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2210287 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a36318be9d
commit
1c7335add9
@ -221,6 +221,7 @@ qemuPasstStart(virDomainObj *vm,
|
|||||||
for (i = 0; i < net->nPortForwards; i++) {
|
for (i = 0; i < net->nPortForwards; i++) {
|
||||||
virDomainNetPortForward *pf = net->portForwards[i];
|
virDomainNetPortForward *pf = net->portForwards[i];
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
bool emitsep = false;
|
||||||
|
|
||||||
if (pf->proto == VIR_DOMAIN_NET_PROTO_TCP) {
|
if (pf->proto == VIR_DOMAIN_NET_PROTO_TCP) {
|
||||||
virCommandAddArg(cmd, "--tcp-ports");
|
virCommandAddArg(cmd, "--tcp-ports");
|
||||||
@ -240,13 +241,17 @@ qemuPasstStart(virDomainObj *vm,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virBufferAddStr(&buf, addr);
|
virBufferAddStr(&buf, addr);
|
||||||
|
emitsep = true;
|
||||||
if (pf->dev)
|
|
||||||
virBufferAsprintf(&buf, "%%%s", pf->dev);
|
|
||||||
|
|
||||||
virBufferAddChar(&buf, '/');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pf->dev) {
|
||||||
|
virBufferAsprintf(&buf, "%%%s", pf->dev);
|
||||||
|
emitsep = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (emitsep)
|
||||||
|
virBufferAddChar(&buf, '/');
|
||||||
|
|
||||||
if (!pf->nRanges) {
|
if (!pf->nRanges) {
|
||||||
virBufferAddLit(&buf, "all");
|
virBufferAddLit(&buf, "all");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user