[dts] [PATCH v1 5/8] tests/vf_to_vf_nic_bridge: use virt_common for VM creation

Herbert Guan herbert.guan at arm.com
Fri Feb 9 07:26:02 CET 2018


Use 'VM' form virt_common instead of 'QEMUKvm' from qemu_kvm for VM
creation.  This will allow VM type selection (kvm/libvirt etc.) for
each VM defined in test suite's config file.


Signed-off-by: Herbert Guan <herbert.guan at arm.com>
---
 conf/vf_to_vf_bridge.cfg               | 121 +++++++++++++++++++++++++++++++++
 tests/TestSuite_vf_to_vf_nic_bridge.py |   6 +-
 2 files changed, 124 insertions(+), 3 deletions(-)

diff --git a/conf/vf_to_vf_bridge.cfg b/conf/vf_to_vf_bridge.cfg
index 537b3da..fee104a 100644
--- a/conf/vf_to_vf_bridge.cfg
+++ b/conf/vf_to_vf_bridge.cfg
@@ -1,28 +1,149 @@
+# QEMU options
+# name
+#       name: vm0
+#
+# virt_type
+#       virt_type: [ KVM | LIBVIRT ]
+#
+# os
+#       loader:  /path/to/loader/file.fd
+#           note: applicable for libvirt only
+#       nvram:   /path/to/nvram/file.fd
+#           note: applicable for libvirt only
+#
+# enable_kvm
+#       enable: [yes | no]
+#
+# cpu
+#       model: [host | core2duo | ...]
+#           usage:
+#               choose model value from the command
+#                   qemu-system-x86_64 -cpu help
+#       number: '4' #number of vcpus
+#       cpupin: '3 4 5 6' # host cpu list
+#
+# mem
+#       size: 1024
+#           note: Set VM memory size in MB
+#
+# disk
+#       file: /path/to/image/test.img
+#       opt_format: [ raw | qcow2 | ... ]
+#       opt_bus:  [ virtio | scsi | ... ]
+#            note: applicable for libvirt only
+#       opt_dev:  [ sda | sdb | vda | ... ]
+#            note: applicable for libvirt only
+#       opt_controller:  [ virtio-scsi | ...]
+#            note: applicable for libvirt only
+#
+# net
+#        type: [nic | user | tap | bridge | ...]
+#           nic
+#               opt_vlan: 0
+#                   note: Default is 0.
+#               opt_macaddr: 00:00:00:00:01:01
+#                   note: if creating a nic, it`s better to specify a MAC,
+#                         else it will get a random number.
+#               opt_model:["e1000" | "virtio" | "i82551" | ...]
+#                   note: Default is e1000.
+#               opt_name: 'nic1'
+#               opt_addr: ''
+#                   note: PCI cards only.
+#               opt_vectors:
+#                   note: This option currently only affects virtio cards.
+#           user
+#               opt_vlan: 0
+#                   note: default is 0.
+#               opt_hostfwd: [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport
+#                   note: If not specified, it will be setted automatically.
+#           tap
+#               opt_vlan: 0
+#                   note: default is 0.
+#               opt_br: br0
+#                   note: if choosing tap, need to specify bridge name,
+#                         else it will be br0.
+#               opt_script: QEMU_IFUP_PATH
+#                   note: if not specified, default is self.QEMU_IFUP_PATH.
+#               opt_downscript: QEMU_IFDOWN_PATH
+#                   note: if not specified, default is self.QEMU_IFDOWN_PATH.
+#
+# device
+#       driver: [pci-assign | virtio-net-pci | ...]
+#           pci-assign
+#               prop_host: 08:00.0
+#               prop_addr: 00:00:00:00:01:02
+#           virtio-net-pci
+#               prop_netdev: mynet1
+#               prop_id: net1
+#               prop_mac: 00:00:00:00:01:03
+#               prop_bus: pci.0
+#               prop_addr: 0x3
+#
+# monitor
+#       port: 6061   
+#           note: if adding monitor to vm, need to specicy
+#                 this port, else it will get a free port
+#                 on the host machine.
+#
+# serial_port
+#       enable: [yes | no]
+#       opt_type: [pty | unix]
+#
+# vnc
+#       displayNum: 1
+#           note: you can choose a number not used on the host.
+#
+# daemon
+#       enable: 'yes'
+#           note:
+#               By default VM will start with the daemonize status.
+#               Not support starting it on the stdin now.
+
 # vm configuration for vhost sample case
 [vm0]
+# Default virt_type is KVM
+#virt_type =
+#    virt_type=LIBVIRT;
+# os option is applicable for libvirt only
+#os =
+#    loader=/usr/share/AAVMF/AAVMF_CODE.fd,nvram=/var/lib/libvirt/qemu/nvram/DTSVM_VARS.fd;
 cpu =
     model=host,number=4,cpupin=20 21 22 23;
 mem =
     size=6144,hugepage=yes;
 disk =
     file=/home/img/vm0.img;
+# Example for libvirt:
+#    file=/var/lib/libvirt/images/DTSVM.qcow2,opt_format=qcow2,opt_bus=scsi,opt_dev=sda,opt_controller=virtio-scsi;
 login =
     user=root,password=tester;
+# vnc option is not supported by libvirt yet, comment out below 2 lines if using libvirt
 vnc =
     displayNum=4;
+# daemon option is not supported by libvirt yet, comment out below 2 lines if using libvirt
 daemon =
     enable=yes;
 
 [vm1]
+# Default virt_type is KVM
+#virt_type =
+#    virt_type=LIBVIRT;
+# os option is applicable for libvirt only
+#os =
+#    loader=/usr/share/AAVMF/AAVMF_CODE.fd,nvram=/var/lib/libvirt/qemu/nvram/DTSVM1_VARS.fd;
 cpu =
     model=host,number=4,cpupin=30 31 32 33;
 mem =
     size=6144,hugepage=yes;
 disk =
     file=/home/img/vm1.img;
+# Example for libvirt:
+#    file=/var/lib/libvirt/images/DTSVM1.qcow2,opt_format=qcow2,opt_bus=scsi,opt_dev=sda,opt_controller=virtio-scsi;
 login =
     user=root,password=tester;
+# vnc option is not supported by libvirt yet, comment out below 2 lines if using libvirt
 vnc =
     displayNum=5;
+# daemon option is not supported by libvirt yet, comment out below 2 lines if using libvirt
 daemon =
     enable=yes;
diff --git a/tests/TestSuite_vf_to_vf_nic_bridge.py b/tests/TestSuite_vf_to_vf_nic_bridge.py
index a85cab5..356795a 100644
--- a/tests/TestSuite_vf_to_vf_nic_bridge.py
+++ b/tests/TestSuite_vf_to_vf_nic_bridge.py
@@ -39,7 +39,7 @@ import time
 import pdb
 
 from test_case import TestCase
-from qemu_kvm import QEMUKvm
+from virt_common import VM
 from pmd_output import PmdOutput
 
 VF_NUMS_ON_ONE_PF = 2
@@ -93,7 +93,7 @@ class TestVF2VFBridge(TestCase):
         vf0_prop = {'opt_host': self.sriov_vfs_ports[0].pci}
         vf1_prop = {'opt_host': self.sriov_vfs_ports[1].pci}
         time.sleep(1)
-        self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_to_vf_bridge')
+        self.vm0 = VM(self.dut, 'vm0', 'vf_to_vf_bridge')
         self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop)
         try:
             self.vm0_dut = self.vm0.start()
@@ -102,7 +102,7 @@ class TestVF2VFBridge(TestCase):
         except Exception as e:
             print utils.RED(str(e))
 
-        self.vm1 = QEMUKvm(self.dut, 'vm1', 'vf_to_vf_bridge')
+        self.vm1 = VM(self.dut, 'vm1', 'vf_to_vf_bridge')
         self.vm1.set_vm_device(driver=self.vf_assign_method, **vf1_prop)
         try:
             self.vm1_dut = self.vm1.start()
-- 
1.8.3.1



More information about the dts mailing list