• L
    conf: more useful error message when pci function is out of range · f8fe8f03
    Laine Stump 提交于
    If a pci address had a function number out of range, the error message
    would be:
    
      Insufficient specification for PCI address
    
    which is logged by virDevicePCIAddressParseXML() after
    virDevicePCIAddressIsValid returns a failure.
    
    This patch enhances virDevicePCIAddressIsValid() to optionally report
    the error itself (since it is the place that decides which part of the
    address is "invalid"), and uses that feature when calling from
    virDevicePCIAddressParseXML(), so that the error will be more useful,
    e.g.:
    
      Invalid PCI address function=0x8, must be <= 7
    
    Previously, virDevicePCIAddressIsValid didn't check for the
    theoretical limits of domain or bus, only for slot or function. While
    adding log messages, we also correct that ommission. (The RNG for PCI
    addresses already enforces this limit, which by the way means that we
    can't add any negative tests for this - as far as I know our
    domainschematest has no provisions for passing XML that is supposed to
    fail).
    
    Note that virDevicePCIAddressIsValid() can only check against the
    absolute maximum attribute values for *any* possible PCI controller,
    not for the actual maximums of the specific controller that this
    device is attaching to; fortunately there is later more specific
    validation for guest-side PCI addresses when building the set of
    assigned PCI addresses. For host-side PCI addresses (e.g. for
    <hostdev> and for network device pools), we rely on the error that
    will be logged when it is found that the device doesn't actually
    exist.
    
    This resolves:
    
      https://bugzilla.redhat.com/show_bug.cgi?id=1004596
    f8fe8f03
domain_conf.c 769.7 KB