Commit 23c47944882b added parsing of serial ports connected to vspc, but
the VM can also have a network serial port with an empty filename or no
filename at all. Parse these the same way, as a <serial type='null'>.
Resolves:
https://issues.redhat.com/browse/RHEL-32182
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/vmx/vmx.c | 2 +-
tests/vmx2xmldata/esx-in-the-wild-13.vmx | 4 ++++
tests/vmx2xmldata/esx-in-the-wild-13.xml | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index d90b41d2ad14..d082a0766010 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3065,7 +3065,7 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf, int port,
(*def)->target.port = port;
(*def)->source->type = VIR_DOMAIN_CHR_TYPE_PIPE;
(*def)->source->data.file.path = g_steal_pointer(&fileName);
- } else if (STRCASEEQ(fileType, "network") && vspc) {
+ } else if (STRCASEEQ(fileType, "network") && (vspc || !fileName ||
STREQ(fileName, ""))) {
(*def)->target.port = port;
(*def)->source->type = VIR_DOMAIN_CHR_TYPE_NULL;
} else if (STRCASEEQ(fileType, "network")) {
diff --git a/tests/vmx2xmldata/esx-in-the-wild-13.vmx
b/tests/vmx2xmldata/esx-in-the-wild-13.vmx
index 1016acab28d8..d67e01814e93 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-13.vmx
+++ b/tests/vmx2xmldata/esx-in-the-wild-13.vmx
@@ -29,6 +29,10 @@ serial0.fileName =
"ZmVybmV0IGdBQUFBQUJrdFotaW8yclpkRXR6N3dBcDdyYkFMaWFUMVd4RENJ
serial0.vspc =
"telnets://10.28.100.26:18979#thumbprint=18:F5:79:E5:73:A5:22:83:C0:57:B9:B4:FA:CE:60:19:F1:12:F5:7B"
serial0.yieldOnMsrRead = "TRUE"
serial0.present = "TRUE"
+serial1.fileType = "network"
+serial1.fileName = ""
+serial1.yieldOnMsrRead = "TRUE"
+serial1.present = "TRUE"
displayName = "Test-Mig-VM-1 (01ce57d0-4e20-41a5-8b6c-bcbf49a032ec)"
annotation =
"name:Test-Mig-VM-1|0Auserid:962314ba515c48388a0e95c0961709ff|0Ausername:admin|0Aprojectid:b06b5f77b6bb442f85b1c67cff980ef9|0Aprojectname:MIS|0Aflavor:name:mig-test-flavor|0Aflavor:memory_mb:1024|0Aflavor:vcpus:1|0Aflavor:ephemeral_gb:0|0Aflavor:root_gb:10|0Aflavor:swap:0|0Aimageid:8b90d6fa-20ab-4adf-8015-aad3dddb246c|0Apackage:20.6.2|0A"
guestOS = "other-64"
diff --git a/tests/vmx2xmldata/esx-in-the-wild-13.xml
b/tests/vmx2xmldata/esx-in-the-wild-13.xml
index 552c9a2a1a26..e6ef947d501f 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-13.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-13.xml
@@ -43,6 +43,9 @@ package:20.6.2
<serial type='null'>
<target port='0'/>
</serial>
+ <serial type='null'>
+ <target port='1'/>
+ </serial>
<console type='null'>
<target type='serial' port='0'/>
</console>
--
2.45.1