1. 21 2月, 2013 4 次提交
  2. 20 2月, 2013 1 次提交
  3. 14 2月, 2013 1 次提交
    • L
      qemu: let virCommand set child process security labels/uid/gid · 0345c728
      Laine Stump 提交于
      The qemu driver had been calling virSecurityManagerSetProcessLabel()
      from a "pre-exec hook" function that is run after the child is forked,
      but before exec'ing qemu. This is problematic because the uid and gid
      of the child are set by the security driver, but capabilities are
      dropped by virCommand - such separation doesn't work; the two
      operations must be done together or the capabilities do not transfer
      properly to the child process.
      
      This patch switches to using virSecurityManagerSetChildProcessLabel(),
      which is called prior to virCommandRun() (rather than being called
      *during* virCommandrun() by the hook function), and doesn't set the
      UID/GID/security label directly, but instead merely informs virCommand
      what it should set them all to when the time is appropriate.
      
      This lets virCommand choose to do the uid/gid and caps dropping all at
      the same time if it wants (it does *want* to, but isn't doing so yet;
      that's for an upcoming patch).
      0345c728
  4. 13 2月, 2013 1 次提交
    • D
      Remove qemuDriverLock from almost everywhere · a9e97e0c
      Daniel P. Berrange 提交于
      With the majority of fields in the virQEMUDriverPtr struct
      now immutable or self-locking, there is no need for practically
      any methods to be using the QEMU driver lock. Only a handful
      of helper APIs in qemu_conf.c now need it
      a9e97e0c
  5. 12 2月, 2013 1 次提交
    • D
      Fix potential deadlock across fork() in QEMU driver · 61b52d2e
      Daniel P. Berrange 提交于
      The hook scripts used by virCommand must be careful wrt
      accessing any mutexes that may have been held by other
      threads in the parent process. With the recent refactoring
      there are 2 potential flaws lurking, which will become real
      deadlock bugs once the global QEMU driver lock is removed.
      
      Remove use of the QEMU driver lock from the hook function
      by passing in the 'virQEMUDriverConfigPtr' instance directly.
      
      Add functions to the virSecurityManager to be invoked before
      and after fork, to ensure the mutex is held by the current
      thread. This allows it to be safely used in the hook script
      in the child process.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      61b52d2e
  6. 11 2月, 2013 1 次提交
  7. 08 2月, 2013 2 次提交
  8. 06 2月, 2013 1 次提交
  9. 05 2月, 2013 3 次提交
    • D
      Turn virDomainObjList into an opaque virObject · 37abd471
      Daniel P. Berrange 提交于
      As a step towards making virDomainObjList thread-safe turn it
      into an opaque virObject, preventing any direct access to its
      internals.
      
      As part of this a new method virDomainObjListForEach is
      introduced to replace all existing usage of virHashForEach
      37abd471
    • D
      Rename all domain list APIs to have virDomainObjList prefix · 4f6ed6c3
      Daniel P. Berrange 提交于
      The APIs names for accessing the domain list object are
      very inconsistent. Rename them all to have a standard
      virDomainObjList prefix.
      4f6ed6c3
    • 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
  10. 24 1月, 2013 1 次提交
    • 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
  11. 23 1月, 2013 1 次提交
    • 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
  12. 16 1月, 2013 2 次提交
  13. 14 1月, 2013 1 次提交
  14. 10 1月, 2013 1 次提交
    • M
      qemu_agent: Remove agent reference only when disposing it · f2a4e5f1
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=892079
      
      With current code, if user calls virDomainPMSuspendForDuration()
      followed by virDomainDestroy(), the former API checks for qemu agent
      presence, which will evaluate as true (if agent is configured). While
      talking to qemu agent, the qemu driver is unlocked, so the latter API
      starts executing.  However, if machine dies meanwhile, libvirtd gets
      EOF on the agent socket and qemuProcessHandleAgentEOF() is called. The
      handler clears reference to qemu agent while the destroy API already
      holding a reference to it. This leads to NULL dereferencing later in
      the code. Therefore, the agent pointer should be set to NULL only if
      we are the exclusive owner of it.
      f2a4e5f1
  15. 09 1月, 2013 1 次提交
  16. 07 1月, 2013 3 次提交
    • O
      qemu: Check if the shared disk's cdbfilter conflicts with others · 1279e421
      Osier Yang 提交于
      This prevents domain starting and disk attaching if the shared disk's
      setting conflicts with other active domain(s), E.g. A domain with
      "sgio" set as "filtered", however, another active domain is using
      it set as "unfiltered".
      1279e421
    • O
      qemu: set unpriv_sgio when starting domain and attaching disk · 278f87c4
      Osier Yang 提交于
      This ignores the default "filtered" if unpriv_sgio is not supported
      by kernel, but for explicit request "filtered", it error out for
      domain starting.
      278f87c4
    • O
      qemu: Add a hash table for the shared disks · d7ead3e1
      Osier Yang 提交于
      This introduces a hash table for qemu driver, to store the shared
      disk's info as (@major:minor, @ref_count). @ref_count is the number
      of domains which shares the disk.
      
      Since we only care about if the disk support unprivileged SG_IO
      commands, and the SG_IO commands only make sense for block disk,
      this patch only manages (add/remove hash entry) the shared disk for
      block disk.
      
      * src/qemu/qemu_conf.h: (Add member 'sharedDisks' of type
                               virHashTablePtr; Declare helpers
                               qemuGetSharedDiskKey, qemuAddSharedDisk
                               and qemuRemoveSharedDisk)
      * src/qemu/qemu_conf.c (Implement the 3 helpers)
      * src/qemu/qemu_process.c (Update 'sharedDisks' when domain
                                 starting and shutdown)
      * src/qemu/qemu_driver.c (Update 'sharedDisks' when attaching
                                or detaching disk).
      d7ead3e1
  17. 04 1月, 2013 1 次提交
    • J
      qemu: fix a segfault in qemuProcessWaitForMonitor · b7a443fc
      Ján Tomko 提交于
      Commit b3f2b4ca left buf unallocated in
      the case of QMP capability probing being used, leading to a segfault in
      strlen in the cleanup path.
      
      This patch opens the log and allocates the buffer if QMP probing was
      used, so we can display the helpful error message.
      b7a443fc
  18. 03 1月, 2013 1 次提交
    • M
      qemu: Don't parse log output when starting up a domain · b3f2b4ca
      Michal Privoznik 提交于
      Despite our great effort we still parsed qemu log output.
      We wouldn't notice unless upcoming qemu 1.4 changed the
      format of the logs slightly. Anyway, now we should gather
      all interesting knobs like pty paths from monitor. Moreover,
      since for historical reasons the first console can be just
      an alias to the first serial port, we need to check this and
      copy the pty path if that's the case to the first console.
      b3f2b4ca
  19. 02 1月, 2013 1 次提交
  20. 30 12月, 2012 1 次提交
    • M
      qemu: Adapt to new log format · 28224c4d
      Michal Privoznik 提交于
      Since 586502189edf9fd0f89a83de96717a2ea826fdb0 qemu commit, the log
      lines reporting chardev's path has changed from:
      
      $ ./x86_64-softmmu/qemu-system-x86_64 -serial pty -serial pty -monitor pty
      char device redirected to /dev/pts/5
      char device redirected to /dev/pts/6
      char device redirected to /dev/pts/7
      
      to:
      
      $ ./x86_64-softmmu/qemu-system-x86_64 -serial pty -serial pty -monitor pty
      char device compat_monitor0 redirected to /dev/pts/5
      char device serial0 redirected to /dev/pts/6
      char device serial1 redirected to /dev/pts/7
      
      However, with current code we are not prepared for such change, which
      results in us being unable to start any domain.
      28224c4d
  21. 21 12月, 2012 8 次提交
  22. 19 12月, 2012 1 次提交
    • M
      fix typo in the word affinities · b72c97e7
      Martin Kletzander 提交于
      This patch fixes just the word Affinites to Affinities (it's really
      painful to search in TAGS without being able to find the right
      function).
      b72c97e7
  23. 13 12月, 2012 1 次提交
    • R
      Qemu FreeBSD: fix compilation · 9a2f36ec
      Roman Bogorodskiy 提交于
      * Autotools changes:
        - Don't assume Qemu is Linux-only
        - Check Linux headers only on Linux
        - Disable firewalld on FreeBSD
      * Initctl:
        Initctl seem to present only on Linux, so stub it on other platforms
      * Raw I/O: Linux-only as well
      * Headers cleanup
      9a2f36ec
  24. 12 12月, 2012 1 次提交
    • S
      add security hook for permitting hugetlbfs access · 88bd1a64
      Serge Hallyn 提交于
      When a qemu domain is backed by huge pages, apparmor needs to grant the domain
      rw access to files under the hugetlbfs mount point.  Add a hook, called in
      qemu_process.c, which ends up adding the read-write access through
      virt-aa-helper.  Qemu will be creating a randomly named file under the
      mountpoint and unlinking it as soon as it has mmap()d it, therefore we
      cannot predict the full pathname, but for the same reason it is generally
      safe to provide access to $path/**.
      Signed-off-by: NSerge Hallyn <serge.hallyn@ubuntu.com>
      88bd1a64