1. 07 1月, 2017 1 次提交
  2. 05 1月, 2017 2 次提交
  3. 04 1月, 2017 2 次提交
    • A
      util: Fix syntax-check · f0af48f0
      Andrea Bolognani 提交于
      Commit b9cc2483 introduced a new #define but neglected
      to format it properly, thus breaking syntax-check.
      f0af48f0
    • A
      util: Turn virFirewallAddRule() into a macro · b9cc2483
      Andrea Bolognani 提交于
      Clang 3.9 refuses to compile the existing code with the
      following error:
      
        util/virfirewall.c:425:20: error: passing an object that undergoes
                                   default argument promotion to 'va_start'
                                   has undefined behavior [-Werror,-Wvarargs]
            va_start(args, layer);
                           ^
        util/virfirewall.c:420:37: note: parameter of type 'virFirewallLayer'
                                   is declared here
                           virFirewallLayer layer,
                                            ^
      
      This happens because 'layer' is of type virFirewallLayer, which
      is an enum type and not a standard type such as eg. void* or int.
      
      To solve the issue, turn virFirewallAddRule() from a very thin
      wrapper around virFirewallAddRuleFullV() to a macro that expands
      to a call to virFirewallAddRuleFull() - itself a very thin wrapper
      around the aforementioned virFirewallAddRuleFullV() - with no loss
      of functionality or type safety.
      b9cc2483
  4. 02 1月, 2017 2 次提交
    • M
      virmacmap: Don't use hash table dataFree callback · 5dc6169b
      Michal Privoznik 提交于
      Due to nature of operations we do over the string list (more
      precisely due to how virStringListRemove() works), it is not the
      best idea to use dataFree callback. Problem is, on MAC address
      remove, the string list remove function modifies the original
      list in place. Then, virHashUpdateEntry() is called which frees
      all the data stored in the list rendering @newMacsList point to
      freed data.
      
      ==16002== Invalid read of size 8
      ==16002==    at 0x50BC083: virFree (viralloc.c:582)
      ==16002==    by 0x513DC39: virStringListFree (virstring.c:251)
      ==16002==    by 0x51089B4: virMacMapHashFree (virmacmap.c:67)
      ==16002==    by 0x50EF30B: virHashAddOrUpdateEntry (virhash.c:352)
      ==16002==    by 0x50EF4FD: virHashUpdateEntry (virhash.c:415)
      ==16002==    by 0x5108BED: virMacMapRemoveLocked (virmacmap.c:129)
      ==16002==    by 0x51092D5: virMacMapRemove (virmacmap.c:346)
      ==16002==    by 0x402F02: testMACRemove (virmacmaptest.c:107)
      ==16002==    by 0x403F15: virTestRun (testutils.c:180)
      ==16002==    by 0x4032C4: mymain (virmacmaptest.c:205)
      ==16002==    by 0x405A3B: virTestMain (testutils.c:992)
      ==16002==    by 0x403D87: main (virmacmaptest.c:237)
      ==16002==  Address 0xdd5a4d0 is 0 bytes inside a block of size 24 free'd
      ==16002==    at 0x4C2AD6F: realloc (vg_replace_malloc.c:693)
      ==16002==    by 0x50BB99B: virReallocN (viralloc.c:245)
      ==16002==    by 0x513DC0B: virStringListRemove (virstring.c:235)
      ==16002==    by 0x5108BA6: virMacMapRemoveLocked (virmacmap.c:124)
      ==16002==    by 0x51092D5: virMacMapRemove (virmacmap.c:346)
      ==16002==    by 0x402F02: testMACRemove (virmacmaptest.c:107)
      ==16002==    by 0x403F15: virTestRun (testutils.c:180)
      ==16002==    by 0x4032C4: mymain (virmacmaptest.c:205)
      ==16002==    by 0x405A3B: virTestMain (testutils.c:992)
      ==16002==    by 0x403D87: main (virmacmaptest.c:237)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5dc6169b
    • M
      virmacmap: Fix variable handling · 806582a5
      Michal Privoznik 提交于
      In virMacMapRemoveLocked() we have two variables: @macsList and
      @newMacsList. Obviously, @newMacsList is supposed to hold pointer
      to modified list but in fact it holds pointer to the old list.
      It's confusing.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      806582a5
  5. 21 12月, 2016 1 次提交
  6. 20 12月, 2016 2 次提交
    • B
      cgroup: reduce complexity of controller disabling · dbeaa7e6
      Boris Fiuczynski 提交于
      This patch reduces the complexity of the filtering algorithm in
      virCgroupDetect by first correcting the controller mask and then
      checking for potential co-mounts without any correlating
      controller mask modifications.
      
      If you agree that this patch removes complexity and improves
      readability it could simply be squashed into the first patch
      of this series.
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      Reviewed-by: NBjoern Walk <bwalk@linux.vnet.ibm.com>
      Reviewed-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
      dbeaa7e6
    • B
      cgroup: unavailable controller prevents controller disabling · dfcfe0bb
      Boris Fiuczynski 提交于
      The cgroup controller filtering in virCgroupDetect does not work
      properly if the following conditions are met:
      1) the host system does not have a cgroup controller which
      libvirt requests (unavailable controller) and
      2) libvirt is configured to disable a controller (disabled controller) and
      3) the disabled controller is located before the unavailable controller
      in virCgroupController.
      
      As an example: The memory controller is unavailable and the cpuset
      controller is configured to be disabled.
      In this scenario trying to start a domain results in the error
      error: Controller 'cpuset' is not wanted, but 'memory' is co-mounted: Invalid argument
      
      This error occurs when virCgroupDetect is called with a valid parent group.
      The resulting group created by virCgroupCopyMounts holds for cpuset and
      memory controller empty mount points. The filtering of disabled controllers
      checks for co-mounts by comparing the mount points. The cpuset controller
      causes the filtering to occur before the memory controller is marked as to be
      ignored by modifying the controller mask since it is unavailable.
      Therefore the co-mount detection logic compares the cpuset and memory controller
      mount points and since both are empty the memory controller is regarded
      erroneously as being co-mounted.
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      Reviewed-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
      Reviewed-by: NBjoern Walk <bwalk@linux.vnet.ibm.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      dfcfe0bb
  7. 19 12月, 2016 1 次提交
    • J
      util: Introduce virSocketAddrPTRDomain · acd547dc
      Jiri Denemark 提交于
      The API creates PTR domain which corresponds to a given addr/prefix.
      Both IPv4 and IPv6 addresses are supported, but the prefix must be
      divisible by 8 for IPv4 and divisible by 4 for IPv6.
      
      The generated PTR domain has the following format
      
      IPv4: 1.2.3.4.in-addr.arpa
      IPv6: 0.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.0.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.ip6.arpa
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      acd547dc
  8. 17 12月, 2016 1 次提交
  9. 16 12月, 2016 6 次提交
  10. 15 12月, 2016 8 次提交
  11. 14 12月, 2016 2 次提交
    • J
      virjson: Remove const from virJSONValueObjectForeachKeyValue · c1cb4cb9
      Jiri Denemark 提交于
      Almost none of our virJSONValue*Get* functions accept const virJSONValue
      pointers and it wouldn't even make sense since we sometimes modify what
      we get. And because there is no reason for preventing callers of
      virJSONValueObjectForeachKeyValue from modifying the values they get in
      each iteration we can just stop doing it.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      c1cb4cb9
    • V
      util: Allow to query the presence of host CPU bitmaps · 1be35910
      Viktor Mihajlovski 提交于
      The functions to retrieve online and present host CPU information
      are only supported on Linux for the time being.
      
      This leads to runtime errors if these function are used on other
      platforms. To avoid that, code in higher levels using the functions
      must replicate the conditional compilation in higher level which
      is error prone (and is plainly spoken ugly).
      
      Adding a function virHostCPUHasBitmap that can be used to check
      for host CPU bitmap support.
      
      NB: There are other functions including the host CPU count that
      are lacking support on all platforms, but they are too essential
      in order to be bypassed.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      1be35910
  12. 13 12月, 2016 4 次提交
    • N
      perf: add branch_misses perf event support · 8981d792
      Nitesh Konkar 提交于
      This patch adds support and documentation
      for the branch_misses perf event.
      Signed-off-by: NNitesh Konkar <nitkon12@linux.vnet.ibm.com>
      8981d792
    • J
      util: Introduce virStorageSourceUpdateCapacity · 9d734b60
      John Ferlan 提交于
      Instead of having duplicated code in qemuStorageLimitsRefresh and
      virStorageBackendUpdateVolTargetInfo to get capacity specific data
      about the storage backing source or volume -- create a common API
      to handle the details for both.
      
      As a side effect, virStorageFileProbeFormatFromBuf returns to being
      a local/static helper to virstoragefile.c
      
      For the QEMU code - if the probe is done, then the format is saved so
      as to avoid future such probes.
      
      For the storage backend code, there is no need to deal with the probe
      since we cannot call the new API if target->format == NONE.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      9d734b60
    • J
      util: Introduce virStorageSourceUpdateBackingSizes · 3039ec96
      John Ferlan 提交于
      Instead of having duplicated code in qemuStorageLimitsRefresh and
      virStorageBackendUpdateVolTargetInfoFD to fill in the storage backing
      source or volume allocation, capacity, and physical values - create a
      common API that will handle the details for both.
      
      The common API will fill in "default" capacity values as well - although
      those more than likely will be overridden by subsequent code. Having just
      one place to make the determination of what the values should be will
      make things be more consistent.
      
      For the QEMU code - the data filled in will be for inactive domains
      for the GetBlockInfo and DomainGetStatsOneBlock API's. For the storage
      backend code - the data will be filled in during the volume updates.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      3039ec96
    • J
      util: Introduce virStorageSourceUpdatePhysicalSize · c5f61513
      John Ferlan 提交于
      Commit id '8dc27259' introduced virStorageSourceUpdateBlockPhysicalSize
      in order to retrieve the physical size for a block backed source device
      for an active domain since commit id '15fa84ac' changed to use the
      qemuMonitorGetAllBlockStatsInfo and qemuMonitorBlockStatsUpdateCapacity
      API's to (essentially) retrieve the "actual-size" from a 'query-block'
      operation for the source device.
      
      However, the code only was made functional for a BLOCK backing type
      and it neglected to use qemuOpenFile, instead using just open. After
      the open the block lseek would find the end of the block and set the
      physical value, close the fd and return.
      
      Since the code would return 0 immediately if the source device wasn't
      a BLOCK backed device, the physical would be displayed incorrectly,
      such as follows in domblkinfo for a file backed source device:
      
      Capacity:       1073741824
      Allocation:     0
      Physical:       0
      
      This patch will modify the algorithm to get the physical size for other
      backing types and it will make use of the qemuDomainStorageOpenStat
      helper in order to open/stat the source file depending on its type.
      The qemuDomainGetStatsOneBlock will no longer inhibit printing errors,
      but it will still ignore them leaving the physical value set to 0.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      c5f61513
  13. 09 12月, 2016 3 次提交
    • M
      Move virstat.c code to virnetdevtap.c · e0d893e8
      Mehdi Abaakouk 提交于
      This is just a code move of virstat.c to virnetdevtap.c
      e0d893e8
    • M
      virstat: fix signature of virstat helper · 9b6de7c5
      Mehdi Abaakouk 提交于
      In preparation to the code move to virnetdevtap.c, this change:
      
      * renames virNetInterfaceStats to virNetDevTapInterfaceStats
      * changes 'path' to 'ifname', to use the same vocable as other
        method in virnetdevtap.c.
      * Add the attributes checker
      9b6de7c5
    • M
      Gathering vhostuser interface stats with ovs · 013df874
      Mehdi Abaakouk 提交于
      When vhostuser interfaces are used, the interface statistics
      are not available in /proc/net/dev.
      
      This change looks at the openvswitch interfaces statistics
      tables to provide this information for vhostuser interface.
      
      Note that in openvswitch world drop/error doesn't always make sense
      for some interface type. When these informations are not available we
      set them to 0 on the virDomainInterfaceStats.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      013df874
  14. 07 12月, 2016 1 次提交
  15. 06 12月, 2016 4 次提交