Comment 1 for bug 1821798

Revision history for this message
François Palin (francois.palin) wrote :

The extract below was taken from the domain xml for an instance that failed diagnostics command
and shows that "target dev" is present under regular bridge interface, but is missing from vfio interface:

      <interface type='bridge'>
        <mac address='fa:16:3e:c1:e3:fe'/>
        <source bridge='qbr275587c1-50'/>
        <target dev='tap275587c1-50'/> <<<<<<< target dev only present under this interface
        <model type='virtio'/>
        <mtu size='9000'/>
        <alias name='net0'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
      </interface>
      <interface type='hostdev' managed='yes'>
        <mac address='fa:16:3e:6f:4d:bc'/>
        <driver name='vfio'/>
        <source>
          <address type='pci' domain='0x0000' bus='0x04' slot='0x17' function='0x4'/>
          <origstates>
            <unbind/>
          </origstates>
        </source>
        <vlan>
          <tag id='0'/>
        </vlan>
        <alias name='hostdev0'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
      </interface>

As a result, method _get_io_devices() only returns the bridge interface when called by get_instance_diagnostics() and
the following loop:
        for interface in dom_io["ifaces"]:
only gets executed once.
This in turn results in having only diags.nic_details[0] created.

In the failing loop at the end of method get_instance_diagnostics, the code looks in the domain xml for ./devices/interface/mac,
and finds the 2 interface occurences, therefore exceeding the max index by 1 when trying to write to diags.nic_details[index].mac_address