]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
XML <source bridge='VMnet0'/> update in <interface type='bridge'/>
authorKristina Hanicova <khanicov@redhat.com>
Wed, 24 Mar 2021 16:47:44 +0000 (17:47 +0100)
committerJán Tomko <jtomko@redhat.com>
Thu, 1 Apr 2021 11:36:35 +0000 (13:36 +0200)
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.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>
src/vmx/vmx.c
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.vmx
tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml
tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx
tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.xml

index 0b12b5dd7d6f517983600462114d7380b21ca863..ecc2db7f43d34ab77e63910ca7822373c5254244 100644 (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,9 +3908,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",
index ef6af19b49ccbc40a66f3c57218bb18d0e77b950..75583bdc538f72bec456fce6c36496aa90fe18d8 100644 (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"
index 2dd46eb2b1618aa25c3bdd1d6ad7eddf2bdbad80..f6e9f4acdf79fb8b12d505a169da5308c56ae7a3 100644 (file)
     <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'/>
index 6e078d4d92eea243ff1f5b153e447b7e12e23cef..172aa686ed88af6b08dcac47dc258e1ded256a1e 100644 (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"
index 628dfbaff0ab4d7bcd43aec05d36d02d6b4a915a..6f8f30393c95a9382f3205fa3b3dfcbbdd19cfe4 100644 (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>
index 9605e2d6ac4597208776b8b03adc10f72b82c1aa..2a81cc01374d92d90eb8fc36f8bf67cc09ec47f6 100644 (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"
index 0bfc7e88af0bd0281cd4c0558286515252fdd465..3052abd74050f587112c6ea3478e0b92831d32fd 100644 (file)
     <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'/>
index f7f40ec30054a9ebbfd2382de7b397d02041dd11..eba18eb3201ff1a42b8ed02336bd0fa9a34eddf6 100644 (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"
index 30fb76c818a1b27fd9fe808f452684bf136e17cc..2bf8699149ea282146ddc152ef4c6f93d28cf1eb 100644 (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>