1. 02 9月, 2015 1 次提交
    • J
      qemu: add udp interface support · 5c668a78
      Jonathan Toppins 提交于
      Adds a new interface type using UDP sockets, this seems only applicable
      to QEMU but have edited tree-wide to support the new interface type.
      
      The interface type required the addition of a "localaddr" (local
      address), this then maps into the following xml and qemu call.
      
      <interface type='udp'>
        <mac address='52:54:00:5c:67:56'/>
        <source address='127.0.0.1' port='11112'>
          <local address='127.0.0.1' port='22222'/>
        </source>
        <model type='virtio'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
      </interface>
      
      QEMU call:
      	-net socket,udp=127.0.0.1:11112,localaddr=127.0.0.1:22222
      
      Notice the xml "local" entry becomes the "localaddr" for the qemu call.
      
      reference:
      http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00629.htmlSigned-off-by: NJonathan Toppins <jtoppins@cumulusnetworks.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      5c668a78
  2. 28 8月, 2015 1 次提交
  3. 27 8月, 2015 2 次提交
    • L
      qemu: Emit correct audit message for memory hot unplug · 8f8031df
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1226234#c3
      
      If the qemu monitor fails to remove the memory from the guest for
      any reason, the auditlog message will incorrectly use the current
      actual memory (via virDomainDefGetMemoryActual) instead of the
      value we were attempting to reduce to. The result is the 'new-mem'
      and 'old-mem' values for the auditlog message would be identical.
      
      This patch creates a local 'newmem' which accounts for the current
      memory size minus the memory which is being removed. NB, for the
      success case this results in the same value that would be returned
      by virDomainDefGetMemoryActual without the need to do the math. This
      follows the existing code which would subtract the size for cur_balloon.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      8f8031df
    • L
      qemu: Emit correct audit message for memory hot plug · cb1fbda4
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1226234#c3
      
      Prior to this patch, after successfully hot plugging memory
      the audit log indicated that the update failed, e.g.:
      
      type=VIRT_RESOURCE ... old-mem=1024000 new-mem=1548288 \
      exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=pts/2 res=failed
      
      This patch will adjust where virDomainAuditMemory is called to
      ensure the proper 'ret' value is used based on success or failure.
      
      Additionally, the audit message should include the size of the
      memory we were attempting to change to rather than the current
      actual size. On failure to add, the message showed the same value
      for old-mem and new-mem.
      
      In order to do this, introduce a 'newmem' local which will compute
      the new size based on the oldmem size plus the size of memory we
      are about to add. NB: This would be the same as calling the
      virDomainDefGetMemoryActual again on success, but avoids the
      overhead of recalculating. Plus cur_balloon is already adjusted
      by the same value, so this follows that.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      cb1fbda4
  4. 26 8月, 2015 2 次提交
  5. 24 8月, 2015 3 次提交
  6. 20 8月, 2015 1 次提交
  7. 19 8月, 2015 4 次提交
  8. 18 8月, 2015 1 次提交
  9. 16 8月, 2015 1 次提交
    • J
      qemu: Resolve Coverity UNINIT · c4cfc0d0
      John Ferlan 提交于
      Coverity complained that 'vm' wasn't initialized before jumping to
      cleanup: and calling virDomainObjEndAPI if the VIR_STRDUP fails.
      So I initialized vm = NULL and also moved the VIR_STRDUP closer to
      usage and used endjob for goto. Lots of other reasons for failures.
      c4cfc0d0
  10. 14 8月, 2015 3 次提交
  11. 13 8月, 2015 6 次提交
    • M
      qemu: Use numad information when getting pin information · 776924e3
      Martin Kletzander 提交于
      Pinning information returned for emulatorpin and vcpupin calls is being
      returned from our data without querying cgroups for some time.  However,
      not all the data were utilized.  When automatic placement is used the
      information is not returned for the calls mentioned above.  Since the
      numad hint in private data is properly saved/restored, we can safely use
      it to return true information.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1162947Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      776924e3
    • M
      qemu: Keep numad hint after daemon restart · 8ce86722
      Martin Kletzander 提交于
      The numad hint stored in priv->autoNodeset is information that gets lost
      during daemon restart.  And because we would like to use that
      information in the future, we also need to save it in the status XML.
      For the sake of tests, we need to initialize nnumaCell_max to some
      value, so that the restoration doesn't fail in our test suite.  There is
      no need to fill in the actual numa cell data since the recalculating
      function virCapabilitiesGetCpusForNodemask() will not fail, it will just
      skip filling the data in the bitmap which we don't use in tests anyway.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      8ce86722
    • M
      conf: Pass private data to Parse function of XML options · 7c8028cd
      Martin Kletzander 提交于
      This needs a reorder of XML option definitions.  It might come in handy
      one day.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      7c8028cd
    • M
      qemu: Fix segfault when parsing private domain data · 92ddffdb
      Martin Kletzander 提交于
      When parsing private domain data, there are two paths that are flawed.
      They are both error paths, just from different parts of the function.
      One of them can call free() on an uninitialized pointer.  Initialization
      to NULL is enough here.  The other one is a bit trickier to explain, but
      as easy as the first one to fix.  We create capabilities, parse them and
      then assign them into the private data pointer inside the domain object.
      If, however, we get to fail from now on, the error path calls unrefs the
      capabilities and then, when the domain object is being cleaned,
      qemuDomainObjPrivateFree() tries to unref them as well.  That causes a
      segfault.  Settin the pointer to NULL upon successful addition to the
      private data is enough.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      92ddffdb
    • J
      conf: Check for hostdev conflicts when assign default disk address · 1b08cc17
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1210587  (completed)
      
      When generating the default drive address for a SCSI <disk> device,
      check the generated address to ensure it doesn't conflict with a SCSI
      <hostdev> address. The <disk> address generation algorithm uses the
      <target> "dev" name in order to determine which controller and unit
      in order to place the device. Since a SCSI <hostdev> device doesn't
      require a target device name, its placement on the guest SCSI address
      "could" conflict.  For instance, if a SCSI <hostdev> exists at
      controller=0 unit=0 and an attempt to hotplug 'sda' into the guest
      made, there would be a conflict if the <hostdev> is already using
      /dev/sda.
      1b08cc17
    • F
      Drive hot-unplug: reliable parsing of HMP results · 69a3b0df
      Frank Schreuder 提交于
      Hot-unplugging a disk from a guest that supports hot-unplugging generates an error
      in the libvirt log when running QEMU with the "-msg timestamp=on" flag.
      
      2015-08-06 10:48:59.945+0000: 11662: error : qemuMonitorTextDriveDel:2594 :
      operation failed: deleting drive-virtio-disk4 drive failed:
      2015-08-06T10:48:59.945058Z Device 'drive-virtio-disk4' not found
      
      This error is caused because the HMP results are getting prefixed with a timestamp.
      Parsing the output is not reliable with STRPREFIX as the results can be prefixed with a timestamp.
      
      Using strstr ensures that parsing the output works whether the results are prefixed or not.
      
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NFrank Schreuder <fschreuder@transip.nl>
      69a3b0df
  12. 12 8月, 2015 2 次提交
    • L
      Revert "qemu: Allow to plug virtio-net-pci into PCIe slot" · d5e6d1cf
      Laine Stump 提交于
      This reverts commit ede34470, which
      was apparently written based on testing performed before commits
      1e15be1b and 9a12b6 were pushed upstream. Once those two patches are in
      place, commit ede34470 is redundant, and can even cause
      incorrect/unexpected behavior when auto-assigning addresses for
      virtio-net devices.
      d5e6d1cf
    • 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
  13. 11 8月, 2015 3 次提交
    • 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
    • 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
  14. 10 8月, 2015 10 次提交
    • M
    • C
      qemuMonitorOpenInternal: remove redundant code · 17cba9fb
      Cao jin 提交于
      There's no need to set mon->fd to a dummy value since
      it's initialized to proper value just a few lines below.
      Signed-off-by: NCao jin <caoj.fnst@cn.fujitsu.com>
      17cba9fb
    • L
      qemu: support new pci controller model "pcie-switch-downstream-port" · 7d69387c
      Laine Stump 提交于
      This is backed by the qemu device xio3130-downstream. It can only be
      connected to a pcie-switch-upstream-port (x3130-upstream) on the
      upstream side.
      7d69387c
    • L
      conf: new pcie-controller model "pcie-switch-downstream-port" · 76379a6e
      Laine Stump 提交于
      This controller can be connected only to a port on a
      pcie-switch-upstream-port. It provides a single hotpluggable port that
      will accept any PCI or PCIe device, as well as any device requiring a
      pcie-*-port (the only current example of such a device is the
      pcie-switch-upstream-port).
      76379a6e
    • L
      qemu: add capabilities bit for device xio3130-downstream · ad1748a1
      Laine Stump 提交于
      The downstream ports of an x3130-upstream switch can each have one of
      these plugged into them (and that is the only place they can be
      connected). Each xio3130-downstream provides a single PCIe port that
      can have PCI or PCIe devices hotplugged into it. Apparently an entire
      set of x3130-upstream + several xio3130-downstreams can be hotplugged
      as a unit, but it's not clear to me yet how that would be done, since
      qemu only allows attaching a single device at a time.
      
      This device will be used to implement the
      "pcie-switch-downstream-port" model of pci controller.
      ad1748a1
    • L
      qemu: support new pci controller model "pcie-switch-upstream-port" · cb99086d
      Laine Stump 提交于
      this is backed by the qemu device x3130-upstream. It can only plug
      into a pcie-root-port or pcie-switch-downstream-port.
      cb99086d
    • L
      conf: new pci controller model "pcie-switch-upstream-port" · 38ea9515
      Laine Stump 提交于
      This controller can be connected only to a pcie-root-port or a
      pcie-switch-downstream-port (which will be added in a later patch),
      which is the reason for the new connect type
      VIR_PCI_CONNECT_TYPE_PCIE_PORT. A pcie-switch-upstream-port provides
      32 ports (slot=0 to slot=31) on the downstream side, which can only
      have pci controllers of model "pcie-switch-downstream-port" plugged
      into them, which is the reason for the other new connect type
      VIR_PCI_CONNECT_TYPE_PCIE_SWITCH.
      38ea9515
    • L
      qemu: add capabilities bit for device x3130-upstream · 4cde7588
      Laine Stump 提交于
      This is the upstream part of a PCIe switch. It connects to a PCIe port
      (but not PCI) on the upstream side, and can have up to 31
      xio3130-downstream controllers (but no other types of devices)
      connected to its downstream side.
      
      This device will be used to implement the "pcie-switch-upstream-port"
      model of pci controller.
      4cde7588
    • L
      qemu: support new pci controller model "pcie-root-port" · 16328520
      Laine Stump 提交于
      This is backed by the qemu device ioh3420.
      
      chassis and port from the <target> subelement are used to store/set the
      respective qemu device options for the ioh3420. Currently, chassis is
      set to be the index of the controller, and port is set to
      "(slot << 3) + function" (per suggestion from Alex Williamson).
      16328520
    • L
      conf: new pci controller model "pcie-root-port" · dce3b8be
      Laine Stump 提交于
      This controller can be connected (at domain startup time only - not
      hotpluggable) only to a port on the pcie root complex ("pcie-root" in
      libvirt config), hence the new connect type
      VIR_PCI_CONNECT_TYPE_PCIE_ROOT. It provides a hotpluggable port that
      will accept any PCI or PCIe device.
      
      New attributes must be added to the controller <target> subelement for
      this - chassis and port are guest-visible option values that will be
      set by libvirt with values derived from the controller's index and pci
      address information.
      dce3b8be