XML <source bridge='VMnet0'/> update in <interface type='bridge'/>

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 f246cdb5ac

1: https://docs.vmware.com/en/VMware-Workstation-Player-for-Linux/16.0/com.vmware.player.linux.using.doc/GUID-BAFA66C3-81F0-4FCA-84C4-D9F7D258A60A.html

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Kristina Hanicova 2021-03-24 17:47:44 +01:00 committed by Ján Tomko
parent 65c371fc69
commit 6336fcd9f8
9 changed files with 15 additions and 13 deletions

View File

@ -2801,11 +2801,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 */
@ -3911,7 +3908,6 @@ 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);

View File

@ -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"

View File

@ -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'/>

View File

@ -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"

View File

@ -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>

View File

@ -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"

View File

@ -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'/>

View File

@ -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"

View File

@ -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>