On Tue, 2018-08-21 at 11:24 +0800, Yi Min Zhao wrote:
在 2018/8/20 下午6:35, Andrea Bolognani 写道:
> You could do the same thing those functions do:
>
> * the zPCI address is empty if both uid and fid are zero;
uid=0 and fid=0 can't mean zPCI address is empty, because the user might
only define fid with 0. If fid=0 has been assigned, we should report
error. If
it is not defined by user, fid is also 0, then we should allocate a
valid value
for fid.
For the PCI part
<address type='pci' domain='0x0000' bus='0x00'
slot='0x00' function='0x0'/>
behaves the same as
<address type='pci'/>
and results in a PCI address being allocated automatically by
libvirt rather than an error being reported.
As with zPCI, zero is a valid value for some, but not all, of the
attributes: validation is performed if at least one of them is
non-zero and might result in an error being reported.
Doing the same with the zPCI part would not only allow you to get
rid of the extra booleans but would also guarantee a consistent
behavior, which is a worthy goal in and of itself.
--
Andrea Bolognani / Red Hat / Virtualization