1. 07 3月, 2011 2 次提交
    • D
      Move event code out of the daemon/ into src/util/ · 343eaa15
      Daniel P. Berrange 提交于
      The event loop implementation is used by more than just the
      daemon, so move it into the shared area.
      
      * daemon/event.c, src/util/event_poll.c: Renamed
      * daemon/event.h, src/util/event_poll.h: Renamed
      * tools/Makefile.am, tools/console.c, tools/virsh.c: Update
        to use new virEventPoll APIs
      * daemon/mdns.c, daemon/mdns.c, daemon/Makefile.am: Update
        to use new virEventPoll APIs
      343eaa15
    • D
      Cleaning up some of the logging code · bcb40b85
      Daniel Veillard 提交于
      * src/util/logging.c: fix virLogDumpAllFD() to avoid snprintf, simplify
        the code and provide more useful signal descriptions. Also remove an
        unused variable.
      bcb40b85
  2. 06 3月, 2011 1 次提交
    • O
      qemu: Support vram for video of qxl type · 82dfc6f3
      Osier Yang 提交于
      For qemu names the primary vga as "qxl-vga":
      
        1) if vram is specified for 2nd qxl device:
      
          -vga qxl -global qxl-vga.vram_size=$SIZE \
          -device qxl,id=video1,vram_size=$SIZE,...
      
        2) if vram is not specified for 2nd qxl device, (use the default
           set by global):
      
          -vga qxl -global qxl-vga.vram_size=$SIZE \
          -device qxl,id=video1,...
      
      For qemu names all qxl devices as "qxl":
      
        1) if vram is specified for 2nd qxl device:
      
          -vga qxl -global qxl.vram_size=$SIZE \
          -device qxl,id=video1,vram_size=$SIZE ...
      
        2) if vram is not specified for 2nd qxl device:
      
          -vga qxl -global qxl-vga.vram_size=$SIZE \
          -device qxl,id=video1,...
      
      "-global" is the only way to define vram_size for the primary qxl
      device, regardless of how qemu names it, (It's not good a good
      way, as original idea of "-global" is to set a global default for
      a driver property, but to specify vram for first qxl device, we
      have to use it).
      
      For other qxl devices, as they are represented by "-device", could
      specify it directly and seperately for each, and it overrides the
      default set by "-global" if specified.
      
      v1 - v2:
        * modify "virDomainVideoDefaultRAM" so that it returns 16M as the
          default vram_size for qxl device.
      
        * vram_size * 1024 (qemu accepts bytes for vram_size).
      
        * apply default vram_size for qxl device for which vram_size is
          not specified.
      
        * modify "graphics-spice" tests (more sensiable vram_size)
      
        * Add an argument of virDomainDefPtr type for qemuBuildVideoDevStr,
          to use virDomainVideoDefaultRAM in qemuBuildVideoDevStr).
      
      v2 - v3:
        * Modify default video memory size for qxl device from 16M to 24M
      
        * Update codes to be consistent with changes on qemu_capabilities.*
      82dfc6f3
  3. 05 3月, 2011 1 次提交
  4. 04 3月, 2011 6 次提交
    • D
      Add an an internal API for emergency dump of debug buffer · 398553c1
      Daniel Veillard 提交于
      virLogEmergencyDumpAll() allows to dump the content of the
      debug buffer from within a signal handler. It saves to all
      log file or stderr if none is found
      * src/util/logging.h src/util/logging.c: add the new API
        and cleanup the old virLogDump code
      * src/libvirt_private.syms: exports it as a private symbol
      398553c1
    • D
      Fix a counter bug in the log buffer · 35708ec1
      Daniel Veillard 提交于
      * src/util/logging.c: the start pointer need to wrap around too
      35708ec1
    • D
      Force all logs to go to the round robbin memory buffer · 8b9a1190
      Daniel Veillard 提交于
      Initially only the log actually written out by libvirt were
      saved on the memory buffer, this patch forces all informations
      including info and debug to be saved in memory too. This is
      useful to get full data in case of crash.
      8b9a1190
    • L
      qemu: avoid corruption of domain hashtable and misuse of freed domains · f8ac6790
      Laine Stump 提交于
      This was also found while investigating
      
         https://bugzilla.redhat.com/show_bug.cgi?id=670848
      
      An EOF on a domain's monitor socket results in an event being queued
      to handle the EOF. The handler calls qemuProcessHandleMonitorEOF. If
      it is a transient domain, this leads to a call to
      virDomainRemoveInactive, which removes the domain from the driver's
      hashtable and unref's it. Nowhere in this code is the qemu driver lock
      acquired.
      
      However, all modifications to the driver's domain hashtable *must* be
      done while holding the driver lock, otherwise the hashtable can become
      corrupt, and (even more likely) another thread could call a different
      hashtable function and acquire a pointer to the domain that is in the
      process of being destroyed.
      
      To prevent such a disaster, qemuProcessHandleMonitorEOF must get the
      qemu driver lock *before* it gets the DomainObj's lock, and hold it
      until it is finished with the DomainObj. This guarantees that nobody
      else modifies the hashtable at the same time, and that anyone who had
      already gotten the DomainObj from the hashtable prior to this call has
      finished with it before we remove/destroy it.
      f8ac6790
    • L
      qemu: Add missing lock of virDomainObj before calling virDomainUnref · e570ca12
      Laine Stump 提交于
      This was found while researching the root cause of:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=670848
      
      virDomainUnref should only be called with the lock held for the
      virDomainObj in question. However, when a transient qemu domain gets
      EOF on its monitor socket, it queues an event which frees the monitor,
      which unref's the virDomainObj without first locking it. If another
      thread has already locked the virDomainObj, the modification of the
      refcount could potentially be corrupted. In an extreme case, it could
      also be potentially unlocked by virDomainObjFree, thus left open to
      modification by anyone else who would have otherwise waited for the
      lock (not to mention the fact that they would be accessing freed
      data!).
      
      The solution is to have qemuMonitorFree lock the domain object right
      before unrefing it. Since the caller to qemuMonitorFree doesn't expect
      this lock to be held, if the refcount doesn't go all the way to 0,
      qemuMonitorFree must unlock it after the unref.
      e570ca12
    • M
      esx: Escape password for XML · b31d6c12
      Matthias Bolte 提交于
      Passwords are allowed to contain <, >, &, ', " characters.
      Those need to be replaced by the corresponding entities.
      
      Reported by Hereward Cooper.
      b31d6c12
  5. 03 3月, 2011 4 次提交
    • E
      util: correct retry path in virFileOperation · d152f647
      Eric Blake 提交于
      In virFileOperation, the parent does a fallback to a non-fork
      attempt if it detects that the child returned EACCES.  However,
      the child was calling _exit(-EACCES), which does _not_ appear
      as EACCES in the parent.
      
      * src/util/util.c (virFileOperation): Correctly pass EACCES from
      child to parent.
      d152f647
    • S
      Pass virSecurityManagerPtr to virSecurityDAC{Set, Restore}ChardevCallback · e5f3b90e
      Soren Hansen 提交于
      virSecurityDAC{Set,Restore}ChardevCallback expect virSecurityManagerPtr,
      but are passed virDomainObjPtr instead. This makes
      virSecurityDACSetChardevLabel set a wrong uid/gid on chardevs. This
      patch fixes this behaviour.
      Signed-off-by: NSoren Hansen <soren@linux2go.dk>
      e5f3b90e
    • J
      util: Allow removing hash entries in virHashForEach · 9677cd33
      Jiri Denemark 提交于
      This fixes a possible crash of libvirtd during its startup. When qemu
      driver reconnects to running domains, it iterates over all domain
      objects in a hash. When reconnecting to an associated qemu monitor
      fails and the domain is transient, it's immediately removed from the
      hash. Despite the fact that it's explicitly forbidden to do so. If
      libvirtd is lucky enough, virHashForEach will access random memory when
      the callback finishes and the deamon will crash.
      
      Since it's trivial to fix virHashForEach to allow removal of hash
      entries while iterating through them, I went this way instead of fixing
      qemuReconnectDomain callback (and possibly others) to avoid deleting the
      entries.
      9677cd33
    • D
      Attempt to improve an error message · d6d30cd4
      Daniel P. Berrange 提交于
      Replace the 'Unknown failure' error message with something a
      little bit more descriptive.
      
      * src/util/virterror.c: Improve error message
      d6d30cd4
  6. 02 3月, 2011 2 次提交
  7. 01 3月, 2011 1 次提交
    • E
      qemu: only request sound cgroup ACL when required · 7c6b22c4
      Eric Blake 提交于
      When a SPICE or VNC graphics controller is present, and sound is
      piggybacked over a channel to the graphics device rather than
      directly accessing host hardware, then there is no need to grant
      host hardware access to that qemu process.
      
      * src/qemu/qemu_cgroup.c (qemuSetupCgroup): Prevent sound with
      spice, and with vnc when vnc_allow_host_audio is 0.
      Reported by Daniel Berrange.
      7c6b22c4
  8. 28 2月, 2011 1 次提交
  9. 26 2月, 2011 2 次提交
    • M
      Add support for multiple serial ports into the Xen driver · 3ee7cf6c
      Michal Novotny 提交于
      this is the patch to add support for multiple serial ports to the
      libvirt Xen driver. It support both old style (serial = "pty") and
      new style (serial = [ "/dev/ttyS0", "/dev/ttyS1" ]) definition and
      tests for xml2sexpr, sexpr2xml and xmconfig have been added as well.
      
      Written and tested on RHEL-5 Xen dom0 and working as designed but
      the Xen version have to have patch for RHBZ #614004 but this patch
      is for upstream version of libvirt.
      
      Also, this patch is addressing issue described in RHBZ #670789.
      Signed-off-by: NMichal Novotny <minovotn@redhat.com>
      3ee7cf6c
    • M
      Fix port value parsing for serial and parallel ports · 79c3fe4d
      Michal Novotny 提交于
      this is the patch to fix the virDomainChrDefParseTargetXML() functionality
      to parse the target port from XML if available. This is necessary for
      multiple serial port support which is the second part of this patch.
      Signed-off-by: NMichal Novotny <minovotn@redhat.com>
      79c3fe4d
  10. 25 2月, 2011 10 次提交
    • D
      Add APIs for killing off processes inside a cgroup · 33191b41
      Daniel P. Berrange 提交于
      The virCgroupKill method kills all PIDs found in a cgroup
      
      The virCgroupKillRecursively method does this recursively
      for child cgroups.
      
      The virCgroupKillPainfully method does a recursive kill
      several times in a row until everything has really died
      33191b41
    • D
      Allow hash tables to use generic pointers as keys · 16ba2aaf
      Daniel P. Berrange 提交于
      Relax the restriction that the hash table key must be a string
      by allowing an arbitrary hash code generator + comparison func
      to be provided
      
      * util/hash.c, util/hash.h: Allow any pointer as a key
      * internal.h: Include stdbool.h as standard.
      * conf/domain_conf.c, conf/domain_conf.c,
        conf/nwfilter_params.c, nwfilter/nwfilter_gentech_driver.c,
        nwfilter/nwfilter_gentech_driver.h, nwfilter/nwfilter_learnipaddr.c,
        qemu/qemu_command.c, qemu/qemu_driver.c,
        qemu/qemu_process.c, uml/uml_driver.c,
        xen/xm_internal.c: s/char */void */ in hash callbacks
      16ba2aaf
    • D
      Remove deallocator parameter from hash functions · 6952708c
      Daniel P. Berrange 提交于
      Since the deallocator is passed into the constructor of
      a hash table it is not desirable to pass it into each
      function again. Remove it from all functions, but provide
      a virHashSteal to allow a item to be removed from a hash
      table without deleteing it.
      
      * src/util/hash.c, src/util/hash.h: Remove deallocator
        param from all functions. Add virHashSteal
      * src/libvirt_private.syms: Add virHashSteal
      * src/conf/domain_conf.c, src/conf/nwfilter_params.c,
        src/nwfilter/nwfilter_learnipaddr.c,
        src/qemu/qemu_command.c, src/xen/xm_internal.c: Update
        for changed hash API
      6952708c
    • P
      Fix spelling mistake: seek · 0905d1ee
      Philipp Hahn 提交于
      Replace wrong "set" by correct "seek" in error message.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      0905d1ee
    • E
      audit: audit qemu pci and usb device passthrough · 1aaef5ad
      Eric Blake 提交于
      * src/qemu/qemu_audit.h (qemuDomainHostdevAudit): New prototype.
      * src/qemu/qemu_audit.c (qemuDomainHostdevAudit): New function.
      (qemuDomainStartAudit): Call as appropriate.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachHostPciDevice)
      (qemuDomainAttachHostUsbDevice, qemuDomainDetachHostPciDevice)
      (qemuDomainDetachHostUsbDevice): Likewise.
      1aaef5ad
    • E
      audit: audit qemu memory and vcpu adjusments · e25f2c74
      Eric Blake 提交于
      * src/qemu/qemu_audit.h (qemuDomainMemoryAudit)
      (qemuDomainVcpuAudit): New prototypes.
      * src/qemu/qemu_audit.c (qemuDomainResourceAudit)
      (qemuDomainMemoryAudit, qemuDomainVcpuAudit): New functions.
      (qemuDomainStartAudit): Call as appropriate.
      * src/qemu/qemu_driver.c (qemudDomainSetMemory)
      (qemudDomainHotplugVcpus): Likewise.
      e25f2c74
    • E
      audit: add qemu hooks for auditing cgroup events · 6bb98d41
      Eric Blake 提交于
      * src/qemu/qemu_audit.h (qemuDomainCgroupAudit): New prototype.
      * src/qemu/qemu_audit.c (qemuDomainCgroupAudit): Implement it.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Add audit.
      * src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
      (qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup)
      (qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.
      6bb98d41
    • E
      audit: prepare qemu for listing vm in cgroup audits · b4d3434f
      Eric Blake 提交于
      * src/qemu/qemu_cgroup.h (struct qemuCgroupData): New helper type.
      (qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
      (qemuTeardownDiskPathDeny): Drop unneeded prototypes.
      (qemuSetupDiskCgroup, qemuTeardownDiskCgroup): Adjust prototype.
      * src/qemu/qemu_cgroup.c
      (qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
      (qemuTeardownDiskPathDeny): Mark static and use new type.
      (qemuSetupHostUsbDeviceCgroup): Use new type.
      (qemuSetupDiskCgroup): Alter signature.
      (qemuSetupCgroup): Adjust caller.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
      (qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainAttachDevice)
      (qemuDomainUpdateDeviceFlags): Likewise.
      b4d3434f
    • E
      cgroup: determine when skipping non-devices · 06173876
      Eric Blake 提交于
      * src/util/cgroup.c (virCgroupAllowDevicePath)
      (virCgroupDenyDevicePath): Don't fail with EINVAL for
      non-devices.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update caller.
      * src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
      (qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup)
      (qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.
      06173876
    • E
      virExec: avoid uninitialized memory usage · fd21ecfd
      Eric Blake 提交于
      valgrind warns:
      
      ==21079== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
      ==21079==    at 0x329840F63E: __libc_sigaction (sigaction.c:67)
      ==21079==    by 0x4E5A8E7: __virExec (util.c:661)
      
      Regression introduced in commit ab07533e.  Technically, sa_mask
      shouldn't affect operation if sa_flags selects sa_handler, and
      sa_handler selects SIG_IGN, but better safe than sorry.
      
      * src/util/util.c (__virExec): Supply missing sigemptyset.
      fd21ecfd
  11. 24 2月, 2011 8 次提交
  12. 23 2月, 2011 2 次提交
    • D
      Expose name + UUID to LXC containers via env variables · 6704e3fd
      Daniel P. Berrange 提交于
      When spawning 'init' in the container, set
      
        LIBVIRT_LXC_UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
        LIBVIRT_LXC_NAME=YYYYYYYYYYYY
      
      to allow guest software to detect & identify that they
      are in a container
      
      * src/lxc/lxc_container.c: Set LIBVIRT_LXC_UUID and
        LIBVIRT_LXC_NAME env vars
      6704e3fd
    • D
      Fix off-by-1 in virFileAbsPath. · 9f5bbe3b
      Daniel P. Berrange 提交于
      The virFileAbsPath was not taking into account the '/' directory
      separator when allocating memory for combining cwd + path. Convert
      to use virAsprintf to avoid this type of bug completely.
      
      * src/util/util.c: Convert virFileAbsPath to use virAsprintf
      9f5bbe3b