This series is base on my virtio-transitional work, since it touches
a lot of the same code:
https://www.redhat.com/archives/libvir-list/2019-January/msg00593.html
This series partially converts the net->model value from a string
to an enum. We wrap the existing ->model string in accessor functions,
rename it to ->modelstr, add a ->model enum, and convert internal
driver usage bit by bit. At the end, all driver code that is acting
on specific network model values is comparing against an enum, not
a string.
This is only partial because of xen/libxl/xm and qemu drivers, which
if they don't know anything particular about the model string will
just place it on the qemu command line/xen config and see what happens.
So basically if I were to pass in
<model type='idontexist'/>
qemu would turn that into
-device idontexist,...
That behavior is untouched by this series. Unwinding it will take
some thought. For starters would be populating the enum with any
qemu/xen network model that a user could realistically have a working
config with. Then maybe tainting the VM if modelstr is used. Then
after some time the final round could be causing domains to fail to
start, but not fail to parse, so they don't disappear on upgrade but
still break in an obvious way that will generate
complaints/bugreports. But we should agree on a plan for it.
Other caveats:
* vz and bhyve drivers are not compile tested
* vmx and virtualbox drivers previously would do a case insensitive
compare on the model value passed in via the user XML. Current
patches don't preserve that. I don't know how much it matters
for these drivers for reading fresh XML vs roundtrip XML from
converted native formats (which _will_ correct the case issue).
If we want to fix this we will need to tolower() the modelstr
value in the XML parser. I think there's a gnulib function for
it but I haven't explored it deeply
Cole Robinson (10):
tests: Add several net model passthrough tests
conf: net: Add wrapper functions for <model> value
conf: net: Rename 'model' to 'modelstr'
conf: net: Add model enum, and netfront value
vz: convert to net model enum
bhyve: convert to net model enum
qemu: Partially convert to net model enum
vmx: convert to net model enum
vbox: Convert to net enum model
conf: Add VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING
src/bhyve/bhyve_command.c | 15 +--
src/bhyve/bhyve_parse_command.c | 10 +-
src/conf/domain_conf.c | 105 ++++++++++++++----
src/conf/domain_conf.h | 35 +++++-
src/libvirt_private.syms | 4 +
src/libxl/libxl_conf.c | 8 +-
src/libxl/libxl_domain.c | 1 +
src/qemu/qemu_command.c | 33 +++---
src/qemu/qemu_domain.c | 32 +++---
src/qemu/qemu_domain_address.c | 14 +--
src/qemu/qemu_driver.c | 14 ++-
src/qemu/qemu_hotplug.c | 15 ++-
src/qemu/qemu_parse_command.c | 5 +-
src/security/virt-aa-helper.c | 3 +-
src/vbox/vbox_common.c | 29 +++--
src/vmx/vmx.c | 55 ++++-----
src/vz/vz_driver.c | 7 +-
src/vz/vz_sdk.c | 17 ++-
src/xenconfig/xen_common.c | 31 +++---
src/xenconfig/xen_sxpr.c | 30 ++---
tests/qemuxml2argvdata/net-many-models.args | 39 +++++++
tests/qemuxml2argvdata/net-many-models.xml | 37 ++++++
tests/qemuxml2argvtest.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 +
33 files changed, 534 insertions(+), 182 deletions(-)
create mode 100644 tests/qemuxml2argvdata/net-many-models.args
create mode 100644 tests/qemuxml2argvdata/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
--
2.20.1