1. 18 6月, 2013 2 次提交
    • O
      nodedev_udev: changes missed by commit 1aa0ba3c · bf5fbf8f
      Osier Yang 提交于
      bf5fbf8f
    • O
      nodedev_udev: Refactor udevGetDeviceType · 1aa0ba3c
      Osier Yang 提交于
      Checking if the "devtype" is NULL along with each "if" statements
      is bad. It wastes the performance, and also not good for reading.
      And also when the "devtype" is NULL, the logic is also not clear.
      
      This reorgnizes the logic of with "if...else" and a bunch of "else if".
      
      Other changes:
         * Change the function style.
         * Remove the useless debug statement.
         * Get rid of the goto
         * New helper udevDeviceHasProperty to simplify the logic for checking
           if a property is existing for the device.
         * Add comment to clarify "PCI devices don't set the DEVTYPE property"
         * s/sysfs path/sysfs name/, as udev_device_get_sysname returns the
           name instead of the full path. E.g. "sg0"
         * Refactor the comment for setting VIR_NODE_DEV_CAP_NET cap type
           a bit.
      1aa0ba3c
  2. 14 6月, 2013 1 次提交
  3. 12 6月, 2013 1 次提交
  4. 03 6月, 2013 1 次提交
  5. 21 5月, 2013 1 次提交
  6. 13 5月, 2013 2 次提交
  7. 11 5月, 2013 1 次提交
    • L
      util: move virFile* functions from virutil.c to virfile.c · bfe7721d
      Laine Stump 提交于
      These all existed before virfile.c was created, and for some reason
      weren't moved.
      
      This is mostly straightfoward, although the syntax rule prohibiting
      write() had to be changed to have an exception for virfile.c instead
      of virutil.c.
      
      This movement pointed out that there is a function called
      virBuildPath(), and another almost identical function called
      virFileBuildPath(). They really should be a single function, which
      I'll take care of as soon as I figure out what the arglist should look
      like.
      bfe7721d
  8. 09 5月, 2013 1 次提交
  9. 08 5月, 2013 1 次提交
  10. 03 5月, 2013 2 次提交
  11. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  12. 26 4月, 2013 1 次提交
    • E
      build: avoid unsafe functions in libgen.h · 1fbf1905
      Eric Blake 提交于
      POSIX says that both basename() and dirname() may return static
      storage (aka they need not be thread-safe); and that they may but
      not must modify their input argument.  Furthermore, <libgen.h>
      is not available on all platforms.  For these reasons, you should
      never use these functions in a multi-threaded library.
      
      Gnulib instead recommends a way to avoid the portability nightmare:
      gnulib's "dirname.h" provides useful thread-safe counterparts.  The
      obvious dir_name() and base_name() are GPL (because they malloc(),
      but call exit() on failure) so we can't use them; but the LGPL
      variants mdir_name() (malloc's or returns NULL) and last_component
      (always points into the incoming string without modifying it,
      differing from basename semantics only on corner cases like the
      empty string that we shouldn't be hitting in the first place) are
      already in use in libvirt.  This finishes the swap over to the safe
      functions.
      
      * cfg.mk (sc_prohibit_libgen): New rule.
      * src/util/vircgroup.c: Fix offenders.
      * src/parallels/parallels_storage.c (parallelsPoolAddByDomain):
      Likewise.
      * src/parallels/parallels_network.c (parallelsGetBridgedNetInfo):
      Likewise.
      * src/node_device/node_device_udev.c (udevProcessSCSIHost)
      (udevProcessSCSIDevice): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskDeleteVol): Likewise.
      * src/util/virpci.c (virPCIGetDeviceAddressFromSysfsLink):
      Likewise.
      * src/util/virstoragefile.h (_virStorageFileMetadata): Avoid false
      positive.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1fbf1905
  13. 25 4月, 2013 1 次提交
  14. 24 4月, 2013 4 次提交
  15. 04 4月, 2013 1 次提交
    • D
      Add support for SD cards in nodedev driver · e2b373e6
      Daniel P. Berrange 提交于
      The nodedev driver currently only detects harddisk, cdrom
      and floppy devices. This adds support for SD cards, which
      are common storage for ARM devices, eg the Google ChromeBook
      
      <device>
        <name>block_mmcblk0_0xb1c7c08b</name>
        <parent>computer</parent>
        <capability type='storage'>
          <block>/dev/mmcblk0</block>
          <drive_type>sd</drive_type>
          <serial>0xb1c7c08b</serial>
          <size>15758000128</size>
          <logical_block_size>512</logical_block_size>
          <num_blocks>30777344</num_blocks>
        </capability>
      </device>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e2b373e6
  16. 29 3月, 2013 1 次提交
  17. 25 3月, 2013 6 次提交
    • O
      nodedev: Fix the improper logic when enumerating SRIOV VF · 9a3ff01d
      Osier Yang 提交于
      virPCIGetVirtualFunctions returns 0 even if there is no "virtfn"
      entry under the device sysfs path.
      
      And virPCIGetVirtualFunctions returns -1 when it fails to get
      the PCI config space of one VF, however, with keeping the
      the VFs already detected.
      
      That's why udevProcessPCI and gather_pci_cap use logic like:
      
      if (!virPCIGetVirtualFunctions(syspath,
                                     &data->pci_dev.virtual_functions,
                                     &data->pci_dev.num_virtual_functions) ||
          data->pci_dev.num_virtual_functions > 0)
          data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
      
      to tag the PCI device with "virtual_function" cap.
      
      However, this results in a VF will aslo get "virtual_function" cap.
      
      This patch fixes it by:
        * Ignoring the VF which has failure of getting PCI config space
          (given that the successfully detected VFs are kept , it makes
          sense to not give up on the failure of one VF too) with a warning,
          so virPCIGetVirtualFunctions will not return -1 except out of memory.
      
        * Free the allocated *virtual_functions when out of memory
      
      And thus the logic can be changed to:
      
          /* Out of memory */
          int ret = virPCIGetVirtualFunctions(syspath,
                                              &data->pci_dev.virtual_functions,
                                              &data->pci_dev.num_virtual_functions);
      
          if (ret < 0 )
              goto out;
          if (data->pci_dev.num_virtual_functions > 0)
              data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
      9a3ff01d
    • O
      nodedev: Abstract nodeDeviceVportCreateDelete as util function · 96d3086a
      Osier Yang 提交于
      This abstracts nodeDeviceVportCreateDelete as an util function
      virManageVport, which can be further used by later storage patches
      (to support persistent vHBA, I don't want to create the vHBA
      using the public API, which is not good).
      96d3086a
    • O
      nodedev: Dump max vports and vports in use for HBA's XML · 448be8f7
      Osier Yang 提交于
      This enrichs HBA's xml by dumping the number of max vports and
      vports in use. Format is like:
      
        <capability type='vport_ops'>
          <max_vports>164</max_vports>
          <vports>5</vports>
        </capability>
      
      * docs/formatnode.html.in: (Document the new XML)
      * docs/schemas/nodedev.rng: (Add the schema)
      * src/conf/node_device_conf.h: (New member for data.scsi_host)
      * src/node_device/node_device_linux_sysfs.c: (Collect the value of
        max_vports and vports)
      448be8f7
    • O
      nodedev: Refactor the helpers · 4360a098
      Osier Yang 提交于
      This adds two util functions (virIsCapableFCHost and virIsCapableVport),
      and rename helper check_fc_host_linux as detect_scsi_host_caps,
      check_capable_vport_linux is removed, as it's abstracted to the util
      function virIsCapableVport. detect_scsi_host_caps nows detect both
      the fc_host and vport_ops capabilities. "stat(2)" is replaced with
      "access(2)" for saving.
      
      * src/util/virutil.h:
        - Declare virIsCapableFCHost and virIsCapableVport
      * src/util/virutil.c:
        - Implement virIsCapableFCHost and virIsCapableVport
      * src/node_device/node_device_linux_sysfs.c:
        - Remove check_capable_vport_linux
        - Rename check_fc_host_linux as detect_scsi_host_caps, and refactor
          it a bit to detect both fc_host and vport_os capabilities
      * src/node_device/node_device_driver.h:
        - Change/remove the related declarations
      * src/node_device/node_device_udev.c: (Use detect_scsi_host_caps)
      * src/node_device/node_device_hal.c: (Likewise)
      * src/node_device/node_device_driver.c (Likewise)
      4360a098
    • O
      nodedev: Use access instead of stat · d91f7dec
      Osier Yang 提交于
      The use of 'stat' in nodeDeviceVportCreateDelete is only to check
      if the file exists or not, it's a bit overkill, and safe to replace
      with the wrapper of access(2) (virFileExists).
      d91f7dec
    • O
      util: Add one helper virReadFCHost to read the value of fc_host entry · 244ce462
      Osier Yang 提交于
      "open_wwn_file" in node_device_linux_sysfs.c is redundant, on one
      hand it duplicates work of virFileReadAll, on the other hand, it's
      waste to use a function for it, as there is no other users of it.
      So I don't see why the file opening work cannot be done in
      "read_wwn_linux".
      
      "read_wwn_linux" can be abstracted as an util function. As what all
      it does is to read the sysfs entry.
      
      So this patch removes "open_wwn_file", and abstract "read_wwn_linux"
      as an util function "virReadFCHost" (a more general name, because
      after changes, it can read each of the fc_host entry now).
      
      * src/util/virutil.h: (Declare virReadFCHost)
      * src/util/virutil.c: (Implement virReadFCHost)
      * src/node_device/node_device_linux_sysfs.c: (Remove open_wwn_file,
        and read_wwn_linux)
      src/node_device/node_device_driver.h: (Remove the declaration of
        read_wwn_linux, and the related macros)
      src/libvirt_private.syms: (Export virReadFCHost)
      244ce462
  18. 12 2月, 2013 1 次提交
  19. 06 2月, 2013 2 次提交
  20. 14 1月, 2013 2 次提交
  21. 21 12月, 2012 7 次提交