1. 04 3月, 2013 1 次提交
    • C
      qemu: Use -1 as unpriviledged uid/gid · aff6942c
      Christophe Fergeau 提交于
      Commit f506a4c1 changed virSetUIDGID() to be a noop
      when uid/gid are -1, while it used to be a noop when
      they are <= 0.
      
      The changes in this commit broke creating new VMs in GNOME Boxes
      as qemuDomainCheckDiskPresence gets called during domain creation/startup,
      which in turn calls virFileAccessibleAs which fails after calling
      virSetUIDGID(0, 0) (Boxes uses session libvirtd). virSetUIDGID is called with
      (0, 0) as these are the default user/group values in virQEMUDriverConfig
      for session libvirtd.
      
      This commit changes virQEMUDriverConfigNew to use -1 as the unpriviledged
      uid/gid. I've also looked at the various places where cfg->user is used,
      and they all seem to handle -1 correctly.
      aff6942c
  2. 01 3月, 2013 1 次提交
    • D
      Fix deadlock in QEMU close callback APIs · 96b893f0
      Daniel P. Berrange 提交于
      There is a lock ordering problem in the QEMU close callback
      APIs.
      
      When starting a guest we have a lock on the VM. We then
      set a autodestroy callback, which acquires a lock on the
      close callbacks.
      
      When running auto-destroy, we obtain a lock on the close
      callbacks, then run each callbacks - which obtains a lock
      on the VM.
      
      This causes deadlock if anyone tries to start a VM, while
      autodestroy is taking place.
      
      The fix is to do autodestroy in 2 phases. First obtain
      all the callbacks and remove them from the list under
      the close callback lock. Then invoke each callback
      from outside the close callback lock.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      96b893f0
  3. 28 2月, 2013 1 次提交
    • D
      Fix autodestroy of QEMU guests · b4a124ef
      Daniel P. Berrange 提交于
      The virQEMUCloseCallbacksRunOne method was passing a uuid string
      to virDomainObjListFindByUUID, when it actually expected to get
      a raw uuid buffer. This was not caught by the compiler because
      the method was using a 'void *uuid' instead of first casting
      it to the expected type.
      
      This regression was accidentally caused by refactoring in
      
        commit 568a6cda
        Author: Jiri Denemark <jdenemar@redhat.com>
        Date:   Fri Feb 15 15:11:47 2013 +0100
      
          qemu: Avoid deadlock in autodestroy
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b4a124ef
  4. 21 2月, 2013 7 次提交
  5. 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
  6. 11 2月, 2013 1 次提交
  7. 08 2月, 2013 1 次提交
  8. 06 2月, 2013 1 次提交
  9. 05 2月, 2013 2 次提交
    • 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 次提交
    • 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
  11. 17 1月, 2013 1 次提交
    • 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
  12. 16 1月, 2013 1 次提交
  13. 07 1月, 2013 1 次提交
    • 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
  14. 21 12月, 2012 8 次提交
  15. 19 12月, 2012 1 次提交
  16. 13 12月, 2012 2 次提交
  17. 30 11月, 2012 2 次提交
  18. 29 11月, 2012 1 次提交
  19. 28 11月, 2012 1 次提交
  20. 02 11月, 2012 1 次提交
  21. 12 10月, 2012 1 次提交
  22. 21 9月, 2012 1 次提交
  23. 18 9月, 2012 1 次提交
  24. 21 8月, 2012 1 次提交
    • M
      qemu: configurable remote display port boundaries · 29226bee
      Martin Kletzander 提交于
      The defines QEMU_REMOTE_PORT_MIN and QEMU_REMOTE_PORT_MAX were used to
      find free port when starting domains. As this was hard-coded to the
      same ports as default VNC servers, there were races with these other
      programs. This patch includes the possibility to change the default
      starting port as well as the maximum port (mostly for completeness) in
      qemu config file.
      
      Support for two new config options in qemu.conf is added:
       - remote_port_min (defaults to QEMU_REMOTE_PORT_MIN and
         must be >= than this value)
       - remote_port_max (defaults to QEMU_REMOTE_PORT_MAX and
         must be <= than this value)
      29226bee