mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
Fix port value parsing for serial and parallel ports
this is the patch to fix the virDomainChrDefParseTargetXML() functionality to parse the target port from XML if available. This is necessary for multiple serial port support which is the second part of this patch. Signed-off-by: Michal Novotny <minovotn@redhat.com>
This commit is contained in:
parent
33191b419c
commit
79c3fe4d16
@ -2974,7 +2974,8 @@ virDomainChrDefParseTargetXML(virCapsPtr caps,
|
||||
default:
|
||||
portStr = virXMLPropString(cur, "port");
|
||||
if (portStr == NULL) {
|
||||
/* Not required. It will be assigned automatically later */
|
||||
/* Set to negative value to indicate we should set it later */
|
||||
def->target.port = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2984,6 +2985,7 @@ virDomainChrDefParseTargetXML(virCapsPtr caps,
|
||||
portStr);
|
||||
goto error;
|
||||
}
|
||||
def->target.port = port;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -5547,7 +5549,15 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
||||
if (!chr)
|
||||
goto error;
|
||||
|
||||
chr->target.port = i;
|
||||
if (chr->target.port == -1) {
|
||||
int maxport = -1;
|
||||
int j;
|
||||
for (j = 0 ; j < i ; j++) {
|
||||
if (def->parallels[j]->target.port > maxport)
|
||||
maxport = def->parallels[j]->target.port;
|
||||
}
|
||||
chr->target.port = maxport + 1;
|
||||
}
|
||||
def->parallels[def->nparallels++] = chr;
|
||||
}
|
||||
VIR_FREE(nodes);
|
||||
@ -5567,7 +5577,15 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
||||
if (!chr)
|
||||
goto error;
|
||||
|
||||
chr->target.port = i;
|
||||
if (chr->target.port == -1) {
|
||||
int maxport = -1;
|
||||
int j;
|
||||
for (j = 0 ; j < i ; j++) {
|
||||
if (def->serials[j]->target.port > maxport)
|
||||
maxport = def->serials[j]->target.port;
|
||||
}
|
||||
chr->target.port = maxport + 1;
|
||||
}
|
||||
def->serials[def->nserials++] = chr;
|
||||
}
|
||||
VIR_FREE(nodes);
|
||||
|
Loading…
Reference in New Issue
Block a user