[Avocado-devel] nettype setting in test cfg

Wei Huang wei at redhat.com
Mon Aug 14 14:50:10 UTC 2017



On 08/14/2017 06:13 AM, Lukáš Doktor wrote:
> Dne 11.8.2017 v 19:20 Wei Huang napsal(a):
>> Hi,
>>
> Hello Wei,
> 
>> I have questions regarding setting vt.qemu properties in test cfg file.
>> In this case, I want to specify a default nettype="bridge" for mytest.
> 
> Let's clarify few points first. I assume you are talking about test-related cfg, not the `--vt-config` one, right?

Right, it is a test cfg file.

> 
>>
>> 1) If I want to set a nettype for mytest.py, should I just add "nettype
>> = 'bridge'" inside mytest.cfg file? Does mytest.py needs to read this
>> property using "params.get()" to populate this property to final test run?
>>
> 
> Test configuration is not suppose to change the `nettype`. The `nettype` is a global network type, which is used by all tests and one should be able to switch between them via config/cmdline. If your test only works with certain nettype, you should use `only bridge` or `only user, bridge` or whatever suites your situation, that way the test will not run without given nettype.
> 
> On the other hand when your test defines multiple nics and you know for some of them you require bridge, you can change per-vm nettype by using `nettype_$vmname`, which always overrides the default. Anyway you should never do this for the main VM as that would result in the test being executed (and named) for example as `qemu_kvm_jeos_quick.user.default_bios.no_virtio_rng.(image_backend=filesystem).no_9p_export.smallpages.no_pci_assignable.qcow2.virtio_scsi.smp2.virtio_net.Linux.JeOS.25.x86_64.i440fx.Fedora.m25.u0.Host_arch_x86_64.(subtest=io-github-autotest-qemu).(subtest=boot)`, which implies `user` network was used, but in fact `bridge` would be used. This would be misleading.
> 
> Another why you shouldn't do this is that running suite of tests on `bridge` and `user` would result in the same test being ran twice with the very same configuration.
> 
> So please use `only bridge` if your test requires bridge, which means it'd not be found when running with `user` and it'd only run in suites where `bridge` is used. (also don't forget to re-run `vt-bootstrap` after any change to test's cfg files to propagate into subtests.cfg)

I will use this approach then. I will add a warning to mytest.py file
when user-mode net is detected (like migration_with_dst_problem.py does).

> 
>> 2) From what I have seen, the setting of nettype in
>> /etc/avocado/conf.d/vt.cfg seems to override what I set in mytest.cfg.
>> Does it mean the settings in vt.cfg has a higher precedence over
>> settings in individual test configure files?
>>
> 
> Exactly. First cfgs are processed, then additional filters/tweaks are done. You can see it in `avocado_vt/options.py` around lines 475.
> 
> PS: Note that currently there is a pending PR to change the default for `--vt-type qemu` to `bridge` when running as root and to keep it `user` when running as non-root. This might give you better experience.

I saw this warning message in current avocado. I agree this PR will be
helpful.

> 
>> Thanks,
>> -Wei
>>
> 
> 




More information about the Avocado-devel mailing list