1. 11 7月, 2013 1 次提交
  2. 10 7月, 2013 5 次提交
  3. 09 7月, 2013 1 次提交
  4. 08 7月, 2013 1 次提交
    • J
      Don't spam logs with "port 0 must be in range" errors · 86dba8f3
      Jiri Denemark 提交于
      Whenever virPortAllocatorRelease is called with port == 0, it complains
      that the port is not in an allowed range, which is expectable as the
      port was never allocated. Let's make virPortAllocatorRelease ignore 0
      ports in a similar way free() ignores NULL pointers.
      86dba8f3
  5. 03 7月, 2013 2 次提交
    • M
      virNetDevBandwidthUnplug: Don't leak @cmd · 5995fcf0
      Michal Privoznik 提交于
      When removing a TAP device, the associated bandwidth settings are
      removed. Currently, the /sbin/tc is used for that. It is spawned
      several times. Moreover, we use the same @cmd variable to
      construct the command and its arguments. That means we need to
      virCommandFree(cmd); prior to each virCommandNew(TC); which
      wasn't done.
      5995fcf0
    • M
      virCgroupNewPartition: Don't leak @newpath · bc132221
      Michal Privoznik 提交于
      The @newpath variable is allocated in virCgroupSetPartitionSuffix(). But
      it's newer freed.
      bc132221
  6. 02 7月, 2013 2 次提交
    • E
      build: work around mingw header pollution · 1528e8b2
      Eric Blake 提交于
      On Fedora 18, when cross-compiling to mingw with the mingw*-dbus
      packages installed, compilation fails with:
      
        CC       libvirt_net_rpc_server_la-virnetserver.lo
      In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-connection.h:32:0,
                       from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-bus.h:30,
                       from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus.h:31,
                       from ../../src/util/virdbus.h:26,
                       from ../../src/rpc/virnetserver.c:39:
      /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:74:58: error: expected ';', ',' or ')' before 'struct'
      
      I have reported this as a bug against two packages:
      - mingw-headers, for polluting the namespace
      https://bugzilla.redhat.com/show_bug.cgi?id=980270
      - dbus, for not dealing with the pollution
      https://bugzilla.redhat.com/show_bug.cgi?id=980278
      
      At least dbus has agreed that a future version of dbus headers will
      do s/interface/iface/, regardless of what happens in mingw. But it
      is also easy to workaround in libvirt in the meantime, without having
      to wait for either mingw or dbus to upgrade.
      
      * src/util/virdbus.h (includes): Undo mingw's pollution so that
      dbus doesn't fail.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1528e8b2
    • R
      Drop iptablesContext · 477a619e
      Roman Bogorodskiy 提交于
      iptablesContext holds only 4 pairs of iptables
      (table, chain) and there's no need to pass
      it around.
      
      This is a first step towards separating bridge_driver.c
      in platform-specific parts.
      477a619e
  7. 01 7月, 2013 1 次提交
    • L
      pci: initialize virtual_functions array pointer to avoid segfault · 2c2525ab
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=971325
      
      The problem was that if virPCIGetVirtualFunctions was given the name
      of a non-existent interface, it would return to its caller without
      initializing the pointer to the array of virtual functions to NULL,
      and the caller (virNetDevGetVirtualFunctions) would try to VIR_FREE()
      the invalid pointer.
      
      The final error message before the crash would be:
      
       virPCIGetVirtualFunctions:2088 :
        Failed to open dir '/sys/class/net/eth2/device':
        No such file or directory
      
      In this patch I move the initialization in virPCIGetVirtualFunctions()
      to the begining of the function, and also do an explicit
      initialization in virNetDevGetVirtualFunctions, just in case someone
      in the future adds code into that function prior to the call to
      virPCIGetVirtualFunctions.
      2c2525ab
  8. 28 6月, 2013 4 次提交
    • D
      Conditionalize use of IF_MAXUNIT in virnetdevtap.c · 002c8af9
      Daniel P. Berrange 提交于
      The IF_MAXUNIT macro is not present on all BSDs, so
      make its use conditional, to avoid breaking OS-X.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      002c8af9
    • D
      Replace use of 'in_addr_t' with 'struct in_addr' · 1a3eaa80
      Daniel P. Berrange 提交于
      The 'in_addr_t' typedef is not present in Mingw64 headers.
      Instead we can use the more portable 'struct in_addr' and
      then access its 's_addr' field.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1a3eaa80
    • D
      Fix vPort management: FC vHBA creation · 3c0d5e22
      Dennis Chen 提交于
      When creating a virtual FC HBA with virsh/libvirt API, an error message
      will be returned: "error: Node device not found",
      also the 'nodedev-dumpxml' shows wrong information of wwpn & wwnn
      for the new created device.
      
      Signed-off-by: xschen@tnsoft.com.cn
      
      This reverts f90af691 which switched wwpn & wwwn in the wrong place.
      
      https://www.kernel.org/doc/Documentation/scsi/scsi_fc_transport.txt
      3c0d5e22
    • L
      util: fix build error on non-Linux systems · a7578222
      Laine Stump 提交于
      Building on FreeBSD had this linker error:
      
      /work/a/ports/devel/libvirt/work/libvirt-1.1.0/src/.libs/libvirt.so:
         undefined reference to `virPCIDeviceAddressParse'
      
      This was caused by the new use of virPCIDeviceAddressParse in a
      portion of virpci.c that wasn't linux-only (in commit 72c029d8). The
      problem was that virPCIDeviceAddressParse had originally been defined
      inside #ifdef _linux (because it was only used by another function
      that was inside the same ifdef).
      
      The solution is to move it out to the part of virpci.c that is
      compiled on all platforms.
      
      (Because the portion that was "moved" was 40-50 lines, but only moved
      up by 15 lines, the diff for the patch is less than non-informative -
      rather than showing that part that I moved, it shows the bit that was
      previously before the moved part, and now sits *after* it.)
      a7578222
  9. 27 6月, 2013 1 次提交
    • L
      pci: new iommu_group functions · 72c029d8
      Laine Stump 提交于
      Any device which belongs to an "IOMMU group" (used by vfio) will
      have links to all devices of its group listed in
      /sys/bus/pci/$device/iommu_group/devices;
      /sys/bus/pci/$device/iommu_group is actually a link to
      /sys/kernel/iommu_groups/$n, where $n is the group number (there
      will be a corresponding device node at /dev/vfio/$n once the
      devices are bound to the vfio-pci driver)
      
      The following functions are added:
      
      virPCIDeviceGetIOMMUGroupList
      
        Gets a virPCIDeviceList with one virPCIDeviceList for each device
        in the same IOMMU group as the provided virPCIDevice (a copy of the
        original device object is included in the list.
      
      virPCIDeviceAddressIOMMUGroupIterate
      
        Calls the function @actor once for each device in the group that
        contains the given virPCIDeviceAddress.
      
      virPCIDeviceAddressGetIOMMUGroupAddresses
      
        Fills in a virPCIDeviceAddressPtr * with an array of
        virPCIDeviceAddress, one for each device in the iommu group of the
        provided virPCIDeviceAddress (including a copy of the original).
      
      virPCIDeviceAddressGetIOMMUGroupNum
      
        Returns the group number as an int (a valid group number will always
        be 0 or greater).  If there is no iommu_group link in the device's
        directory (usually indicating that vfio isn't loaded), -2 will be
        returned. On any real error, -1 will be returned.
      72c029d8
  10. 26 6月, 2013 10 次提交
    • J
      Plug leak in virCgroupMoveTask · 5bc8ecb8
      Ján Tomko 提交于
      We only break out of the while loop if *content is an empty string.
      However the buffer has been allocated to BUFSIZ + 1 (8193 in my case),
      but it gets overwritten in the next for iteration.
      
      Move VIR_FREE right before we overwrite it to avoid the leak.
      
      ==5777== 16,386 bytes in 2 blocks are definitely lost in loss record 1,022 of 1,027
      ==5777==    by 0x5296E28: virReallocN (viralloc.c:184)
      ==5777==    by 0x52B0C66: virFileReadLimFD (virfile.c:1137)
      ==5777==    by 0x52B0E1A: virFileReadAll (virfile.c:1199)
      ==5777==    by 0x529B092: virCgroupGetValueStr (vircgroup.c:534)
      ==5777==    by 0x529AF64: virCgroupMoveTask (vircgroup.c:1079)
      
      Introduced by 83e4c775.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=978352
      5bc8ecb8
    • J
      Fix invalid read in virCgroupGetValueStr · 306c49ff
      Ján Tomko 提交于
      Don't check for '\n' at the end of file if zero bytes were read.
      
      Found by valgrind:
      ==404== Invalid read of size 1
      ==404==    at 0x529B09F: virCgroupGetValueStr (vircgroup.c:540)
      ==404==    by 0x529AF64: virCgroupMoveTask (vircgroup.c:1079)
      ==404==    by 0x1EB475: qemuSetupCgroupForEmulator (qemu_cgroup.c:1061)
      ==404==    by 0x1D9489: qemuProcessStart (qemu_process.c:3801)
      ==404==    by 0x18557E: qemuDomainObjStart (qemu_driver.c:5787)
      ==404==    by 0x190FA4: qemuDomainCreateWithFlags (qemu_driver.c:5839)
      
      Introduced by 0d0b4098.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=978356
      306c49ff
    • L
      pci: eliminate leak in OOM condition · 2a2739a8
      Laine Stump 提交于
      The "fix" I pushed a few commits ago would still leak a virPCIDevice
      in case of an OOM error. Although it's inconsequential in practice,
      this patch satisfies my OCD.
      2a2739a8
    • L
      pci: virPCIDeviceListAddCopy API · 0e89a543
      Laine Stump 提交于
      Make a copy of the device and add the copy to the
      list. (virPCIDeviceListAdd() adds the original object to the list
      instead).
      0e89a543
    • L
      pci: update stubDriver name in virPCIDeviceBindToStub · 6e8003ad
      Laine Stump 提交于
      If the device is bound to a stub driver different from what is saved
      in the virPCIDevice's stubDriver attribute, update it.
      6e8003ad
    • L
      pci: eliminate repetitive path constructions in virPCIDeviceBindToStub · c13dddaf
      Laine Stump 提交于
      The same strings were being re-created multiple times just to save
      declaring a new variable. In the meantime, the use of the generic
      variable names led to confusion when trying to follow the code. This
      patch creates strings for:
      
       stubDriverName  (was called "driver" in original args)
       stubDriverPath  ("/sys/bus/pci/drivers/${stubDriverName}")
       driverLink      ("${device}/driver")
       oldDriverName   (the final component of path linked to by
                        "${device}/driver")
       oldDriverPath   ("/sys/bus/pci/drivers/${oldDriverName}")
      
      then re-uses them as necessary.
      c13dddaf
    • L
      pci: rename virPCIParseDeviceAddress and make it public · 31a4a679
      Laine Stump 提交于
      This function has utility outside of virpci.c, so make it public.
      
      Also the name didn't fit convention, so change it to
      virPCIDeviceAddressParse.
      31a4a679
    • L
      pci: rename virPCIDeviceGetVFIOGroupDev to virPCIDeviceGetIOMMUGroupDev · 1d829e13
      Laine Stump 提交于
      I realized after the fact that it's probably better in the long run to
      give this function a name that matches the name of the link used in
      sysfs to hold the group (iommu_group).
      
      I'm changing it now because I'm about to add several more functions
      that deal with iommu groups.
      1d829e13
    • L
      pci: eliminate unused driver arg from virPCIDeviceDetach · ee1d1f3b
      Laine Stump 提交于
      The driver arg to virPCIDeviceDetach is no longer used (the name of the stub driver is now set in the virPCIDevice object, and virPCIDeviceDetach retrieves it from there). Remove it.
      ee1d1f3b
    • L
      util: fix bug found by Coverity · 003118de
      Laine Stump 提交于
      Commit 861d4056 added code (my personal change to "clean up" the
      submitter's code, *not* the fault of the submitter) that dereferenced
      virtVlan without first checking for NULL. This patch fixes that and,
      as part of the fix, cleans up some unnecessary obtuseness.
      003118de
  11. 25 6月, 2013 12 次提交
    • R
      Fix units in virNetDevBridgeSetSTPDelay on BSD · f3d08aa0
      Roman Bogorodskiy 提交于
      virNetDevBridgeSetSTPDelay accepts delay in milliseconds,
      but BSD implementation was expecting seconds. Therefore,
      it was working correctly only with delay == 0.
      f3d08aa0
    • J
      Configure native vlan modes on Open vSwitch ports · 861d4056
      james robson 提交于
      This patch adds functionality to allow libvirt to configure the
      'native-tagged' and 'native-untagged' modes on openvswitch networks.
      Signed-off-by: NLaine Stump <laine@redhat.com>
      861d4056
    • J
      Introduce virTypedParamsCopy internal API · d0d5acb5
      Jiri Denemark 提交于
      d0d5acb5
    • J
      Introduce VIR_TYPED_PARAMS_DEBUG macro for dumping typed params · fefb0d54
      Jiri Denemark 提交于
      All APIs that take typed parameters are only using params address in
      their entry point debug messages. With the new VIR_TYPED_PARAMS_DEBUG
      macro, all functions can easily log all individual typed parameters
      passed to them.
      fefb0d54
    • J
      Introduce virTypedParamsReplaceString internal API · 8a7f1166
      Jiri Denemark 提交于
      8a7f1166
    • J
      Introduce virTypedParamsCheck internal API · 637a7c86
      Jiri Denemark 提交于
      This API is useful for checking whether only a specific subset of
      supported typed parameters were passed.
      637a7c86
    • J
      util: Emit proper error code in virTypedParamsValidate · 40369ea6
      Jiri Denemark 提交于
      When unsupported parameter is passed to virTypedParamsValidate,
      VIR_ERR_ARGUMENT_UNSUPPORTED should be returned rather than
      VIR_ERR_INVALID_ARG, which is more appropriate for supported parameters
      used incorrectly.
      40369ea6
    • J
      c40ed416
    • L
      pci: make virPCIDeviceDetach consistent in behavior · 9b4a6666
      Laine Stump 提交于
      virPCIDeviceDetach would previously sometimes consume the input device
      object (to put it on the inactive list) and sometimes not. Avoiding
      memory leaks required checking beforehand to see if the device was
      already on the list, and freeing the device object in the caller only
      if there wasn't already an identical object on the inactive list.
      
      This patch makes it consistent - virPCIDeviceDetach will *never*
      consume the input virPCIDevice object; if it needs to put one on the
      inactive list, it will create a copy and put *that* on the list. This
      way the caller knows that it is always their responsibility to free
      the device object they created.
      9b4a6666
    • L
      pci: eliminate memory leak in virPCIDeviceReattach · f962e8b6
      Laine Stump 提交于
      virPCIDeviceReattach was making the assumption that the dev object
      given to it was one and the same with the dev object on the
      inactiveDevs list. If that had been the case, it would not need to
      free the dev object it removed from the inactive list, because the
      caller of virPCIDeviceReattach always frees the dev object that it
      passes in. Since the dev object passed in is *never* the same object
      that's on the list (it is a different object with the same name and
      attributes, created just for the purpose of searching for the actual
      object), simply doing a "ListSteal" to remove the object from the list
      results in one leaked object; we need to actually free the object
      after removing it from the list.
      f962e8b6
    • L
      pci: new utility functions · 50a8d850
      Laine Stump 提交于
      * virPCIDeviceFindByIDs - find a device on a list w/o creating an object
          This makes searching for an existing device on a list lighter weight.
      
      * virPCIDeviceCopy - make a copy of an existing virPCIDevice object.
      
      * virPCIDeviceGetDriverPathAndName - construct new strings containing
          1) the name of the driver bound to this device.
          2) the full path to the sysfs config for that driver.
          (This code was lifted from virPCIDeviceUnbindFromStub, and replaced
          there with a call to this new function).
      50a8d850
    • L
      pci: change stubDriver from const char* to char* · 53e52b4a
      Laine Stump 提交于
      Previously stubDriver was always set from a string literal, so it was
      okay to use a const char * that wasn't freed when the virPCIDevice was
      freed. This will not be the case in the near future, so it is now a
      char* that is allocated in virPCIDeviceSetStubDriver() and freed
      during virPCIDeviceFree().
      53e52b4a