Currently we can and do get into serious trouble with this kind of
code:
devices = gvir_config_domain_get_devices(domain);
gvir_config_domain_set_devices(domain, domain);
since the first call above won't return a complete list of objects present
in the domain but only the ones we have specific classes for and the
second call above overwrites all device nodes under the domain. This
lately made Boxes break against the latest libvirt, where a new device
node was made compulsory[1].
Although we should add support for all know domain devices ASAP, new
devices will be added in future and this can happen again. So let's first
ensure that gvir_config_domain_get_devices() always returns all devices
under the domain. All unknown/unimplemented devices will now be returned
as the very generic DomainDevice objects. Once we add support for a
particular device, there will be no API/ABI breakage since the new class
will inherit from DomainDevice class.
[1]
https://bugzilla.redhat.com/show_bug.cgi?id=1388091
---
libvirt-gconfig/libvirt-gconfig-domain-device.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)