1. 25 11月, 2015 1 次提交
    • L
      nodedev: report maxCount for virtual_functions capability · f391889f
      Laine Stump 提交于
      A PCI device may have the capability to setup virtual functions (VFs)
      but have them currently all disabled. Prior to this patch, if that was
      the case the the node device XML for the device wouldn't report any
      virtual_functions capability.
      
      With this patch, if a file called "sriov_totalvfs" is found in the
      device's sysfs directory, its contents will be interpreted as a
      decimal number, and that value will be reported as "maxCount" in a
      capability element of the device's XML, e.g.:
      
         <capability type='virtual_functions' maxCount='7'/>
      
      This will be reported regardless of whether or not any VFs are
      currently enabled for the device.
      
      NB: sriov_numvfs (the number of VFs currently active) is also
      available in sysfs, but that value is implied by the number of items
      in the list that is inside the capability element, so there is no
      reason to explicitly provide it as an attribute.
      
      sriov_totalvfs and sriov_numvfs are available in kernels at least as far
      back as the 2.6.32 that is in RHEL6.7, but in the case that they
      simply aren't there, libvirt will behave as it did prior to this patch
      - no maxCount will be displayed, and the virtual_functions capability
      will be absent from the device's XML when 0 VFs are enabled.
      f391889f
  2. 24 11月, 2015 1 次提交
  3. 20 11月, 2015 1 次提交
  4. 19 11月, 2015 1 次提交
  5. 18 11月, 2015 2 次提交
  6. 16 11月, 2015 1 次提交
  7. 07 11月, 2015 2 次提交
    • J
      virnetdev: Use virNetDevSetupControl in virNetDevSendEthtoolIoctl · edc88e20
      John Ferlan 提交于
      Use virNetDevSetupControl instead of open coding using socket(AF_LOCAL...)
      and clearing virIfreq.
      
      By using virNetDevSetupControl, the socket is then opened using
      AF_PACKET which requires being privileged (effectively root) in
      order to complete successfully.  Since that's now a requirement,
      then the ioctl(SIOCETHTOOL) should not fail with EPERM, thus it
      is removed from the filtered listed of failure codes.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      edc88e20
    • J
      virnetdev: Check for root in virNetDevGetFeatures · d0a3a1ff
      John Ferlan 提交于
      Since the SIOCETHTOOL ioctl only works for privileged daemons, if called
      when not root, then virNetDevGetFeatures will VIR_DEBUG a message and
      return 0 as if the functions were not available for the architecture.
      This effectively returns an empty bitmap indicating no features available.
      
      Introduced by commit id 'c9027d8f'
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      d0a3a1ff
  8. 06 11月, 2015 3 次提交
    • J
      virnetdev: Fix function comments for virNetDevGetFeatures · 9efab5da
      John Ferlan 提交于
      In commit id 'c9027d8f' when updating the posted patch to generate
      a bitmap instead of an array of named feature bits, adjustment of
      the args was missed
      9efab5da
    • J
      virnetdev: Document reasons for ignoring some SIOCETHTOOL errno values · 301bd801
      John Ferlan 提交于
      Recently reverted commit id '6f2a0198' showed a need to add extra
      comments when dealing with filtering of potential "non-issues".
      
      Scanning through upstream patch postings indicates early on the
      reasons for the filtering of specific ioctl failures were provided;
      however, when converted from causing an error to VIR_DEBUG's the
      reasons were missing. A future read/change of the code incorrectly
      assumed they could or should be removed.
      301bd801
    • D
      Revert "utils: Remove the logging of errors from virNetDevSendEthtoolIoctl" · a3f63b85
      Daniel P. Berrange 提交于
      This reverts commit 6f2a0198.
      
      This commit removed error reporting from virNetDevSendEthtoolIoctl
      pushing responsibility onto the callers. This is wrong, however,
      since virNetDevSendEthtoolIoctl calls virNetDevSetupControl
      which can still report errors. So as a result virNetDevSendEthtoolIoctl
      may or may not report errors depending on which bit of it fails, and as
      a result callers now overwrite some errors.
      
      It also introduced a regression causing unprivileged libvirtd to
      spew error messages to the console due to inability to query the
      NIC features, an error which was previously ignored.
      
      virNetDevSetupControlFull:148 : Cannot open network interface control socket: Operation not permitted
      virNetDevFeatureAvailable:3062 : Cannot get device wlp3s0 flags: Operation not permitted
      virNetDevSetupControlFull:148 : Cannot open network interface control socket: Operation not permitted
      virNetDevFeatureAvailable:3062 : Cannot get device wlp3s0 flags: Operation not permitted
      virNetDevSetupControlFull:148 : Cannot open network interface control socket: Operation not permitted
      virNetDevFeatureAvailable:3062 : Cannot get device wlp3s0 flags: Operation not permitted
      virNetDevSetupControlFull:148 : Cannot open network interface control socket: Operation not permitted
      virNetDevFeatureAvailable:3062 : Cannot get device wlp3s0 flags: Operation not permitted
      
      Looking back at the original posting I see no explanation of why
      thsi refactoring was needed, so reverting the clearly broken
      error reporting logic looks like the best option.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a3f63b85
  9. 05 11月, 2015 2 次提交
  10. 04 11月, 2015 1 次提交
  11. 30 10月, 2015 2 次提交
    • L
      util: set max wait for IPv6 DAD to 20 seconds · ac339206
      Laine Stump 提交于
      This was originally set to 5 seconds, but times of 5.5 to 7 seconds
      were experienced. Since it's an arbitrary number intended to prevent
      an infinite hang, having it a bit too high won't hurt anything, and 20
      seconds looks to be adequate (i.e. I think/hope we don't need to make
      it tunable in libvirtd.conf)
      ac339206
    • L
      util: set error if DAD is not finished · d41a64a1
      Luyao Huang 提交于
      If DAD not finished in 5 seconds, user will get an
      unknown error like this:
      
       # virsh net-start ipv6
       error: Failed to start network ipv6
       error: An error occurred, but the cause is unknown
      
      Call virReportError to set an error.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      d41a64a1
  12. 29 10月, 2015 3 次提交
    • R
      Fix virNetDevWaitDadFinish stub · 2589ca30
      Roman Bogorodskiy 提交于
      Build on non-Linux fails because the virNetDevWaitDadFinish() stub
      has unused parameters. Fix by adding appropriate ATTRIBUTE_UNUSED
      for these parameters.
      
      Pushing under build-breaker rule.
      2589ca30
    • M
      network: wait for DAD to finish for bridge IPv6 addresses · 0f7436ca
      Maxim Perevedentsev 提交于
      commit db488c79 assumed that dnsmasq would complete IPv6 DAD before
      daemonizing, but in reality it doesn't wait, which creates problems
      when libvirt's bridge driver sets the matching "dummy tap device" to
      IFF_DOWN prior to DAD completing.
      
      This patch waits for DAD completion by periodically polling the kernel
      using netlink to check whether there are any IPv6 addresses assigned
      to bridge which have a 'tentative' state (if there are any in this
      state, then DAD hasn't yet finished). After DAD is finished, execution
      continues. To avoid an endless hang in case something was wrong with
      the kernel's DAD, we wait a maximum of 5 seconds.
      0f7436ca
    • M
      netlink: add support for multi-part netlink messages. · 131e7245
      Maxim Perevedentsev 提交于
      Such messages do not have NLMSG_ERROR or NLMSG_DONE type
      but they are valid responses. We test 'multi-partness'
      by looking for NLM_F_MULTI flag.
      131e7245
  13. 28 10月, 2015 1 次提交
  14. 26 10月, 2015 1 次提交
  15. 22 10月, 2015 3 次提交
    • L
      util: Produce friendlier error message to user · 4f9e61f6
      Luyao Huang 提交于
      Commit id '1c24cfe9' added error messages for virNumaSetPagePoolSize;
      however, virNumaGetHugePageInfo also uses virNumaGetHugePageInfoPath
      in order to build the path, but it never checked upon return if
      the built path exists which could lead to an error message as follows:
      
      $ virsh freepages 0 1
      error: Failed to open file
          '/sys/devices/system/node/node0/hugepages/hugepages-1kB/free_hugepages':
          No such file or directory
      
      Rather than add the same message for the other two callers, adjust
      the virNumaGetHugePageInfoPath in order not only build the path, but
      also check if the built path exists.  If the path does not exist,
      then generate the error message and return failure.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      4f9e61f6
    • L
      util: Adjust error paths for virNumaSetPagePoolSize · e802d7ef
      Luyao Huang 提交于
      Commit id '1c24cfe9' added new checks and error messaes for failure
      scenarios. Let's adjust those error messages to after the call to
      virNumaGetHugePageInfoPath in order to provide a more specific error
      message depending on node and page_size
      
      After this patch:
       # virsh allocpages --pagesize 2047 --pagecount 1 --cellno 0
       error: operation failed: page size 2047 is not available on node 0
      
       # virsh allocpages --pagesize 2047 --pagecount 1
       error: operation failed: page size 2047 is not available
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      e802d7ef
    • L
      util: split the virNumaGetHugePageInfoPath into separate function · deb8c66d
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1265114
      
      Refactor helper virNumaGetHugePageInfoPath to handle returning a directory
      path when passed a page_size of 0 and suffix == NULL into a new helper
      virNumaGetHugePageInfoDir which will only be called when a directory
      path is expected to be returned. This solves the issue where the helper
      was called with page_size == 0 expecting a file path in return, but
      instead got a directory path and failed in virFileReadAll with:
      
          error : virFileReadAll:1358 : Failed to read file
                      '/sys/devices/system/node/node0/hugepages/': Is a directory
      
      Since virNumaGetPages API expects to return a directory by passing
      page_size == 0 and suffix == NULL, it will now call the new helper.
      Callers to virNumaGetHugePageInfoPath expect to return a file path
      which could then be used in the call to virFileReadAll.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      deb8c66d
  16. 21 10月, 2015 1 次提交
  17. 16 10月, 2015 1 次提交
  18. 14 10月, 2015 2 次提交
    • J
      storage: On error rmdir created directory in virDirCreate[NoFork] · 21eb8972
      John Ferlan 提交于
      After a successful creation of a directory, if some other call results
      in returning a failure, let's remove the directory we created to
      prevent another round trip or confusion in the caller. In particular, this
      function can be called during a storage backend buildVol, so in order
      to ensure that caller doesn't need to distinguish between failed create
      or some other failure after create, just remove the directory we created.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      21eb8972
    • J
      storage: On error unlink created file in virFileOpen{As|Forked} · 69556215
      John Ferlan 提交于
      After a successful creation of a file, if some other call results
      in returning a failure, let's unlink the file we created to prevent
      another round trip or confusion in the caller. In particular, this
      function can be called during a storage backend buildVol, so in order
      to ensure that caller doesn't need to distinguish between failed create
      or some other failure after create, just remove the volume we created.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      69556215
  19. 09 10月, 2015 1 次提交
    • M
      virJSONValueArraySize: return ssize_t · 4f77c48c
      Michal Privoznik 提交于
      The internal representation of a JSON array counts the items in
      size_t. However, for some reason, when asking for the count it's
      reported as int. Firstly, we need the function to return a signed
      type as it's returning -1 on an error. But, not every system has
      integer the same size as size_t. Therefore, lets return ssize_t.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      4f77c48c
  20. 05 10月, 2015 2 次提交
    • J
      virfile: Fix error path for forked virFileRemove · cb19cff4
      John Ferlan 提交于
      As it turns out the caller in this case expects a return < 0 for failure
      and to get/use "errno" rather than using the negative of returned status.
      Again different than the create path.
      
      If someone "deleted" a file from the pool without using virsh vol-delete,
      then the unlink/rmdir would return an error (-1) and set errno to ENOENT.
      The caller checks errno for ENOENT when determining whether to throw an
      error message indicating the failure.  Without the change, the error
      message is:
      
      error: Failed to delete vol $vol
      error: cannot unlink file '/$pathto/$vol': Success
      
      This patch thus allows the fork path to follow the non-fork path
      where unlink/rmdir return -1 and errno.
      cb19cff4
    • J
      virfile: Add extra check for direct delete in virFileRemove · c6b32d68
      John Ferlan 提交于
      Unlike create options, if the file to be removed is already in the
      pool, then the uid/gid will come from the pool. If it's the same as the
      currently running process, then just do the unlink/rmdir directly
      rather than going through the fork processing unnecessarily
      c6b32d68
  21. 25 9月, 2015 1 次提交
  22. 23 9月, 2015 1 次提交
  23. 21 9月, 2015 4 次提交
  24. 16 9月, 2015 1 次提交
    • J
      virfile: Check for existence of dir in virFileDeleteTree · b421a708
      John Ferlan 提交于
      Commit id 'f1f68ca3' added code to remove the directory paths for
      auto-generated sockets, but that code could be called before the
      paths were created resulting in generating error messages from
      virFileDeleteTree indicating that the file doesn't exist.
      
      Rather than "enforce" all callers to make the non-NULL and existence
      checks, modify the virFileDeleteTree API to silently ignore NULL on
      input and non-existent directory trees.
      b421a708
  25. 14 9月, 2015 1 次提交