1. 29 12月, 2013 1 次提交
    • D
      libxl: avoid crashing if calling `virsh numatune' on inactive domain · 5904ba60
      Dario Faggioli 提交于
      by, in libxlDomainGetNumaParameters(), calling libxl_bitmap_init() as soon as
      possible, which avoids getting to 'cleanup:', where libxl_bitmap_dispose()
      happens, without having initialized the nodemap, and hence crashing after some
      invalid free()-s:
      
       # ./daemon/libvirtd -v
       *** Error in `/home/xen/libvirt.git/daemon/.libs/lt-libvirtd': munmap_chunk(): invalid pointer: 0x00007fdd42592666 ***
       ======= Backtrace: =========
       /lib64/libc.so.6(+0x7bbe7)[0x7fdd3f767be7]
       /lib64/libxenlight.so.4.3(libxl_bitmap_dispose+0xd)[0x7fdd2c88c045]
       /home/xen/libvirt.git/daemon/.libs/../../src/.libs/libvirt_driver_libxl.so(+0x12d26)[0x7fdd2caccd26]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(virDomainGetNumaParameters+0x15c)[0x7fdd4247898c]
       /home/xen/libvirt.git/daemon/.libs/lt-libvirtd(+0x1d9a2)[0x7fdd42ecc9a2]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(virNetServerProgramDispatch+0x3da)[0x7fdd424e9eaa]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(+0x1a6f38)[0x7fdd424e3f38]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(+0xa81e5)[0x7fdd423e51e5]
       /home/xen/libvirt.git/src/.libs/libvirt.so.0(+0xa783e)[0x7fdd423e483e]
       /lib64/libpthread.so.0(+0x7c53)[0x7fdd3febbc53]
       /lib64/libc.so.6(clone+0x6d)[0x7fdd3f7e1dbd]
      Signed-off-by: NDario Faggili <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      (cherry picked from commit f9ee91d3)
      5904ba60
  2. 18 11月, 2013 1 次提交
  3. 05 9月, 2013 2 次提交
    • J
      libxl: Unconditionally call virSysinfoRead() on driver init · b78e8cb2
      Jim Fehlig 提交于
      No need to check if privileged when reading hostsysinfo, since
      that check was already done in libxlDriverShouldLoad().  The
      libxl driver fails to load if not privileged.
      b78e8cb2
    • J
      libxl: Fix Coverity warning · 5236aed8
      Jim Fehlig 提交于
      John Ferlan reported the following Coverity warning:
      
      In libxlDomainCoreDump() Coverity has noted a FORWARD_NULL reference:
      
      2004 	    if ((flags & VIR_DUMP_CRASH) && !vm->persistent) {
      2005 	        virDomainObjListRemove(driver->domains, vm);
      
      (20) Event assign_zero: 	Assigning: "vm" = "NULL".
      Also see events: 	[var_deref_model]
      
      2006 	        vm = NULL;
      2007 	    }
      2008
      2009 	    ret = 0;
      2010
      2011 	cleanup_unpause:
      
      (21) Event var_deref_model: 	Passing null pointer "vm" to function
           "virDomainObjIsActive(virDomainObjPtr)", which dereferences it. [details]
      Also see events: 	[assign_zero]
      
      2012 	    if (virDomainObjIsActive(vm) && paused) {
      2013 	        if (libxl_domain_unpause(priv->ctx, dom->id) != 0) {
      2014 	            virReportError(VIR_ERR_INTERNAL_ERROR,
      
      Removing the vm from domain obj list and setting it to NULL can be
      done in the previous 'if (flags & VIR_DUMP_CRASH)' conditional.  Fix
      the Coverity warning by ensuring vm is not NULL before testing if it
      is still active.
      5236aed8
  4. 04 9月, 2013 11 次提交
    • J
      libxl: Use standard format for source file copyright notice · edd60d9c
      Jim Fehlig 提交于
      Change source file copyright notice to prevailing libvirt style.
      edd60d9c
    • J
      libxl: Add libxlDomObjFromDomain · 0d87fd0a
      Jim Fehlig 提交于
      Similar to the QEMU and LXC drivers, add a helper function to
      lookup a domain, and use it instead of much copy and paste.
      0d87fd0a
    • J
      libxl: Remove unnecessary driver locking · 21bdbb82
      Jim Fehlig 提交于
      Now that most fields of libxlDriverPrivate struct are immutable
      or self-locking, there is no need to acquire the driver lock in
      much of the libxl driver.
      21bdbb82
    • J
      libxl: Move driver lock/unlock to libxl_conf · cf735fe0
      Jim Fehlig 提交于
      Move the libxl driver lock/unlock functions from libxl_driver.c
      to libxl_conf.h so they can be used by other source files.
      cf735fe0
    • J
      libxl: Use atomic ops for driver->nactive · 6cd43d36
      Jim Fehlig 提交于
      6cd43d36
    • J
      libxl: Introduce libxlDriverConfig object · d9f19c30
      Jim Fehlig 提交于
      The libxlDriverPrivate struct contains an variety of data with
      varying access needs. Similar to the QEMU and LXC drivers,
      move all the static config data into a dedicated libxlDriverConfig
      object. The only locking requirement is to hold the driver lock
      while obtaining an instance of libxlDriverConfig. Once a reference
      is held on the config object, it can be used completely lockless
      since it is immutable.
      d9f19c30
    • J
      libxl: User per-domain ctx in libxlDomainGetInfo · 41475876
      Jim Fehlig 提交于
      libxlDomainGetInfo() uses the driver-wide libxl ctx when
      it would be more appropriate to use the per-domain ctx
      associated with the domain.  Switch to using the per-domain
      libxl ctx.
      41475876
    • J
      libxl: Add libxl_version_info to libxlDriverPrivate · cb0d49af
      Jim Fehlig 提交于
      libxl version info is static data as far as the libxl driver
      is concerned, so retrieve this info when the driver is initialized
      and stash it in the libxlDriverPrivate object.  Subsequently use
      the stashed info instead of repeatedly calling libxl_get_version_info().
      cb0d49af
    • J
      libxl: Earlier detection of not running on Xen · 2f8d0f90
      Jim Fehlig 提交于
      Detect early on in libxl driver initialization if the driver
      should be loaded at all, avoiding needless initialization steps
      that only have to be undone later.  While at it, move the
      detection to a helper function to improve readability.
      
      After detecting that the driver should be loaded, subsequent
      failures such as initializing the log stream, allocating libxl
      ctx, etc. should be treated as failure to initialize the driver.
      2f8d0f90
    • J
      libxl: Introduce libxl_domain.[ch] · 12315cd7
      Jim Fehlig 提交于
      Create libxl_domain.[ch] and move all functions operating on
      libxlDomainObjPrivate to these files.  This will be useful for
      future patches that e.g. add job support for libxlDomainObjPrivate.
      12315cd7
    • J
      libxl: Move detection of autoballoon to libxl_conf · c9d5432d
      Jim Fehlig 提交于
      Detecting whether or not to autoballoon is configuration related,
      so move the code to libxl_conf.
      c9d5432d
  5. 22 8月, 2013 1 次提交
    • J
      libxl: fix libvirtd crash when reconnecting domains · 4d1cf65a
      Jim Fehlig 提交于
      More fallout from commit d72ef888.  When reconnecting to running
      domains, the libxl_ctx in libxlDomainObjPrivate was used before
      initializing it, causing a segfault in libxl and consequently
      crashing libvirtd.
      
      Initialize the libxlDomainObjPrivate libxl_ctx in libxlReconnectDomain,
      and while at it use this ctx in libxlReconnectDomain instead of the
      driver-wide ctx.
      4d1cf65a
  6. 16 8月, 2013 1 次提交
    • J
      libxl: unref DomainObjPrivate on error path · f0c513a6
      Jim Fehlig 提交于
      There is a potential leak of a newly created libxlDomainObjPrivate
      when subsequent allocation of the object's chrdev field fails.
      Unref the object on such an error so that it is properly disposed.
      f0c513a6
  7. 15 8月, 2013 1 次提交
  8. 10 8月, 2013 2 次提交
    • J
      libxl: fix libvirtd segfault · dd00c3f6
      Jim Fehlig 提交于
      Commit d72ef888 introduced a bug in the libxl driver that will
      segfault libvirtd if libxl reports an error message, e.g. when
      attempting to initialize the driver on a non-Xen system.  I
      assumed it was valid to pass a NULL logger to libxl_ctx_alloc(),
      but that is not the case since any errors associated with the ctx
      that are emitted by libxl will dereference the logger and crash
      libvirtd.
      
      Errors associated with the libxl driver-wide ctx could be useful
      for debugging anyway, so create a 'libxl-driver.log' to capture
      these errors.
      dd00c3f6
    • D
      libxl: fix node ranges in libxlNodeGetCellsFreeMemory() · 625980cc
      Dario Faggioli 提交于
      introduced by cs 4b9eec50 ("libxl: implement per
      NUMA node free memory reporting"). What was wrong was that
      libxl_get_numainfo() put in nr_nodes the actual number of
      host NUMA nodes, not the highest node ID (like libnuma's
      numa_max_node() does instead).
      
      While at it, turn the failure of libxl_get_numainfo() from
      a simple warning to a proper error, as requested during the
      review of another patch of the original series.
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Daniel P. Berrange <berrange@redhat.com>
      625980cc
  9. 09 8月, 2013 1 次提交
    • J
      libxl: Create per-domain log file · d72ef888
      Jim Fehlig 提交于
      Currently, only one log file is created by the libxl driver, with
      all output from libxl for all domains going to this one file.
      
      Create a per-domain log file based on domain name, making sifting
      through the logs a bit easier.  This required deferring libxl_ctx
      allocation until starting the domain, which is fine since the
      ctx is not used when the domain is inactive.
      Tested-by: NDario Faggioli <dario.faggioli@citrix.com>
      d72ef888
  10. 31 7月, 2013 1 次提交
  11. 26 7月, 2013 1 次提交
  12. 24 7月, 2013 1 次提交
    • S
      libxl: Correctly initialize vcpu bitmap · 65026d72
      Stefan Bader 提交于
      The avail_vcpu bitmap has to be allocated before it can be used (using
      the maximum allowed value for that). Then for each available VCPU the
      bit in the mask has to be set (libxl_bitmap_set takes a bit position
      as an argument, not the number of bits to set).
      
      Without this, I would always only get one VCPU for guests created
      through libvirt/libxl.
      Signed-off-by: NStefan Bader <stefan.bader@canonical.com>
      65026d72
  13. 18 7月, 2013 2 次提交
    • D
      libxl: implement virDomainGetNumaParameters · 261c4f5f
      Dario Faggioli 提交于
      Although, having it depending on Xen >= 4.3 (by using the proper
      libxl feature flag).
      
      Xen currently implements a NUMA placement policy which is basically
      the same as the 'interleaved' policy of `numactl', although it can
      be applied on a subset of the available nodes. We therefore hardcode
      "interleave" as 'numa_mode', and we use the newly introduced libxl
      interface to figure out what nodes a domain spans ('numa_nodeset').
      
      With this change, it is now possible to query the NUMA node
      affinity of a running domain:
      
      [raistlin@Zhaman ~]$ sudo virsh --connect xen:/// list
       Id    Name                           State
      ----------------------------------------------------
       23    F18_x64                        running
      
      [raistlin@Zhaman ~]$ sudo virsh --connect xen:/// numatune 23
      numa_mode      : interleave
      numa_nodeset   : 1
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      261c4f5f
    • D
      libxl: advertise the support for VIR_TYPED_PARAM_STRING · 98984b71
      Dario Faggioli 提交于
      domainGetNumaParameters has a string typed parameter, hence it
      is necessary for the libxl driver to support this.
      
      This change implements the connectSupportsFeature hook for the
      libxl driver, advertising that VIR_DRV_FEATURE_TYPED_PARAM_STRING
      is supported.
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Eric Blake <eblake@redhat.com>
      98984b71
  14. 11 7月, 2013 1 次提交
  15. 10 7月, 2013 1 次提交
  16. 04 7月, 2013 2 次提交
  17. 03 7月, 2013 1 次提交
  18. 02 7月, 2013 1 次提交
  19. 25 6月, 2013 2 次提交
  20. 24 6月, 2013 1 次提交
  21. 22 6月, 2013 1 次提交
  22. 21 6月, 2013 1 次提交
  23. 20 6月, 2013 1 次提交
  24. 14 6月, 2013 1 次提交
    • F
      Implement dispose method for libxlDomainObjPrivate · d58ce136
      Frediano Ziglio 提交于
      When creating a timer/event handler reference counting is used. So it could
      be possible (in theory) that libxlDomainObjPrivateFree is called with
      reference counting >1. The problem is that libxlDomainObjPrivateFree leave
      the object in an invalid state with ctx freed (but still having dandling
      pointer). This can lead timer/event handler to core.
      
      This patch implements a dispose method for libxlDomainObjPrivate, and moves
      freeing the libxl ctx to the dispose method, ensuring the ctx is valid while
      the object's reference count is > 0.
      Signed-off-by: NFrediano Ziglio <frediano.ziglio@citrix.com>
      d58ce136
  25. 12 6月, 2013 1 次提交
    • J
      libxl: Report connect type as Xen · 47d14c37
      Jim Fehlig 提交于
      Currently, the libxl driver reports a connection type of "xenlight".
      To be compatible with the legacy Xen driver, it should return "Xen".
      
      Note: I noticed this while testing the libxl driver on OpenStack.
      After switching my Xen compute nodes to use the libxl stack, I
      could no longer launch instances on those nodes since
      hypervisor_type was reported as "xenlight" instead of "xen".
      47d14c37