6. Virtualization Scenario

When enable virtualization scenario setting in execution cfg, DTS will load scenario configurations and prepare resource and devices for VMs. After VMs started, scenario module will prepare test suite running environment. After all suites finished, scenario module will stop VMs and then clean up the scene.

6.1. Configuration File

With below configuration, DTS will create one scenario which created one VM with two VF devices attached. In scene section and according to configurations defined in suite. DUT object in suite will be VM DUT object, tester and DUT port network topology will be discovered automatically. Now DTS only support kvm typed hypervisor to create virtualization scenario.

# vm configuration for vf passthrough cases
# numa 0,1,yes yes mean cpu numa match the first port
# skipcores list mean those core will not be used by vm
# dut=vm_dut; mean vm_dut act as dut
# dut=dut; mean host dut act as dut
# portmap=cfg; mean vm_dut port map will be load from cfg
# portmap=auto; mean vm_dut will create portmap automatically
# devices = dev_gen/host/dev_gen+host not useful now
[scene]
suite =
        dut=vm_dut,portmap=auto;
        tester=tester;
type=kvm;

Virtual machine “vm0” section configured cpu, memory, disk and device settings in VM. As below configurations, VM will not use the first four lcores on DUT. DTS will generate two VF devices from first two host PF devices. These two VF devices will be pass-through into guest and their pci address will be auto assigned by qemu.

[vm0]
cpu =
        model=host,number=4,numa=auto,skipcores=0 1 2 3;
mem =
        size=2048,hugepage=no;
disk =
        file=/storage/vm-image/vm0.img;
dev_gen =
        pf_idx=0,vf_num=1,driver=default;
        pf_idx=1,vf_num=1,driver=default;
device =
        vf_idx=0,pf_dev=0,guestpci=auto;
        vf_idx=0,pf_dev=1,guestpci=auto;
vnc =
displayNum=1;

All suites will be run in scenario like below picture.

_images/scene_pf_passthrough.svg

6.2. Scenario Parameters

Options for suite:

option Description Options Default value Must have
dut type of dut for dts suite vm_dut,dut dut No
dut->portmap method to generate dut port maps auto, cfg auto No
tester type of tester for dts suite[Not used by now] N/A N/A No
type type of hypervisor kvm,libvirtd kvm No

Options for cpu:

option Description Options Default value Must have
model type of dut for dts suite   host Yes
number number of cores in virtual machine   4 Yes
numa_aware numa id of cores allocated from resource module 0,1,auto 0 Yes
skipcores cores should not be used, most time for those cores will be used by dpdk on host     No

Options for mem:

option Description Options Default value Must have
size virtual machine memory size in MBs   2048 Yes
hugepage whether allocate memory from hugepages   No No

Options for dev_gen:

option Description Options Default value Must have
pf_idx PF device index of host port   0 Yes
pf_inx->vf_num number of VFs created by this PF device   0 Yes
pf_inx->driver Allocate VF devices from which PF host driver igb_uio,default vfio-pci default Yes

Options for device:

option Description Options Default value Must have
pf_idx PF device index of host port   0 Yes
pf_idx->guestpci pci address in virtual machine     No
vf_idx VF devices index of all VFs belong to same PF devices     No
vf_idx->pf_dev PF device index of this VF device     Yes
vf_idx->guestpci pci address in virtual machine     No

Options for ports:

option Description Options Default value Must have
dev_idx device index of virtual machine ports     No
dev_idx->peer tester peer port’s pci address     No