1. 30 4月, 2018 3 次提交
  2. 28 4月, 2018 1 次提交
    • L
      nwfilter: increase pcap buffer size to be compatible with TPACKET_V3 · ce5aebea
      Laine Stump 提交于
      When an nwfilter rule sets the parameter CTRL_IP_LEARNING to "dhcp",
      this turns on the "dhcpsnoop" thread, which uses libpcap to monitor
      traffic on the domain's tap device and extract the IP address from the
      DHCP response.
      
      If libpcap on the host is built with HAVE_TPACKET3 defined (to enable
      support for TPACKET_V3), the dhcpsnoop code's initialization of the
      libpcap socket would fail with the following error:
      
        virNWFilterSnoopDHCPOpen:1134 : internal error: pcap_setfilter: can't remove kernel filter: Bad file descriptor
      
      It turns out that this was because TPACKET_V3 requires a larger buffer
      size than libvirt was setting (we were setting it to 128k). Changing
      the buffer size to 256k eliminates the error, and the dhcpsnoop thread
      once again works properly.
      
      A fuller explanation of why TPACKET_V3 requires such a large buffer,
      for future git spelunkers:
      
      libpcap calls setsockopt(... SOL_PACKET, PACKET_RX_RING...) to setup a
      ring buffer for receiving packets; two of the attributes sent to this
      API are called tp_frame_size, and tp_frame_nr. If libpcap was built
      with HAVE_TPACKET3 defined, tp_trame_size is set to MAXIMUM_SNAPLEN
      (defined in libpcap sources as 262144) and tp_frame_nr is set to:
      
       [the buffer size we set, i.e. PCAP_BUFFERSIZE i.e. 262144] / tp_frame_size.
      
      So if PCAP_BUFFERSIZE < MAXIMUM_SNAPLEN, then tp_frame_nr (the number
      of frames in the ring buffer) is 0, which is nonsensical. This same
      value is later used as a multiplier to determine the size for a call
      to malloc() (which would also fail).
      
      (NB: if HAVE_TPACKET3 is *not* defined, then tp_frame_size is set to
      the snaplen set by the user (in our case 576) plus a small amount to
      account for ethernet headers, so 256k is far more than adequate)
      
      Since the TPACKET_V3 code in libpcap actually reads multiple packets
      into each frame, it's not a problem to have only a single frame
      (especially when we are monitoring such infrequent traffic), so it's
      okay to set this relatively small buffer size (in comparison to the
      default, which is 2MB), which is important since every guest using
      dhcp snooping in a nwfilter rule will hold 2 of these buffers for the
      entire life of the guest.
      
      Thanks to Christian Ehrhardt for discovering that buffer size was the
      problem (this was not at all obvious from the error that was logged!)
      
      Resolves: https://bugzilla.redhat.com/1547237
      Fixes: https://bugs.launchpad.net/libvirt/+bug/1758037Signed-off-by: NLaine Stump <laine@laine.org>
      Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com> (V1)
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      Tested-by: NChristian Ehrhardt <christian.ehrhardt@canonical.com>
      ce5aebea
  3. 27 4月, 2018 4 次提交
  4. 26 4月, 2018 3 次提交
  5. 25 4月, 2018 10 次提交
  6. 24 4月, 2018 8 次提交
  7. 23 4月, 2018 7 次提交
  8. 21 4月, 2018 1 次提交
    • J
      tests: Xen: use qemu-system-i386 for emulator · cec1022e
      Jim Fehlig 提交于
      Many of the old xm and sexpr test files used qemu-dm as the emulator.
      Modern Xen systems no longer use the old, forked qemu-dm, instead
      preferring the distro provided qemu or an "upstream" qemu that is
      built when the Xen tools are built. This qemu is typically installed
      in /usr/lib/xen/bin/qemu-system-i386.
      
      The libxl test files already use /usr/lib/xen/bin/qemu-system-i386.
      For consistency, change the old test files to use the same emulator
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      cec1022e
  9. 20 4月, 2018 3 次提交
    • J
      vz: Use virDomainObjListFindBy{UUID|ID}Ref · 3c66d510
      John Ferlan 提交于
      For vzDomainLookupByID and vzDomainLookupByUUID let's
      return a locked and referenced @vm object so that callers
      can then use the common and more consistent virDomainObjEndAPI
      in order to handle cleanup rather than needing to know that the
      returned object is locked and calling virObjectUnlock.
      
      The LookupByName already returns the ref counted and locked object,
      so this will make things more consistent.
      
      Also adjust the prlsdkHandle{VmState|VmRemoved|Perf}Event APIs
      in the same manner.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      Reviewed-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      3c66d510
    • J
      vz: Unify vzDomObjFromDomain{Ref} · d758374d
      John Ferlan 提交于
      Rather than have two API's doing different things for different
      callers, let's make one API that will always return a locked and
      ref counted object. That way, the callers will always know that
      they must call virDomainObjEndAPI and not have to decide whether
      they should call virObjectUnlock instead.
      
      This will make things consistent with LookupByName which returns
      the locked and ref counted object.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      Reviewed-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      d758374d
    • J
      vmware: Use virDomainObjListFindBy{UUID|ID}Ref · 19d5529f
      John Ferlan 提交于
      For vmwareDomObjFromDomainLocked and vmwareDomainLookupByID
      let's return a locked and referenced @vm object so that callers
      can then use the common and more consistent virDomainObjEndAPI
      in order to handle cleanup rather than needing to know that the
      returned object is locked and calling virObjectUnlock.
      
      The LookupByName already returns the ref counted and locked object,
      so this will make things more consistent.
      
      For vmwareDomainUndefineFlags and vmwareDomainShutdownFlags since
      virDomainObjListRemove will return an unlocked object, we need to
      relock before making the EndAPI call.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
      19d5529f