1. 31 1月, 2013 1 次提交
    • J
      Enforce return check on virAsprintf() calls · 46b1d8cf
      John Ferlan 提交于
      Way back when I started making changes for Coverity messages my first set
      were to a bunch of CHECKED_RETURN errors.  In particular virAsprintf() had
      a few callers that Coverity noted didn't check their return (although some
      did check if the buffer being printed to was NULL or not).
      
      It was suggested at the time as a further patch an ATTRIBUTE_RETURN_CHECK
      should be added to virAsprintf(), see:
      
      https://www.redhat.com/archives/libvir-list/2013-January/msg00120.html
      
      This patch does that and fixes a few more instances not found by Coverity
      that failed the check.
      46b1d8cf
  2. 30 1月, 2013 5 次提交
    • J
      util: Fix mask for 172.16.0.0 private address range · 6405713f
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=905708
      
      Only the first 12 bits should be set in the mask for this range. All
      addresses between 172.16.0.0 and 172.31.255.255 are private.
      6405713f
    • P
      snapshot: Mention disk-only snapshots in error message · 366a3d52
      Peter Krempa 提交于
      When a disk-only snapshot is requested the domain is treated as if it
      was offline. This forbids to mix memory checkpoints with the DISK_ONLY
      flag.
      
      This patch improves the error message and mentions the restriction in
      the virsh man page.
      366a3d52
    • M
      docs: aesthetical cleanups · 901f4b6b
      Martin Kletzander 提交于
      Adding dots inside "exempli gratia" where missing.  While on that, I
      took the liberty of changing it where found with simple grep.
      901f4b6b
    • M
      conf: Don't format cputune element when not needed · 1f50730e
      Martin Kletzander 提交于
      Commit 60b176c3 introduced a bug that
      when editing an XML with cputune similar to this:
      
      ...
        <vcpu placement='static' current='1'>2</vcpu>
        <cputune>
          <vcpupin vcpu="1" cpuset="0"/>
        </cputune>
      ...
      
      results in formatted XML that looks like this:
      
      ...
        <vcpu placement='static' current='1'>2</vcpu>
        <cputune>
        </cputune>
      ...
      
      That is caused by a condition depending on def->cputune.vcpupin being
      set rather than checking def->cputune.nvcpupin.  Notice that nvcpupin
      can be 0 and vcpupin can still be allocated since it's a pointer to an
      array, so no harm done there.
      
      I also changed it on other places in the code where it depended on the
      wrong variable.
      1f50730e
    • D
      virlog: remove old code comment · 1c23ba28
      Doug Goldstein 提交于
      Setting the log output prefix to 0 is not supported and in fact results
      in the following message:
      warning : virLogParseOutputs:1021 : Ignoring invalid log output setting.
      1c23ba28
  3. 29 1月, 2013 3 次提交
  4. 27 1月, 2013 2 次提交
  5. 26 1月, 2013 9 次提交
    • J
      vbox: Adjust the UTF FREE macros · 97278ab4
      John Ferlan 提交于
      Adjust the macros to free memory allocated during various calls to
      perform the check if parameter is NULL prior to really freeing and to
      set the pointer to NULL after done freeing.
      97278ab4
    • J
      vbox: Address false positive for NULL dereference · 4f01d3d5
      John Ferlan 提交于
      Resolve a false positive from 'vboxIIDFromUUID_v2_x()'. The code sets
      'iid->value = &iid->backing' unconditionally prior to calling 'nsIDFromChar()'.
      The 'vboxIIDUnalloc_v2_x()' checks iid->value to not be &iid->backing. The
      iid->backing is a static buffer within the initialized structure.
      4f01d3d5
    • J
      libxl: Domain event handler improvements · 70291149
      Jim Fehlig 提交于
      Since libxl provides the domain ID in the event handler callback,
      find the domain object based on the ID.  This approach prevents
      processing the callback on a domain that has already been reaped.
      
      Also, similar to the xl implementation, ignore the SUSPEND shutdown
      reason.  By calling libxl_domain_suspend(), we know a shutdown
      event with SUSPEND reason will be generated, but it can be safely
      ignored since any subsequent cleanup will be done by the callers.
      70291149
    • J
      libxl: Fix removing non-persistent domain after save · 02ed255e
      Jim Fehlig 提交于
      libxlDoDomainSave() was removing non-persistent domains, but
      required callers to have the virDomainObj locked.  Callers could
      potentially unlock an already freed virDomainObj.  Move this
      logic to the callers of libxlDoDomainSave().
      02ed255e
    • J
      libxl: Explicitly remove timeouts · ce33422d
      Jim Fehlig 提交于
      I've noticed that libxl can invoke timeout reregister/modify hooks
      after returning from libxl_ctx_free.  Explicitly remove the
      timeouts before freeing the libxl ctx to avoid executing hooks on
      stale objects.
      ce33422d
    • J
      libxl: Fix race between destruction of objects · 889ce746
      Jim Fehlig 提交于
      It is possible to destroy and cleanup a VM, resulting in freeing the
      libxlDomainObjPrivate object and associated libxl ctx, before all fds and
      timeouts have been deregistered and destroyed.
      
      Fix this race by incrementing the reference count on libxlDomainObjPrivate
      for each fd and timeout registration.  Only when all fds and timeouts are
      deregistered and destroyed will the libxlDomainObjPrivate be destroyed.
      889ce746
    • J
      libxl: Fix races in libxl event code · e0622ca2
      Jim Fehlig 提交于
      The libxl driver is racy in it's interactions with libxl and libvirt's
      event loop.  The event loop can invoke callbacks after libxl has
      deregistered the event, and possibly access freed data associated with
      the event.
      
      This patch fixes the race by converting libxlDomainObjPrivate to a
      virObjectLockable, and locking it while executing libxl upcalls and
      libvirt event loop callbacks.
      
      Note that using the virDomainObj lock is not satisfactory since it may
      be desirable to hold the virDomainObj lock even when libxl events such
      as reading and writing to xenstore need processed.
      e0622ca2
    • J
      libxl: Fix handling of timeouts · 04172610
      Jim Fehlig 提交于
      xen-unstable changeset 26469 makes changes wrt modifying and deregistering
      timeouts.
      
      First, timeout modify callbacks will only be invoked with an
      abs_t of {0,0}, i.e. make the timeout fire immediately.  Prior to this
      commit, timeout modify callbacks were never invoked.
      
      Second, timeout deregister hooks will no longer be called.
      
      This patch makes changes in the libvirt libxl driver that should be
      compatible before and after changeset 26469.
      
      While at it, fix a potential overflow in the timeout register callback.
      04172610
    • E
      conf: avoid NULL deref for pmsuspended domain state · e0642059
      Eric Blake 提交于
      While working with a pmsuspend vs. snapshot issue, I noticed that
      the state file in /var/run/libvirt/qemu/dom.xml contained a rather
      suspicious "(null)" string, which does not round-trip well through
      a libvirtd restart.  Had I been on a platform other than glibc
      where printf("%s",NULL) crashes instead of printing (null), we might
      have noticed the problem much sooner.
      
      And in fixing that problem, I also noticed that we had several
      missing states, because we were #defining several *_LAST names
      to a value _different_ than what they were already given as enums
      in libvirt.h.  Yuck.  I got rid of default: labels in the case
      statements, because they get in the way of gcc's -Wswitch helping
      us ensure we cover all enum values.
      
      * src/conf/domain_conf.c (virDomainStateReasonToString)
      (virDomainStateReasonFromString): Fill in missing domain states;
      rewrite case statement to let compiler enforce checking.
      (VIR_DOMAIN_NOSTATE_LAST, VIR_DOMAIN_RUNNING_LAST)
      (VIR_DOMAIN_BLOCKED_LAST, VIR_DOMAIN_PAUSED_LAST)
      (VIR_DOMAIN_SHUTDOWN_LAST, VIR_DOMAIN_SHUTOFF_LAST)
      (VIR_DOMAIN_CRASHED_LAST): Drop dead defines.
      (VIR_DOMAIN_PMSUSPENDED_LAST): Drop dead define.
      (virDomainPMSuspendedReason): Add missing enum function.
      (virDomainRunningReason, virDomainPausedReason): Add missing enum
      value.
      * src/conf/domain_conf.h (virDomainPMSuspendedReason): Declare
      missing functions.
      * src/libvirt_private.syms (domain_conf.h): Export them.
      e0642059
  6. 25 1月, 2013 11 次提交
    • E
      maint: make it easier to sort syms files · f0aa4935
      Eric Blake 提交于
      I got bit by 'make check' complaining that the sort order I got
      by emacs' sort-lines function differed from expectations.
      
      * src/libvirt_private.syms: Add emacs trailer.
      * src/libvirt_atomic.syms: Likewise.
      * src/libvirt_daemon.syms: Likewise.
      * src/libvirt_esx.syms: Likewise.
      * src/libvirt_libssh2.syms: Likewise.
      * src/libvirt_linux.syms: Likewise.
      * src/libvirt_openvz.syms: Likewise.
      * src/libvirt_sasl.syms: Likewise.
      * src/libvirt_vmx.syms: Likewise.
      * src/libvirt_xenxs.syms: Likewise.
      f0aa4935
    • 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
    • J
      locking: use virStrcpyStatic instead of memcpy · 678e8913
      John Ferlan 提交于
      678e8913
    • J
      python: Fix bindings for virDomainSnapshotGet{Domain,Connect} · 7b35fd71
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=895882
      
      virDomainSnapshot.getDomain() and virDomainSnapshot.getConnect()
      wrappers around virDomainSnapshotGet{Domain,Connect} were not supposed
      to be ever implemented. The class should contain proper domain() and
      connect() accessors that fetch python objects stored internally within
      the class. While domain() was already provided, connect() was missing.
      
      This patch adds connect() method to virDomainSnapshot class and
      reimplements getDomain() and getConnect() methods as aliases to domain()
      and connect() for backward compatibility.
      7b35fd71
    • 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
  7. 24 1月, 2013 9 次提交