]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: format server interface without a listen address
authorJán Tomko <jtomko@redhat.com>
Tue, 20 Jan 2015 12:34:10 +0000 (13:34 +0100)
committerJán Tomko <jtomko@redhat.com>
Wed, 21 Jan 2015 12:22:36 +0000 (13:22 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1130390

The listen address is not mandatory for <interface type='server'>
but when it's not specified, we've been formatting it as:
-netdev socket,listen=(null):5558,id=hostnet0
which failed with:
Device 'socket' could not be initialized

Omit the address completely and only format the port in the listen
attribute.

Also fix the schema to allow specifying a model.

docs/schemas/domaincommon.rng
src/qemu/qemu_command.c
tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.args
tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser.xml

index c428ddf4f9cf7c2bf666ac9b28c992e09f5def32..9d6c1ee2b58eee2f7ec006fa7613ba8fc89bcf33 100644 (file)
                 <empty/>
               </element>
             </optional>
+            <optional>
+              <element name="model">
+                <attribute name="type">
+                  <data type="string">
+                    <param name='pattern'>[a-zA-Z0-9\-_]+</param>
+                  </data>
+                </attribute>
+                <empty/>
+              </element>
+            </optional>
           </interleave>
         </group>
         <group>
index c041ee77bdd0656d0ff68c7e19a608ddae15c4c7..7e1f3d09587f6b10d3f76e8e65dda9398fa5b9f7 100644 (file)
@@ -4576,7 +4576,8 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
     case VIR_DOMAIN_NET_TYPE_SERVER:
        virBufferAsprintf(&buf, "socket%clisten=%s:%d",
                          type_sep,
-                         net->data.socket.address,
+                         net->data.socket.address ? net->data.socket.address
+                                                  : "",
                          net->data.socket.port);
        type_sep = ',';
        break;
index 26daac3984d6b6c9694b4ef0f9150c5ecb18c833..ac43630979ad033f3851488571740f9087ce2c94 100644 (file)
@@ -7,4 +7,6 @@ pc -m 214 -smp 1 -nographic -nodefaults -monitor unix:/tmp/test-monitor,server,n
 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ee:96:6b,bus=pci.0,addr=0x3 \
 -chardev socket,id=charnet1,path=/tmp/vhost1.sock \
 -netdev type=vhost-user,id=hostnet1,chardev=charnet1 \
--device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:ee:96:6c,bus=pci.0,addr=0x4
+-device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:ee:96:6c,bus=pci.0,addr=0x4 \
+-netdev socket,listen=:2015,id=hostnet2 \
+-device rtl8139,netdev=hostnet2,id=net2,mac=52:54:00:95:db:c0,bus=pci.0,addr=0x5
index e5b6242e40d2219ad105882b42f00cdc29697333..fa09157cd570d45a9107e9c6c934ccb72c71e47d 100644 (file)
       <source type='unix' path='/tmp/vhost1.sock' mode='client'/>
       <model type='virtio'/>
     </interface>
+    <interface type='server'>
+      <mac address='52:54:00:95:db:c0'/>
+      <source port='2015'/>
+      <model type='rtl8139'/>
+    </interface>
     <memballoon model='none'/>
   </devices>
 </domain>