Previously, we accepted empty bridge name, because some old versions of
VMWare Workstation did not put it into the config. But this doesn't make
much sense - to have an interface type bridge with no name. We
circumvented this problem by generating an empty name but that is
equally wrong.
Therefore, fill in missing bridge names (according to the documentation
[1] the default bridge name is VMnet0) and error out if bridge name is
missing.
This partially reverts f246cdb5aca13ac9409b2ad43087e3078615ffcb
1:
https://docs.vmware.com/en/VMware-Workstation-Player-for-Linux/16.0/com.v...
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/vmx/vmx.c | 10 +++-------
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx | 2 ++
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml | 4 ++--
tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.vmx | 1 +
tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml | 2 +-
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx | 2 ++
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml | 4 ++--
tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx | 1 +
tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.xml | 2 +-
9 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 76d01a36de..82d3409c79 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2803,11 +2803,8 @@ virVMXParseEthernet(virConfPtr conf, int controller,
virDomainNetDefPtr *def)
STRCASEEQ(connectionType, "bridged") ||
STRCASEEQ(connectionType, "custom")) {
if (virVMXGetConfigString(conf, networkName_name, &networkName,
- true) < 0)
+ false) < 0)
goto cleanup;
-
- if (!networkName)
- networkName = g_strdup("");
}
/* vmx:vnet -> def:data.ifname */
@@ -3924,9 +3921,8 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller,
/* def:type, def:ifname -> vmx:connectionType */
switch (def->type) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
- if (STRNEQ(def->data.bridge.brname, ""))
- virBufferAsprintf(buffer, "ethernet%d.networkName =
\"%s\"\n",
- controller, def->data.bridge.brname);
+ virBufferAsprintf(buffer, "ethernet%d.networkName =
\"%s\"\n",
+ controller, def->data.bridge.brname);
if (def->ifname != NULL) {
virBufferAsprintf(buffer, "ethernet%d.connectionType =
\"custom\"\n",
diff --git a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx
b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx
index ef6af19b49..75583bdc53 100644
--- a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx
+++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx
@@ -12,9 +12,11 @@ sound.filename = "-1"
sound.autodetect = "TRUE"
usb.present = "TRUE"
ethernet0.present = "TRUE"
+ethernet0.networkName = "VMnet0"
ethernet0.addressType = "generated"
ethernet0.connectionType = "bridged"
ethernet1.present = "TRUE"
+ethernet1.networkName = "VMnet0"
ethernet1.addressType = "generated"
ethernet1.connectionType = "bridged"
scsi0:0.present = "TRUE"
diff --git a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
index 2dd46eb2b1..f6e9f4acdf 100644
--- a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
+++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
@@ -26,11 +26,11 @@
<controller type='ide' index='0'/>
<interface type='bridge'>
<mac address='00:0c:29:3b:64:ea' type='generated'/>
- <source bridge=''/>
+ <source bridge='VMnet0'/>
</interface>
<interface type='bridge'>
<mac address='00:0c:29:3b:64:f4' type='generated'/>
- <source bridge=''/>
+ <source bridge='VMnet0'/>
</interface>
<video>
<model type='vmvga' vram='4096' primary='yes'/>
diff --git a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.vmx
b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.vmx
index 6e078d4d92..172aa686ed 100644
--- a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.vmx
+++ b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.vmx
@@ -18,6 +18,7 @@ floppy0.startConnected = "FALSE"
floppy0.fileName = ""
floppy0.autodetect = "TRUE"
ethernet0.present = "TRUE"
+ethernet0.networkName = "VMnet0"
ethernet0.connectionType = "bridged"
ethernet0.virtualDev = "e1000"
ethernet0.wakeOnPcktRcv = "FALSE"
diff --git a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
index 628dfbaff0..6f8f30393c 100644
--- a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
+++ b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
@@ -26,7 +26,7 @@
<controller type='ide' index='0'/>
<interface type='bridge'>
<mac address='00:50:56:2f:d3:46' type='static'/>
- <source bridge=''/>
+ <source bridge='VMnet0'/>
<model type='e1000'/>
</interface>
<video>
diff --git a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx
b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx
index 9605e2d6ac..2a81cc0137 100644
--- a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx
+++ b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx
@@ -18,11 +18,13 @@ ide0:0.fileName = "auto detect"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
+ethernet0.networkName = "VMnet0"
ethernet0.connectionType = "bridged"
ethernet0.addressType = "generated"
ethernet0.generatedAddress = "00:0c:29:3b:64:ea"
ethernet0.generatedAddressOffset = "0"
ethernet1.present = "true"
+ethernet1.networkName = "VMnet0"
ethernet1.connectionType = "bridged"
ethernet1.addressType = "generated"
ethernet1.generatedAddress = "00:0c:29:3b:64:f4"
diff --git a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml
b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml
index 0bfc7e88af..3052abd740 100644
--- a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml
+++ b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml
@@ -27,11 +27,11 @@
<controller type='ide' index='0'/>
<interface type='bridge'>
<mac address='00:0c:29:3b:64:ea'/>
- <source bridge=''/>
+ <source bridge='VMnet0'/>
</interface>
<interface type='bridge'>
<mac address='00:0c:29:3b:64:f4'/>
- <source bridge=''/>
+ <source bridge='VMnet0'/>
</interface>
<video>
<model type='vmvga' vram='4096'/>
diff --git a/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx
b/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx
index f7f40ec300..eba18eb320 100644
--- a/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx
+++ b/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx
@@ -15,6 +15,7 @@ floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.virtualDev = "e1000"
+ethernet0.networkName = "VMnet0"
ethernet0.connectionType = "bridged"
ethernet0.addressType = "static"
ethernet0.address = "00:90:b9:dc:ea:81"
diff --git a/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.xml
b/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.xml
index 30fb76c818..2bf8699149 100644
--- a/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.xml
+++ b/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.xml
@@ -20,7 +20,7 @@
<controller type='scsi' index='0' model='lsilogic'/>
<interface type='bridge'>
<mac address='00:90:b9:dc:ea:81'/>
- <source bridge=''/>
+ <source bridge='VMnet0'/>
<model type='e1000'/>
</interface>
<video>
--
2.30.2