1. 23 3月, 2016 3 次提交
    • A
      hostdev: Streamline device ownership tracking · 81128609
      Andrea Bolognani 提交于
      After this patch, ownership of virPCIDevice instances is very easy
      to keep track of: for each host PCI device, the only instance that
      actually matters is the one inside one of the bookkeeping list.
      
      Whenever some operation needs to be performed on a PCI device, the
      actual device is looked up first; when this is not the case, a
      comment explains the reason.
      81128609
    • A
      hostdev: Stop early if unmanaged devices have not been detached · 6da6bf2f
      Andrea Bolognani 提交于
      Unmanaged devices, as the name suggests, are not detached
      automatically from the host by libvirt before being attached to a
      guest: it's the user's responsability to detach them manually
      beforehand. If that preliminary step has not been performed, the
      attach operation can't complete successfully.
      
      Instead of relying on the lower layers to error out with cryptic
      messages such as
      
        error: Failed to attach device from /tmp/hostdev.xml
        error: Path '/dev/vfio/12' is not accessible: No such file or directory
      
      prevent the situation altogether and provide the user with a more
      useful error message.
      6da6bf2f
    • A
      hostdev: Detect untracked inactive devices · df490e7c
      Andrea Bolognani 提交于
      Unmanaged devices are attached to guests in two steps: first,
      the device is detached from the host and marked as inactive;
      subsequently, it is marked as active and attached to the guest.
      
      If the daemon is restarted between these two operations, we lose
      track of the inactive device.
      
      Steps 5 and 6 of virHostdevPreparePCIDevices() already subtly
      take care of this situation, but some planned changes will make
      it so that's no longer the case. Plus, explicit is always better
      than implicit.
      df490e7c
  2. 15 3月, 2016 3 次提交
    • A
      hostdev: Add more comments · 5fc68bd4
      Andrea Bolognani 提交于
      These comments explain the difference between a virPCIDevice
      instance used for lookups and an actual device instance; some
      information is also provided for specific uses.
      5fc68bd4
    • A
      hostdev: Use consistent variable names · 800dd16d
      Andrea Bolognani 提交于
      This is not just a cosmetic change: the name of the variable now
      gives a hint about what it is supposed to be used for.
      800dd16d
    • A
      hostdev: Remove virHostdevGetActivePCIHostDeviceList() · 4cdbff3d
      Andrea Bolognani 提交于
      virHostdevGetPCIHostDeviceList() is similar but does not filter out
      devices that are not in the active list; that said, we are looking
      up the device in the active list just a few lines after anyway, so
      we might as well just keep a single function around.
      
      This also helps stress the fact the objects contained in pcidevs are
      only for looking up the actual devices, which is something later
      commits will make even more explicit.
      4cdbff3d
  3. 14 3月, 2016 6 次提交
  4. 08 3月, 2016 4 次提交
    • A
      hostdev: Remove explicit NULL checks · 12a16314
      Andrea Bolognani 提交于
      NULL checks are performed implicitly in the rest of the module,
      including other allocations in the very same function.
      12a16314
    • A
      hostdev: Fix indentation · a54de18a
      Andrea Bolognani 提交于
      a54de18a
    • A
      hostdev: Remove inaccurate comment · a67b14a9
      Andrea Bolognani 提交于
      The comment claimed that virPCIDeviceReattach() does not reattach
      a device to the host driver; except it actually does, so the
      comment is just confusing and we're better off removing it.
      a67b14a9
    • A
      hostdev: Make comments easier to change later · be70acb7
      Andrea Bolognani 提交于
      Replace the term "loop" with the more generic "step". This allows us
      to be more flexible and eg. have a step that consists in a single
      function call.
      
      Don't include the number of steps in the first comment of the
      function, so that we can add or remove steps without having to worry
      about keeping that comment in sync.
      
      For the same reason, remove the summary contained in that comment.
      
      Clean up some weird vertical spacing while we're at it.
      be70acb7
  5. 26 2月, 2016 1 次提交
    • A
      hostdev: Remove temporary variable when checking for VF · b2ce5b02
      Andrea Bolognani 提交于
      The virHostdevIsVirtualFunction() was called exactly twice, and in
      both cases the return value was saved to a temporary variable before
      being checked. This would be okay if it improved readability, but in
      this case is pretty pointless.
      
      Get rid of the temporary variable and check the return value
      directly; while at it, change the check from '<= 0' to '!= 1' to
      align it with the way other similar *IsVirtualFunction() functions
      are used thorough the code.
      b2ce5b02
  6. 23 2月, 2016 1 次提交
  7. 28 1月, 2016 1 次提交
  8. 21 12月, 2015 4 次提交
    • A
      hostdev: Emit debug messages while handling PCI hostdevs · d5a0cf10
      Andrea Bolognani 提交于
      Both detach and reattach are complex operations involving several steps,
      and it can be useful to be able to follow along by reading the log.
      d5a0cf10
    • A
      hostdev: Only rollback detach of managed devices on error · e926df60
      Andrea Bolognani 提交于
      Since we don't detach unmanaged devices before attaching them to a
      domain, we shouldn't reattach them to rollback an error either.
      e926df60
    • A
      hostdev: Mark PCI devices as inactive as they're detached · b8a625f3
      Andrea Bolognani 提交于
      We want to eventually factor out the code dealing with device detaching
      and reattaching, so that we can share it and make sure it's called eg.
      when 'virsh nodedev-detach' is used.
      
      For that to happen, it's important that the lists of active and inactive
      PCI devices are updated every time a device changes its state.
      
      Instead of passing NULL as the last argument of virPCIDeviceDetach() and
      virPCIDeviceReattach(), pass the proper list so that it can be updated.
      b8a625f3
    • A
      pci: Introduce virPCIStubDriver enumeration · 6d9cdd2a
      Andrea Bolognani 提交于
      This replaces the virPCIKnownStubs string array that was used
      internally for stub driver validation.
      
      Advantages:
      
        * possible values are well-defined
        * typos in driver names will be detected at compile time
        * avoids having several copies of the same string around
        * no error checking required when setting / getting value
      
      The names used mirror those in the
      virDomainHostdevSubsysPCIBackendType enumeration.
      6d9cdd2a
  9. 16 12月, 2015 1 次提交
    • A
      pci: Use virPCIDeviceAddress in virPCIDevice · 77434541
      Andrea Bolognani 提交于
      Instead of replicating the information (domain, bus, slot, function)
      inside the virPCIDevice structure, use the already-existing
      virPCIDeviceAddress structure.
      
      For users of the module, this means that the object returned by
      virPCIDeviceGetAddress() can no longer be NULL and must no longer
      be freed by the caller.
      77434541
  10. 26 10月, 2015 1 次提交
  11. 27 8月, 2015 1 次提交
  12. 06 8月, 2015 1 次提交
  13. 23 6月, 2015 2 次提交
  14. 25 4月, 2015 3 次提交
    • J
      virhostdev: Fix comments for virHostdevReAttachPCIDevices · 6f75779e
      John Ferlan 提交于
      Pushed previous patch (commit id 'd45dadae') too quickly...
      
      The patch just updates the patch from Laine's suggestions.
      6f75779e
    • H
      hostdev: fix net config restore error · d45dadae
      Huanle Han 提交于
      Fix for such a case:
      1. Domain A and B xml contain the same SRIOV net hostdev(<interface
      type='hostdev' /> with same pci address).
      2. virsh start A (Successfully, and configure the SRIOV net with
      custom mac)
      3. virsh start B (Fail because of the hostdev used by domain A or other
      reason.)
      In step 3, 'virHostdevNetConfigRestore' is called for the hostdev
      which is still used by domain A. It makes the mac/vlan of the SRIOV net
      change.
      
      Code Change in this fix:
      1. As the pci used by other domain have been removed from
      'pcidevs' in previous loop, we only restore the nic config for
      the hostdev still in 'pcidevs'(used by this domain)
      2. update the comments to make it more clear
      Signed-off-by: NHuanle Han <hanxueluo@gmail.com>
      d45dadae
    • H
      hostdev: Create virHostdevIsPCINetDevice · 7ec3f805
      Huanle Han 提交于
      Refactor some code to create a static function virHostdevIsPCINetDevice
      which will detect whether the hostdev is a pci net device or not.
      Signed-off-by: NHuanle Han <hanxueluo@gmail.com>
      7ec3f805
  15. 14 4月, 2015 1 次提交
  16. 07 4月, 2015 1 次提交
  17. 02 4月, 2015 1 次提交
  18. 23 3月, 2015 1 次提交
  19. 15 1月, 2015 1 次提交
  20. 24 7月, 2014 3 次提交
    • J
      hostdev: Introduce virDomainHostdevSubsysSCSIiSCSI · 17bddc46
      John Ferlan 提交于
      Create the structures and API's to hold and manage the iSCSI host device.
      This extends the 'scsi_host' definitions added in commit id '5c811dce'.
      A future patch will add the XML parsing, but that code requires some
      infrastructure to be in place first in order to handle the differences
      between a 'scsi_host' and an 'iSCSI host' device.
      17bddc46
    • J
      hostdev: Introduce virDomainHostdevSubsysSCSIHost · 42957661
      John Ferlan 提交于
      Split virDomainHostdevSubsysSCSI further. In preparation for having
      either SCSI or iSCSI data, create a union in virDomainHostdevSubsysSCSI
      to contain just a virDomainHostdevSubsysSCSIHost to describe the
      'scsi_host' host device
      42957661
    • J
      hostdev: Introduce virDomainHostdevSubsysSCSI · 5805621c
      John Ferlan 提交于
      Create a separate typedef for the hostdev union data describing SCSI
      Then adjust the code to use the new pointer
      5805621c