1. 12 8月, 2015 4 次提交
    • L
      qemu: fix qemuDomainSupportsPCI() for ARM machines of "virt" machinetype · 9bd16ad3
      Laine Stump 提交于
      Commit e8d55172 updated the domain post-parse to automatically add
      pcie-root et al for certain ARM "virt" machinetypes, but didn't update
      the function qemuDomainSupportsPCI() which is called later on when we
      are auto-assigning PCI addresses and default settings for the PCI
      controller <model> and <target> attributes. The result was that PCI
      addresses weren't assigned, and the controllers didn't have their
      attribute default values set, leading to an error when the domain was
      started, e.g.:
      
        internal error: autogenerated dmi-to-pci-bridge options not set
      
      This patch adds the same check made in the earlier patch to
      qemuDomainSupportsPCI(), so that PCI address auto-assignment and
      target/model default values will be set.
      9bd16ad3
    • G
      virNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable · fbb27088
      Guido Günther 提交于
      When running the test suite using "unshare -n" we might have IPv6 but no
      configured addresses. Due to AI_ADDRCONFIG getaddrinfo then fails with
      EAI_NONAME which we should then treat as IPv6 unavailable.
      fbb27088
    • L
      util: don't overwrite stack when getting ethtool gfeatures · bfaaa2b6
      Laine Stump 提交于
      This fixes the crash described here:
      
       https://www.redhat.com/archives/libvir-list/2015-August/msg00162.html
      
      In short, we were calling ioctl(SIOCETHTOOL) pointing to a too-short
      object that was a local on the stack, resulting in the memory past the
      end of the object being overwritten. This was because the struct used
      by the ETHTOOL_GFEATURES command of SIOCETHTOOL ends with a 0-length
      array, but we were telling ethtool that it could use 2 elements on the
      array.
      
      The fix is to allocate the necessary memory with VIR_ALLOC_VAR(),
      including the extra length needed for a 2 element array at the end.
      bfaaa2b6
    • A
      cpu: Fix segfault in the ppc64 driver · 133c25c8
      Andrea Bolognani 提交于
      Commit adb865df introduced some changes in ppc64DriverNodeData()
      that cause libvirtd to crash on startup unless this patch is
      applied as well.
      133c25c8
  2. 11 8月, 2015 24 次提交
    • M
      qemu: Implement VIR_DOMAIN_BANDWIDTH_IN_FLOOR · b044e325
      Michal Privoznik 提交于
      Well, there are just two places that needs adjustment:
      
      qemuDomainGetInterfaceParameters - to report the @floor
      qemuDomainSetInterfaceParameters - now that the function has been
      fixed, we can allow updating @floor too.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b044e325
    • M
      qemuDomainSetInterfaceParameters: Use new functions to update bandwidth · 5ee6d243
      Michal Privoznik 提交于
      As sketched in previous commits, imagine the following scenario:
      
        virsh # domiftune gentoo vnet0
        inbound.average: 100
        inbound.peak   : 0
        inbound.burst  : 0
        outbound.average: 100
        outbound.peak  : 0
        outbound.burst : 0
      
        virsh # domiftune gentoo vnet0 --inbound 0
      
        virsh # shutdown gentoo
        Domain gentoo is being shutdown
      
        virsh # list --all
        error: Failed to list domains
        error: Cannot recv data: Connection reset by peer
      
        Program received signal SIGSEGV, Segmentation fault.
        0x00007fffe80ea221 in networkUnplugBandwidth (net=0x7fff9400c1a0, iface=0x7fff940ea3e0) at network/bridge_driver.c:4881
        4881            net->floor_sum -= ifaceBand->in->floor;
      
      This is rather unfortunate. We should not SIGSEGV here. The
      problem is, that while in the second step the inbound QoS was
      cleared out, the network part of it was not updated (moreover, we
      don't report that vnet0 had inbound.floor set). Internal
      structure therefore still had some fragments left (e.g.
      class_id). So when qemuProcessStop() started to clean up the
      environment it got to networkUnplugBandwidth(). Here, class_id is
      set therefore function assumes that there is an inbound QoS. This
      actually is a fair assumption to make, there's no need for a
      special QoS box in network's QoS when there's no QoS to set.
      Anyway, the problem is not the networkUnplugBandwidth() rather
      than qemuDomainSetInterfaceParameters() which completely forgot
      about QoS being disperse (some parts are set directly on
      interface itself, some on bridge the interface is plugged into).
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5ee6d243
    • M
      bridge_driver: Introduce networkBandwidthUpdate · 812932be
      Michal Privoznik 提交于
      So, if a domain vNIC's bandwidth has been successfully set, it's
      possible that because @floor is set on network's bridge, this
      part may need updating too. And that's exactly what this function
      does. While the previous commit introduced a function to check if
      @floor can be satisfied, this does all the hard work. In general,
      there may be three, well four possibilities:
      
        1) No change in @floor value (either it remain unset, or its
        value hasn't changed)
      
        2) The @floor value has changed from a non-zero to a non-zero
        value
      
        3) New @floor is to be set
      
        4) Old @floor must be cleared out
      
      The difference between 2), 3) and 4) is, that while in 2) the QoS
      tree on the network's bridge already has a special class for the
      vNIC, in 3) the class must be created from scratch. In 4) it must
      be removed. Fortunately, we have helpers for all three
      interesting cases.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      812932be
    • M
      bridge_driver: Introduce networkBandwidthChangeAllowed · 41a1531d
      Michal Privoznik 提交于
      When a domain vNIC's bandwidth is to be changed (at runtime) it is
      possible that guaranteed minimal bandwidth (@floor) will change too.
      Well, so far it is, because we still don't have an implementation that
      allows setting it dynamically, so it's effectively erased on:
      
          #virsh domiftune $dom vnet0 --inbound 0
      
      However, that's slightly unfortunate. We do some checks on domain
      startup to see if @floor can be guaranteed. We ought do the same if
      QoS is changed at runtime.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      41a1531d
    • M
      virNetDevBandwidthUpdateRate: turn class_id into integer · 45090449
      Michal Privoznik 提交于
      This is no functional change. It's just that later in the series we
      will need to pass class_id as an integer.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      45090449
    • M
      virNetDevParseMcast: Avoid magic constant · 327bc16a
      Michal Privoznik 提交于
      There is no guarantee that an enum start it mapped onto a value
      of zero. However, we are guaranteed that enum items are
      consecutive integers. Moreover, it's a pity to define an enum to
      avoid using magical constants but then using them anyway.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      327bc16a
    • M
      conf: Don't try formating non-existing addresses · 1f24c149
      Martin Kletzander 提交于
      Commit a6f9af82 added checking for address colisions between
      starting and ending addresses of forwarding addresses, but forgot that
      there might be no addresses set at all.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      1f24c149
    • A
      cpu: Forbid model fallback in the ppc64 driver · 344d1675
      Andrea Bolognani 提交于
      Unlike what happens on x86, on ppc64 you can't mix and match CPU
      features to obtain the guest CPU you want regardless of the host
      CPU, so the concept of model fallback doesn't apply.
      
      Make sure CPU definitions emitted by the driver, eg. as output of
      the cpuBaseline() and cpuUpdate() calls, reflect this fact.
      344d1675
    • A
      cpu: Implement backwards compatibility in the ppc64 driver · dee2247a
      Andrea Bolognani 提交于
      All previously recognized CPU models (POWER7_v2.1, POWER7_v2.3,
      POWER7+_v2.1 and POWER8_v1.0) are internally converted to the
      corrisponding generation name so that existing guests don't stop
      working.
      dee2247a
    • A
      cpu: Add POWER8NVL information to CPU map XML · 36300d2b
      Andrea Bolognani 提交于
      This is yet another variation of POWER8. The PVR information comes
      from arch/powerpc/kernel/cputable.c in the Linux kernel tree.
      36300d2b
    • A
      cpu: Parse and use PVR masks in the ppc64 driver · 5d0aa93c
      Andrea Bolognani 提交于
      Instead of relying on a hard-coded mask value, read it from the CPU
      map XML and use it when looking up models by PVR.
      5d0aa93c
    • A
      cpu: Simplify ppc64 part of CPU map XML · d87359af
      Andrea Bolognani 提交于
      Use multiple PVRs per CPU model to reduce the number of models we
      need to keep track of.
      
      Remove specific CPU models (eg. POWER7+_v2.1): the corresponding
      generic CPU model (eg. POWER7) should be used instead to ensure
      the guest can be booted on any compatible host.
      
      Get rid of all the entries that did not match any of the CPU
      models supported by QEMU, like power8 and power8e.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1250977
      d87359af
    • A
      cpu: Support multiple PVRs in the ppc64 driver · 59fcc961
      Andrea Bolognani 提交于
      This will allow us to perform PVR matching more broadly, eg. consider
      both POWER8 and POWER8E CPUs to be the same even though they have
      different PVR values.
      59fcc961
    • A
      cpu: Align ppc64 CPU data with x86 · adb865df
      Andrea Bolognani 提交于
      Use a typedef instead of the plain struct and heap allocation. This
      will make it easier to extend the ppc64 specific CPU data later on.
      adb865df
    • A
      cpu: Use ppc64Compute() to implement ppc64DriverCompare() · d574094d
      Andrea Bolognani 提交于
      This ensures comparison of two CPU definitions will be consistent
      regardless of the fact that it is performed using cpuCompare() or
      cpuGuestData(). The x86 driver uses the same exact code.
      d574094d
    • A
      cpu: CPU model names have to match on ppc64 · 96b2c745
      Andrea Bolognani 提交于
      Limitations of the POWER architecture mean that you can't run
      eg. a POWER7 guest on a POWER8 host when using KVM. This applies
      to all guests, not just those using VIR_CPU_MATCH_STRICT in the
      CPU definition; in fact, exact and strict CPU matching are
      basically the same on ppc64.
      
      This means, of course, that hosts using different CPUs have to be
      considered incompatible as well.
      
      Change ppc64Compute(), called by cpuGuestData(), to reflect this
      fact and update test cases accordingly.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1250977
      96b2c745
    • A
      cpu: Never skip CPU model name check in ppc64 driver · 8382136d
      Andrea Bolognani 提交于
      ppc64Compute(), called by cpuNodeData(), is used not only to retrieve
      the driver-specific data associated to a guest CPU definition, but
      also to check whether said guest CPU is compatible with the host CPU.
      
      If the user is not interested in the CPU data, it's perfectly fine
      to pass a NULL pointer instead of a return location, and the
      compatibility data returned should not be affected by this. One of
      the checks, specifically the one on CPU model name, was however
      only performed if the return location was non-NULL.
      8382136d
    • A
      cpu: Remove ISA information from CPU map XML · cb8c0e11
      Andrea Bolognani 提交于
      The information is not used anywhere in libvirt.
      
      No functional changes.
      cb8c0e11
    • A
      cpu: Reorder functions in the ppc64 driver · b85b51f2
      Andrea Bolognani 提交于
      Having the functions grouped together this way will avoid further
      shuffling around down the line.
      
      No functional changes.
      b85b51f2
    • A
      cpu: Simplify ppc64ModelFromCPU() · c238d16a
      Andrea Bolognani 提交于
      c238d16a
    • A
      cpu: Simplify NULL handling in ppc64 driver · 4590f067
      Andrea Bolognani 提交于
      Use briefer checks, eg. (!model) instead of (model == NULL), and
      avoid initializing to NULL a pointer that would be assigned in
      the first line of the function anyway.
      
      Also remove a pointless NULL assignment.
      
      No functional changes.
      4590f067
    • A
      cpu: Mark driver functions in ppc64 driver · 2686bf22
      Andrea Bolognani 提交于
      Use the ppc64Driver prefix for all functions that are used to
      fill in the cpuDriverPPC64 structure, ie. those that are going
      to be called by the generic CPU code.
      
      This makes it clear which functions are exported and which are
      implementation details; it also gets rid of the ambiguity that
      affected the ppc64DataFree() function which, despite what the
      name suggested, was not related to ppc64DataCopy() and could
      not be used to release the memory allocated for a
      virCPUppc64Data* instance.
      
      No functional changes.
      2686bf22
    • L
      qemu: fail on attempts to use <filterref> for non-tap network connections · f4f1d18d
      Laine Stump 提交于
      nwfilter uses iptables and ebtables, which only work properly on
      tap-based network connections (*not* on macvtap, for example), but we
      just ignore any <filterref> elements for other types of networks,
      potentially giving users a false sense of security.
      
      This patch checks the network type and fails/logs an error if any
      domain <interface> has a <filterref> when the connection isn't using a
      tap device.
      
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1180011
      f4f1d18d
    • L
      network: validate network NAT range · a6f9af82
      Laine Stump 提交于
      This patch modifies virSocketAddrGetRange() to function properly when
      the containing network/prefix of the address range isn't known, for
      example in the case of the NAT range of a virtual network (since it is
      a range of addresses on the *host*, not within the network itself). We
      then take advantage of this new functionality to validate the NAT
      range of a virtual network.
      
      Extra test cases are also added to verify that virSocketAddrGetRange()
      works properly in both positive and negative cases when the network
      pointer is NULL.
      
      This is the *real* fix for:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=985653
      
      Commits 1e334a and 48e8b9 had earlier been pushed as fixes for that
      bug, but I had neglected to read the report carefully, so instead of
      fixing validation for the NAT range, I had fixed validation for the
      DHCP range. sigh.
      a6f9af82
  3. 10 8月, 2015 12 次提交