1. 24 12月, 2013 1 次提交
    • D
      libxl: implement virDomainGetVcpuPinInfo · 2682d0d5
      Dario Faggioli 提交于
      So that it is possible to query vcpu related information of
      a persistent but not running domain, like it is for the QEMU
      driver.
      
      In fact, before this patch, we have:
       # virsh list --all
        Id    Name                           State
       ----------------------------------------------------
        5     debian_32                      running
        -     fedora20_64                    shut off
       # virsh vcpuinfo fedora20_64
       error: this function is not supported by the connection driver: virDomainGetVcpuPinInfo
      
      After (same situation as above, i.e., fedora20_64 not running):
       # virsh vcpuinfo fedora20_64
       VCPU:           0
       CPU:            N/A
       State:          N/A
       CPU time        N/A
       CPU Affinity:   yyyyyyyy
      
       VCPU:           1
       CPU:            N/A
       State:          N/A
       CPU time        N/A
       CPU Affinity:   yyyyyyyy
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      2682d0d5
  2. 21 12月, 2013 1 次提交
    • D
      libxl: avoid crashing if calling `virsh numatune' on inactive domain · f9ee91d3
      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>
      f9ee91d3
  3. 19 12月, 2013 1 次提交
    • D
      libxl: libxl_get_max_cpus returning a libxl error from 4.4 onward · 284d2fc2
      Dario Faggioli 提交于
      Starting from commit 2e82c18c in Xen (will be included in Xen 4.4)
      both libxl_get_max_cpus() and libxl_get_max_nodes() start returning
      a proper libxl error code, in case of failure. This patch fixes
      this in the libxl driver.
      
      Note that, although it is now basically impossible for them to return
      0, that would, theoretically, still be wrong. Also, checking that the
      returned value is '<= 0' makes the code correct for both Xen 4.4 and
      Xen 4.3 (and 4.2), and that is why we go for it (rather than
      just '< 0').
      Signed-off-by: NDario Faggioli <dario.faggioli@citrix.com>
      Cc: Jim Fehlig <jfehlig@suse.com>
      Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
      Cc: Martin Kletzander <mkletzan@redhat.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      284d2fc2
  4. 10 12月, 2013 3 次提交
  5. 21 11月, 2013 1 次提交
    • E
      maint: fix comma style issues: xen · 86f6748b
      Eric Blake 提交于
      Most of our code base uses space after comma but not before;
      fix the remaining uses before adding a syntax check.
      
      * src/libxl/libxl_driver.c: Consistently use commas.
      * src/xen/xend_internal.c: Likewise.
      * src/xen/xs_internal.c: Likewise.
      * src/xenapi/xenapi_driver.c: Likewise.
      * src/xenapi/xenapi_utils.c: Likewise.
      * src/xenxs/xen_sxpr.c: Likewise.
      * src/xenxs/xen_xm.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      86f6748b
  6. 18 11月, 2013 1 次提交
  7. 13 11月, 2013 1 次提交
    • J
      libxl: Fix Xen 4.4 libxlVmStart logic · 7d58c7fc
      Jason Andryuk 提交于
      ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS hides a multi-line body
      for a brace-less else.  Add braces to ensure proper logic is applied.
      
      Without this fix, new domains cannot be started.  Both
      libxl_domain_create_new and libxl_domain_create_restore are called when
      starting a new domain leading to this error:
      libxl: error: libxl.c:324:libxl__domain_rename: domain with name "guest" already exists.
      libxl: error: libxl_create.c:800:initiate_domain_create: cannot make domain: -6
      7d58c7fc
  8. 01 11月, 2013 3 次提交
  9. 24 10月, 2013 1 次提交
    • M
      libxl: Fix possible invalid read · 394d6e0a
      Martin Kletzander 提交于
      According to the following valgrind output, there seems to be a
      invalid limit for the iterator (captured on Fedora 19):
      
      ==3945== Invalid read of size 1
      ==3945==    at 0x1E1FA410: libxlVmStart (libxl_driver.c:475)
      ==3945==    by 0x1E1FAD9A: libxlDomainCreateWithFlags (libxl_driver.c:2633)
      ==3945==    by 0x5187D46: virDomainCreate (libvirt.c:9439)
      ==3945==    by 0x13BAA6: remoteDispatchDomainCreateHelper (remote_dispatch.h:2910)
      ==3945==    by 0x51DE5B9: virNetServerProgramDispatch (virnetserverprogram.c:435)
      ==3945==    by 0x51D93E7: virNetServerHandleJob (virnetserver.c:165)
      ==3945==    by 0x50F5BF4: virThreadPoolWorker (virthreadpool.c:144)
      ==3945==    by 0x50F5670: virThreadHelper (virthreadpthread.c:161)
      ==3945==    by 0x8046C52: start_thread (pthread_create.c:308)
      ==3945==    by 0x8758E1C: clone (clone.S:113)
      ==3945==  Address 0x23424d81 is 0 bytes after a block of size 1 alloc'd
      ==3945==    at 0x4A08121: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==3945==    by 0x50B1F8C: virAllocN (viralloc.c:189)
      ==3945==    by 0x1E1FA3CA: libxlVmStart (libxl_driver.c:468)
      ==3945==    by 0x1E1FAD9A: libxlDomainCreateWithFlags (libxl_driver.c:2633)
      ==3945==    by 0x5187D46: virDomainCreate (libvirt.c:9439)
      ==3945==    by 0x13BAA6: remoteDispatchDomainCreateHelper (remote_dispatch.h:2910)
      ==3945==    by 0x51DE5B9: virNetServerProgramDispatch (virnetserverprogram.c:435)
      ==3945==    by 0x51D93E7: virNetServerHandleJob (virnetserver.c:165)
      ==3945==    by 0x50F5BF4: virThreadPoolWorker (virthreadpool.c:144)
      ==3945==    by 0x50F5670: virThreadHelper (virthreadpthread.c:161)
      ==3945==    by 0x8046C52: start_thread (pthread_create.c:308)
      ==3945==    by 0x8758E1C: clone (clone.S:113)
      ==3945==
      
      Related: https://bugzilla.redhat.com/show_bug.cgi?id=1013045Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      394d6e0a
  10. 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
  11. 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
  12. 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
  13. 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
  14. 15 8月, 2013 1 次提交
  15. 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
  16. 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
  17. 31 7月, 2013 1 次提交
  18. 26 7月, 2013 1 次提交
  19. 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
  20. 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
  21. 11 7月, 2013 1 次提交
  22. 10 7月, 2013 1 次提交
  23. 04 7月, 2013 1 次提交