Examples of passing unknown strings through <interface>
<model type=X/>
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
tests/qemuxml2argvdata/net-many-models.args | 39 ++++++++++++++
tests/qemuxml2argvdata/net-many-models.xml | 37 +++++++++++++
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmloutdata/net-many-models.xml | 53 +++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
tests/xlconfigdata/test-net-fakemodel.cfg | 24 +++++++++
tests/xlconfigdata/test-net-fakemodel.xml | 39 ++++++++++++++
tests/xlconfigtest.c | 1 +
.../test-paravirt-net-fakemodel.cfg | 13 +++++
.../test-paravirt-net-fakemodel.xml | 40 ++++++++++++++
.../test-paravirt-net-modelstr.cfg | 13 +++++
tests/xmconfigtest.c | 1 +
.../xml2sexpr-fv-net-many-models.sexpr | 1 +
.../xml2sexpr-fv-net-many-models.xml | 43 +++++++++++++++
tests/xml2sexprtest.c | 1 +
15 files changed, 307 insertions(+)
create mode 100644 tests/qemuxml2argvdata/net-many-models.args
create mode 100644 tests/qemuxml2argvdata/net-many-models.xml
create mode 100644 tests/qemuxml2xmloutdata/net-many-models.xml
create mode 100644 tests/xlconfigdata/test-net-fakemodel.cfg
create mode 100644 tests/xlconfigdata/test-net-fakemodel.xml
create mode 100644 tests/xmconfigdata/test-paravirt-net-fakemodel.cfg
create mode 100644 tests/xmconfigdata/test-paravirt-net-fakemodel.xml
create mode 100644 tests/xmconfigdata/test-paravirt-net-modelstr.cfg
create mode 100644 tests/xml2sexprdata/xml2sexpr-fv-net-many-models.sexpr
create mode 100644 tests/xml2sexprdata/xml2sexpr-fv-net-many-models.xml
diff --git a/tests/qemuxml2argvdata/net-many-models.args
b/tests/qemuxml2argvdata/net-many-models.args
new file mode 100644
index 0000000000..69909fc699
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-many-models.args
@@ -0,0 +1,39 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-netdev user,id=hostnet0 \
+-device idontexist,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.0,\
+addr=0x3 \
+-netdev user,id=hostnet1 \
+-device vmxnet3,netdev=hostnet1,id=net1,mac=00:11:22:33:44:56,bus=pci.0,\
+addr=0x4 \
+-netdev user,id=hostnet2 \
+-device netfront,netdev=hostnet2,id=net2,mac=00:11:22:33:44:57,bus=pci.0,\
+addr=0x5 \
+-netdev user,id=hostnet3 \
+-device virtio-net-pci,netdev=hostnet3,id=net3,mac=00:11:22:33:44:58,bus=pci.0,\
+addr=0x6 \
+-netdev user,id=hostnet4 \
+-device ne2k_pci,netdev=hostnet4,id=net4,mac=00:11:22:33:44:58,bus=pci.0,\
+addr=0x7 \
+-netdev user,id=hostnet5 \
+-device pcnet,netdev=hostnet5,id=net5,mac=00:11:22:33:44:58,bus=pci.0,addr=0x8
diff --git a/tests/qemuxml2argvdata/net-many-models.xml
b/tests/qemuxml2argvdata/net-many-models.xml
new file mode 100644
index 0000000000..2b8f9b18eb
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-many-models.xml
@@ -0,0 +1,37 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:55'/>
+ <model type='idontexist'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:56'/>
+ <model type='vmxnet3'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:57'/>
+ <model type='netfront'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:58'/>
+ <model type='virtio'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:58'/>
+ <model type='ne2k_pci'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:58'/>
+ <model type='pcnet'/>
+ </interface>
+ <controller type='usb' index='0' model='none'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 03e8d79595..26e869f881 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1347,6 +1347,7 @@ mymain(void)
DO_TEST("net-eth-hostip", NONE);
DO_TEST("net-client", NONE);
DO_TEST("net-server", NONE);
+ DO_TEST("net-many-models", NONE);
DO_TEST("net-mcast", NONE);
DO_TEST("net-udp", NONE);
DO_TEST("net-hostdev", NONE);
diff --git a/tests/qemuxml2xmloutdata/net-many-models.xml
b/tests/qemuxml2xmloutdata/net-many-models.xml
new file mode 100644
index 0000000000..8fb3be920b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/net-many-models.xml
@@ -0,0 +1,53 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i686</emulator>
+ <controller type='usb' index='0' model='none'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:55'/>
+ <model type='idontexist'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:56'/>
+ <model type='vmxnet3'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:57'/>
+ <model type='netfront'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x05' function='0x0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:58'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x06' function='0x0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:58'/>
+ <model type='ne2k_pci'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x07' function='0x0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:58'/>
+ <model type='pcnet'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x08' function='0x0'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 83a0d1cf7b..03a6b8741e 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -433,6 +433,7 @@ mymain(void)
DO_TEST("net-bandwidth2", NONE);
DO_TEST("net-mtu", NONE);
DO_TEST("net-coalesce", NONE);
+ DO_TEST("net-many-models", NONE);
DO_TEST("serial-tcp-tlsx509-chardev", NONE);
DO_TEST("serial-tcp-tlsx509-chardev-notls", NONE);
diff --git a/tests/xlconfigdata/test-net-fakemodel.cfg
b/tests/xlconfigdata/test-net-fakemodel.cfg
new file mode 100644
index 0000000000..70bd922ac0
--- /dev/null
+++ b/tests/xlconfigdata/test-net-fakemodel.cfg
@@ -0,0 +1,24 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-system-i386"
+sdl = 0
+vnc = 1
+vncunused = 1
+vnclisten = "127.0.0.1"
+vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=fakemodel"
]
+parallel = "none"
+serial = "none"
+builder = "hvm"
+boot = "d"
diff --git a/tests/xlconfigdata/test-net-fakemodel.xml
b/tests/xlconfigdata/test-net-fakemodel.xml
new file mode 100644
index 0000000000..b9afbac78d
--- /dev/null
+++ b/tests/xlconfigdata/test-net-fakemodel.xml
@@ -0,0 +1,39 @@
+<domain type='xen'>
+ <name>XenGuest2</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>592896</memory>
+ <currentMemory unit='KiB'>403456</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='xenfv'>hvm</type>
+ <loader type='rom'>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='cdrom'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <clock offset='variable' adjustment='0' basis='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:92:9c'/>
+ <source bridge='xenbr1'/>
+ <script path='vif-bridge'/>
+ <model type='fakemodel'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes'
listen='127.0.0.1'>
+ <listen type='address' address='127.0.0.1'/>
+ </graphics>
+ <video>
+ <model type='cirrus' vram='8192' heads='1'
primary='yes'/>
+ </video>
+ <memballoon model='xen'/>
+ </devices>
+</domain>
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 492bda2e63..ff27c96e87 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -259,6 +259,7 @@ mymain(void)
#ifdef LIBXL_HAVE_QED
DO_TEST_FORMAT("disk-qed", false);
#endif
+ DO_TEST("net-fakemodel");
DO_TEST("spice");
DO_TEST("spice-features");
DO_TEST("vif-rate");
diff --git a/tests/xmconfigdata/test-paravirt-net-fakemodel.cfg
b/tests/xmconfigdata/test-paravirt-net-fakemodel.cfg
new file mode 100644
index 0000000000..bf00cb555d
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-net-fakemodel.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest1"
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vfb = [ "type=vnc,vncunused=1,vnclisten=127.0.0.1,vncpasswd=123poi" ]
+vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge,model=fakemodel" ]
+bootloader = "/usr/bin/pygrub"
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
diff --git a/tests/xmconfigdata/test-paravirt-net-fakemodel.xml
b/tests/xmconfigdata/test-paravirt-net-fakemodel.xml
new file mode 100644
index 0000000000..80819fa55e
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-net-fakemodel.xml
@@ -0,0 +1,40 @@
+<domain type='xen'>
+ <name>XenGuest1</name>
+ <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>592896</memory>
+ <currentMemory unit='KiB'>403456</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <bootloader>/usr/bin/pygrub</bootloader>
+ <os>
+ <type arch='x86_64' machine='xenpv'>linux</type>
+ </os>
+ <clock offset='utc' adjustment='reset'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <disk type='block' device='disk'>
+ <driver name='phy' type='raw'/>
+ <source dev='/dev/HostVG/XenGuest1'/>
+ <target dev='xvda' bus='xen'/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:94:9c'/>
+ <source bridge='br0'/>
+ <script path='vif-bridge'/>
+ <model type='fakemodel'/>
+ </interface>
+ <console type='pty'>
+ <target type='xen' port='0'/>
+ </console>
+ <input type='mouse' bus='xen'/>
+ <input type='keyboard' bus='xen'/>
+ <graphics type='vnc' port='-1' autoport='yes'
listen='127.0.0.1' passwd='123poi'>
+ <listen type='address' address='127.0.0.1'/>
+ </graphics>
+ <video>
+ <model type='xen' vram='4096' heads='1'
primary='yes'/>
+ </video>
+ <memballoon model='xen'/>
+ </devices>
+</domain>
diff --git a/tests/xmconfigdata/test-paravirt-net-modelstr.cfg
b/tests/xmconfigdata/test-paravirt-net-modelstr.cfg
new file mode 100644
index 0000000000..bf00cb555d
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-net-modelstr.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest1"
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vfb = [ "type=vnc,vncunused=1,vnclisten=127.0.0.1,vncpasswd=123poi" ]
+vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge,model=fakemodel" ]
+bootloader = "/usr/bin/pygrub"
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index cae1ed15d4..1de3c33f69 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -193,6 +193,7 @@ mymain(void)
DO_TEST("paravirt-new-pvfb");
DO_TEST("paravirt-new-pvfb-vncdisplay");
DO_TEST("paravirt-net-e1000");
+ DO_TEST("paravirt-net-fakemodel");
DO_TEST("paravirt-net-vifname");
DO_TEST("paravirt-vcpu");
DO_TEST("paravirt-maxvcpus");
diff --git a/tests/xml2sexprdata/xml2sexpr-fv-net-many-models.sexpr
b/tests/xml2sexprdata/xml2sexpr-fv-net-many-models.sexpr
new file mode 100644
index 0000000000..118dfd87bb
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-fv-net-many-models.sexpr
@@ -0,0 +1 @@
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid
'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')(on_reboot
'restart')(on_crash 'destroy')(image (hvm (kernel
'/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(pae 1)(usb 1)(parallel
none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(rtc_timeoffset
0)(localtime 0)))(localtime 0)(device (vif (mac '00:11:22:33:44:55')(bridge
'xenbr0')(script 'vif-bridge')(model 'idontexist')))(device (vif
(mac '00:11:22:33:44:56')(bridge 'xenbr0')(script
'vif-bridge')(model 'vmxnet3')))(device (vif (mac
'00:11:22:33:44:57')(bridge 'xenbr0')(script 'vif-bridge')(type
netfront)))(device (vif (mac '00:11:22:33:44:58')(bridge 'xenbr0')(script
'vif-bridge')(model 'virtio')))(device (vif (mac
'00:11:22:33:44:58')(bridge 'xenbr0')(script 'vif-bridge')(model
'ne2k_pci')))(device (vif (mac '00:11:22:33:44:58')(bridge
'xenbr0')(script 'vif-bridge')(model 'pcnet'))))
diff --git a/tests/xml2sexprdata/xml2sexpr-fv-net-many-models.xml
b/tests/xml2sexprdata/xml2sexpr-fv-net-many-models.xml
new file mode 100644
index 0000000000..e95cba7f6a
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-fv-net-many-models.xml
@@ -0,0 +1,43 @@
+<domain type='xen'>
+ <name>fvtest</name>
+ <uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
+ <memory unit='KiB'>409600</memory>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='00:11:22:33:44:55'/>
+ <model type='idontexist'/>
+ </interface>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='00:11:22:33:44:56'/>
+ <model type='vmxnet3'/>
+ </interface>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='00:11:22:33:44:57'/>
+ <model type='netfront'/>
+ </interface>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='00:11:22:33:44:58'/>
+ <model type='virtio'/>
+ </interface>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='00:11:22:33:44:58'/>
+ <model type='ne2k_pci'/>
+ </interface>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='00:11:22:33:44:58'/>
+ <model type='pcnet'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index de68ea1f05..64383876ab 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -151,6 +151,7 @@ mymain(void)
DO_TEST("fv-sound", "fv-sound", "fvtest");
+ DO_TEST("fv-net-many-models", "fv-net-many-models",
"fvtest");
DO_TEST("fv-net-netfront", "fv-net-netfront",
"fvtest");
DO_TEST("fv-net-rate", "fv-net-rate", "fvtest");
--
2.20.1