1. 05 2月, 2013 3 次提交
    • D
      Introduce a virQEMUDriverConfigPtr object · b090aa7d
      Daniel P. Berrange 提交于
      Currently the virQEMUDriverPtr struct contains an wide variety
      of data with varying access needs. Move all the static config
      data into a dedicated virQEMUDriverConfigPtr object. The only
      locking requirement is to hold the driver lock, while obtaining
      an instance of virQEMUDriverConfigPtr. Once a reference is held
      on the config object, it can be used completely lockless since
      it is immutable.
      
      NB, not all APIs correctly hold the driver lock while getting
      a reference to the config object in this patch. This is safe
      for now since the config is never updated on the fly. Later
      patches will address this fully.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b090aa7d
    • M
      qemu: Catch stderr of image compression binary · 137229bf
      Michal Privoznik 提交于
      If a compression binary prints something to stderr, currently
      it is discarded. However, it can contain useful data from
      debugging POV, so we should catch it.
      137229bf
    • M
      qemu: Catch stderr of image decompression binary · cc6c425f
      Michal Privoznik 提交于
      If a decompression binary prints something to stderr, currently
      it is discarded. However, it can contain useful data from
      debugging POV, so we should catch it.
      cc6c425f
  2. 01 2月, 2013 2 次提交
    • S
      Add support for QEMU -add-fd support detection · 410b335d
      Stefan Berger 提交于
      Add support for QEMU -add-fd command line parameter detection.
      This intentionally rejects qemu 1.2, where 'add-fd' QMP did
      not allow full control of set ids, and where there was no command
      line counterpart, but accepts qemu 1.3.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      410b335d
    • E
      qemu: expose qemu 1.3 add-fd monitor command · 7b2c5893
      Eric Blake 提交于
      Add entry points for calling the qemu 'add-fd' and 'remove-fd'
      monitor commands.  There is no entry point for 'query-fdsets';
      the assumption is that a developer can use
       virsh qemu-monitor-command domain '{"execute":"query-fdsets"}'
      when debugging issues, and that meanwhile, libvirt is responsible
      enough to remember what fds it associated with what fdsets.
      Likewise, on the 'add-fd' command, it is assumed that libvirt
      will always pass a set id, rather than letting qemu autogenerate
      the next available id number.
      
      * src/qemu/qemu_monitor.c (qemuMonitorAddFd, qemuMonitorRemoveFd):
      New functions.
      * src/qemu/qemu_monitor.h (qemuMonitorAddFd, qemuMonitorRemoveFd):
      New prototypes.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONAddFd)
      (qemuMonitorJSONRemoveFd): New functions.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONAddFd)
      (qemuMonitorJSONRemoveFd): New prototypes.
      7b2c5893
  3. 29 1月, 2013 1 次提交
  4. 27 1月, 2013 1 次提交
    • M
      qemu_hotplug: Rework media changing process · 84c59ffa
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=892289
      
      It seems like with new udev within guest OS, the tray is locked,
      so we need to:
      - 'eject'
      - wait for tray to open
      - 'change'
      
      Moreover, even when doing bare 'eject', we should check for
      'tray_open' as guest may have locked the tray. However, the
      waiting phase shouldn't be unbounded, so I've chosen 10 retries
      maximum, each per 500ms. This should give enough time for guest
      to eject a media and open the tray.
      84c59ffa
  5. 25 1月, 2013 8 次提交
    • M
      qemu_monitor: Fix tray-open attribute in query-block · 319ed264
      Michal Privoznik 提交于
      With our code, we fail to query for tray-open attribute currently.
      That's because in HMP it is 'tray-open' and in QMP it's 'tray_open'.
      It always has been. However, we got it exactly the opposite.
      319ed264
    • D
      Fix bogus reporting of KVM support for non-native emulators · c29eafc8
      Daniel P. Berrange 提交于
      A logic bug meant we reported KVM was possible for every
      architecture, merely based on whether the query-kvm command
      exists. We should instead have been doing it based on whether
      the query-kvm command returns 'present: 1'
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c29eafc8
    • D
      Move QEMU capabilities initialization later in QEMU startup · d7a3700e
      Daniel P. Berrange 提交于
      Currently QEMU capabilities are initialized before the QEMU driver
      sets ownership on its various directories. The upshot is that if
      you change the user/group in the qemu.conf file, libvirtd will fail
      to probe QEMU the first time it is run after the config change.
      Moving QEMU capabilities initialization to after the chown() calls
      fixes this
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d7a3700e
    • D
      Fix performance & reliabilty of QMP probing · 1b253a10
      Daniel P. Berrange 提交于
      This previous commit
      
        commit 1a50ba2c
        Author: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
        Date:   Mon Nov 26 15:17:13 2012 +0100
      
          qemu: Fix QMP Capabability Probing Failure
      
      which attempted to make sure the QEMU process used for probing
      ran as the right user id, caused serious performance regression
      and unreliability in probing. The -daemonize switch in QEMU
      guarantees that the monitor socket is present before the parent
      process exits. This means libvirtd is guaranteed to be able to
      connect immediately. By switching from -daemonize to the
      virCommandDaemonize API libvirtd was no longer synchronized with
      QEMU's startup process. The result was that the QEMU monitor
      failed to open and went into its 200ms sleep loop. This happened
      for all 25 binaries resulting in 5 seconds worth of sleeping
      at libvirtd startup. In addition sometimes when libvirt connected,
      QEMU would be partially initialized and crash causing total
      failure to probe that binary.
      
      This commit reverts the previous change, ensuring we do use the
      -daemonize flag to QEMU. Startup delay is cut from 7 seconds
      to 2 seconds on my machine, which is on a par with what it was
      prior to the capabilities rewrite.
      
      To deal with the fact that QEMU needs to be able to create the
      pidfile, we switch pidfile location fron runDir to libDir, which
      QEMU is guaranteed to be able to write to.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1b253a10
    • M
      qemuDomainSendKey: Relax the qemu driver locking · 2eb54c74
      Michal Privoznik 提交于
      Currently, there is no reason to hold qemu driver locked
      throughout whole API execution. Moreover, we can use the
      new qemuDomObjFromDomain() internal API to lookup domain then.
      2eb54c74
    • J
      qemu: escape ipv6 for rbd network disk hosts · c1509ab4
      Josh Durgin 提交于
      Hosts for rbd are ceph monitor daemons. These have fixed IP addresses,
      so they are often referenced by IP rather than hostname for
      convenience, or to avoid relying on DNS. Using IPv4 addresses as the
      host name works already, but IPv6 addresses require rbd-specific
      escaping because the colon is used as an option separator in the
      string passed to qemu.
      
      Escape these colons, and enclose the IPv6 address in square brackets
      so it is distinguished from the port, which is currently mandatory.
      Acked-by: NOsier Yang <jyang@redhat.com>
      Signed-off-by: NJosh Durgin <josh.durgin@inktank.com>
      c1509ab4
    • E
      snapshot: fix state after external snapshot of S3 domain · 339bdd99
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=876829 complains that
      if a guest is put into S3 state (such as via virsh dompmsuspend)
      and then an external snapshot is taken, qemu forcefully transitions
      the domain to paused, but libvirt doesn't reflect that change
      internally.  Thus, a user has to use 'virsh suspend' to get libvirt
      back in sync with qemu state, and if the user doesn't know this
      trick, then the guest appears hung.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateActiveExternal):
      Track fact that qemu wakes up a suspended domain on migration.
      339bdd99
    • D
      Fix crash free'ing securityDriverNames in QEMU driver · bbc663b1
      Daniel P. Berrange 提交于
      The previous fix to avoid leaking securityDriverNames forgot to
      handle the case of securityDriverNames being NULL, leading to
      a crash
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bbc663b1
  6. 24 1月, 2013 5 次提交
    • D
      Fix leak of securityDriverNames · d200363e
      Daniel P. Berrange 提交于
      When shutting down, the QEMU driver forgot to free the
      securityDriverNames string list
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d200363e
    • D
      Avoid use of free'd memory in auto destroy callback · 4e4c6620
      Daniel P. Berrange 提交于
      The autodestroy callback code has the following function
      called from a hash iterator
      
        qemuDriverCloseCallbackRun(void *payload,
                                   const void *name,
                                   void *opaque)
        {
          ...
          char *uuidstr = name
          ...
      
          dom = closeDef->cb(data->driver, dom, data->conn);
          if (dom)
              virObjectUnlock(dom);
      
          virHashRemoveEntry(data->driver->closeCallbacks, uuidstr);
        }
      
      The closeDef->cb function may well cause the current callback
      to be removed, if it shuts down 'dom'. As such the use of
      'uuidstr' in virHashRemoveEntry is accessing free'd memory.
      We must make a copy of the uuid str before invoking the
      callback to be safe.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4e4c6620
    • P
      capabilities: Switch CPU data in NUMA topology to a struct · 87b4c10c
      Peter Krempa 提交于
      This will allow storing additional topology data in the NUMA topology
      definition.
      
      This patch changes the storage type and fixes fallout of the change
      across the drivers using it.
      
      This patch also changes semantics of adding new NUMA cell information.
      Until now the data were re-allocated and copied to the topology
      definition. This patch changes the addition function to steal the
      pointer to a pre-allocated structure to simplify the code.
      87b4c10c
    • V
      S390: Enhance memballoon handling for virtio-s390 · 053e813a
      Viktor Mihajlovski 提交于
      The way in that memory balloon suppression was handled for S390
      is flawed for a number or reasons.
      1. Just preventing the default balloon to be created in the case
         of VIR_ARCH_S390[X] is not sufficient. An explicit memballoon
         element in the guest definition will still be honored, resulting
         both in a -balloon option and the allocation of a PCI bus address,
         neither being supported.
      2. Prohibiting balloon for S390 altogether at a domain_conf level
         is no good solution either as there's work in progress on the QEMU
         side to implement a virtio-balloon device, although in
         conjunction with a new machine type. Suppressing the balloon
         should therefore be done at the QEMU driver level depending
         on the present capabilities.
      
      Therefore we remove the conditional suppression of the default
      balloon in domain_conf.c.
      Further, we are claiming the memballoon device for virtio-s390
      during device address assignment to prevent it from being considered
      as a PCI device.
      Finally, we suppress the generation of the balloon command line option
      if this is a virtio-s390 machine.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      053e813a
    • V
      qemu: Re-add driver unlock to qemuDomainSendKey · 7b3a9f75
      Viktor Mihajlovski 提交于
      Should have been done in commit 56fd5134 already, but was missed
      due to oversight: qemuDomainSendKey didn't release the driver lock
      in its cleanup section. This fixes an issue introduced by commit
      8c5d2bad.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      7b3a9f75
  7. 23 1月, 2013 2 次提交
    • M
      qemu_agent: Ignore expected EOFs · d960d06f
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=892079
      
      One of my previous patches (f2a4e5f1) tried to fix crashing
      libvirtd on domain detroy. However, we need to copy pattern from
      qemuProcessHandleMonitorEOF() instead of decrementing reference
      counter. The rationale for this is, if qemu process is dying due
      to domain being destroyed, we obtain EOF on both the monitor and
      agent sockets. However, if the exit is expected, qemuProcessStop
      is called, which cleans both agent and monitor sockets up. We
      want qemuAgentClose() to be called iff the EOF is not expected,
      so we don't leak an FD and memory. Moreover, there could be race
      with qemuProcessHandleMonitorEOF() which could have already
      closed the agent socket, in which case we don't want to do
      anything.
      d960d06f
    • A
      qemu: Support ram bar size for qxl devices · 55bfd020
      Alon Levy 提交于
      Adds a "ram" attribute globally to the video.model element, that changes
      the resulting qemu command line only if video.type == "qxl".
      
      <video>
        <model type='qxl' ram='65536' vram='65536' heads='1'/>
      </video>
      
      That attribute gets a default value of 64*1024. The schema is unchanged
      for other video element types.
      
      The resulting qemu command line change is the addition of
      
      -global qxl-vga.ram_size=<ram>*1024
      
      or
      
      -global qxl.ram_size=<ram>*1024
      
      For the main and secondary qxl devices respectively.
      
      The default for the qxl ram bar is 64*1024 kilobytes (the same as the
      default qxl vram bar size).
      55bfd020
  8. 22 1月, 2013 2 次提交
  9. 21 1月, 2013 2 次提交
  10. 19 1月, 2013 1 次提交
  11. 18 1月, 2013 4 次提交
  12. 17 1月, 2013 2 次提交
    • D
      Avoid integer wrap on remotePortMax in QEMU driver · da5a8aee
      Daniel P. Berrange 提交于
      The QEMU driver default max port is 65535, but it then increments
      this by 1 to 65536. This maps to 0 in an unsigned short :-( This
      was apparently done so that for() loops could use "< max" instead
      of "<= max". Remove this insanity and just make the loop do the
      right thing.
      da5a8aee
    • J
      qemu: fix QEMU_CAPS_NO_ACPI detection · 31494974
      Ján Tomko 提交于
      In commit c4bbaaf8, caps->arch was checked uninitialized, rendering the
      whole check useless.
      
      This patch moves the conditional setting of QEMU_CAPS_NO_ACPI to
      qemuCapsInitQMP, and removes the no longer needed exception for S390.
      
      It also clears the flag for all non-x86 archs instead of just S390 in
      qemuCapsInitHelp.
      31494974
  13. 16 1月, 2013 4 次提交
  14. 14 1月, 2013 2 次提交
  15. 12 1月, 2013 1 次提交