On 10/31/23 11:12, John Levon wrote:
On Tue, Oct 31, 2023 at 10:49:31AM +0100, Michal Prívozník wrote:
>> + VIR_APPEND_ELEMENT(vm->def->hostdevs, vm->def->nhostdevs,
>
> But anyway, I think we want more elaborate approach. The whole point of
> the test driver is to mimic real guest(s) without resources needed. IOW,
Michal, point taken, but are you saying you wouldn't take such a change unless
it implemented attach for all possible devices?
Or would you be OK with a partial implementation that handles hostdev, but
returns the equivalent of ENOTSUP for everything else?
Yeah, that's perfectly acceptable. If you go with what I suggested and
basically copy qemuDomainAttachDeviceConfig() over to the test driver,
it's perfectly acceptable when in the big switch() only hostdevs are
implemented and for everything else an error is reported.
Meanwhile, I could move parts of the qemu function into say
virDomainDeviceDefAdd(virDomainDef *def, virDomainDeviceDef *dev) which
would then handle adding a device into corresponding array in domain
definition (maybe with duplicate detection?).
Same for virDomainDeviceDefRemove().
Reason I ask is that right now we only have a need for hostdev testing.
That much I figured. And indeed I too am guilty of implementing bare
minimum (fairly recently: v9.8.0-rc1~11) but the API I implemented
behaves just like in other drivers.
Michal