]> xenbits.xensource.com Git - libvirt.git/commitdiff
bhyve: fix interface type handling for argv2xml
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Fri, 6 Jan 2017 17:06:23 +0000 (21:06 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Thu, 19 Jan 2017 16:19:44 +0000 (20:19 +0400)
When generating a domain XML from native command (i.e. via
the connectDomainXMLFromNative call), we should use
interface type 'bridge' rather than 'ethernet' because we only
support bridges at this point.

As we don't have bridge name explicitly specified on the command line,
just use 'virbr0' as a default.

src/bhyve/bhyve_parse_command.c
tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net.xml
tests/bhyveargv2xmldata/bhyveargv2xml-virtio-net4.xml

index 6190042983133bab239176fc54b789655d51434d..e31f5fbd143890cffadf023da8118a09e0802606 100644 (file)
@@ -507,9 +507,12 @@ bhyveParsePCINet(virDomainDefPtr def,
     if (VIR_ALLOC(net) < 0)
         goto cleanup;
 
-    /* Let's just assume it is VIR_DOMAIN_NET_TYPE_ETHERNET, it could also be
-     * a bridge, but this is the most generic option. */
-    net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
+    /* As we only support interface type='bridge' and cannot
+     * guess the actual bridge name from the command line,
+     * try to come up with some reasonable defaults */
+    net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
+    if (VIR_STRDUP(net->data.bridge.brname, "virbr0") < 0)
+        goto error;
 
     net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
     net->info.addr.pci.slot = pcislot;
index 09cc79b9239feeb51d6c08418393abe3c3c01055..5895c8c53bc9f36e5b24727b55a4ce3bf0609bd9 100644 (file)
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
-    <interface type='ethernet'>
+    <interface type='bridge'>
       <mac address='52:54:00:00:00:00'/>
+      <source bridge='virbr0'/>
       <target dev='tap0'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
     </interface>
-    <interface type='ethernet'>
+    <interface type='bridge'>
       <mac address='fe:ed:ad:ea:df:15'/>
+      <source bridge='virbr0'/>
       <target dev='tap1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </interface>
index e1bda46a1656c56cc7f12f54f90fb331150a95ee..5f1972080478f47c861f7ff0544fcef28ac83098 100644 (file)
@@ -12,8 +12,9 @@
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
-    <interface type='ethernet'>
+    <interface type='bridge'>
       <mac address='00:00:00:00:00:00'/>
+      <source bridge='virbr0'/>
       <target dev='tap1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </interface>