Hey,

This looks good, except we're encoding a lot more knowledge of how qemu
works than I'd like.

The plan we had to future proof this was that libvirt would assign an id
(using -device foo,id=bar) and 'info pci' would include the device id in
its output.

Once you have that, you no longer need to make assumptions about what
product:vendor is used for each device or what order addresses are
allocated. It's a simple addition to qemu and a simple addition to your
'info pci' parsing code, but I think we'd rest easier wrt. future
compatibility.

Random thought - how well does this patch work if e.g. you don't specify
a NIC model? I don't see where we hard-code the knowledge about what
model qemu uses by default ...

Also, it'd be good to have unit tests for this - inputs would be a
domain XML lacking addresses, the corresponding 'info pci' output and it
would check addresses against an expected resulting domain XML.

Cheers,
Mark.

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to