1. 11 5月, 2016 2 次提交
    • J
      libxl: support Xen migration stream V2 in save/restore · 5325123d
      Jim Fehlig 提交于
      Xen 4.6 introduced a new migration stream commonly referred to as
      "migration V2". Xen 4.6 and newer always produce this new stream,
      whereas Xen 4.5 and older always produce the legacy stream.
      Support for migration stream V2 can be detected at build time with
      LIBXL_HAVE_SRM_V2 from libxl.h. The legacy and V2 streams are not
      compatible, but a V2 host can accept and convert a legacy stream.
      
      Commit e7440656 changed the libxl driver to use the lowest libxl
      API version possible (version 0x040200) to ensure the driver
      builds against older Xen releases. The old 4.2 restore API does
      not support specifying a stream version and assumes a legacy
      stream, even if the incoming stream is migration V2. Thinking it
      has been given a legacy stream, libxl will fail to convert an
      incoming stream that is already V2, which causes the entire
      restore operation to fail. Xen's libvirt-related OSSTest has been
      failing since commit e7440656 landed in libvirt.git master. One
      of the more recent failures can be seen here
      
      http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg00071.html
      
      This patch changes the call to libxl_domain_create_restore() to
      include the stream version if LIBXL_HAVE_SRM_V2 is defined. The
      version field of the libxlSavefileHeader struct is also updated
      to '2' when LIBXL_HAVE_SRM_V2 is defined, ensuring the stream
      version in the header matches the actual stream version produced
      by Xen. Along with bumping the libxl API requirement to 0x040400,
      this patch fixes save/restore on a migration V2 Xen host.
      
      Oddly, migration has never used the libxlSavefileHeader. It
      handles passing configuration in the Begin and Prepare phases,
      and then calls libxl directly to transfer domain state/memory
      in the Perform phase. A subsequent patch will add stream
      version handling in the Begin and Prepare phase handshaking,
      which will fix the migration related OSSTest failures.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      5325123d
    • J
      libxl: switch to using libxl_domain_create_restore from v4.4 API · fccf2725
      Jim Fehlig 提交于
      In LIBXL_API_VERSION 0x040400, the libxl_domain_create_restore API
      gained a parameter for specifying restore parameters. Switch to
      using version 0x040400, which will be useful in a subsequent commit
      to specify the Xen migration stream version when restoring.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      fccf2725
  2. 16 4月, 2016 1 次提交
    • J
      libxl: use LIBXL_API_VERSION 0x040200 · e7440656
      Jim Fehlig 提交于
      To ensure the libvirt libxl driver will build with future versions
      of Xen where the libxl API may change in incompatible ways,
      explicitly use LIBXL_API_VERSION 0x040200. The libxl driver
      does use new libxl APIs that have been added since Xen 4.2, but
      currently it does not make use of any changes made to existing
      APIs such as libxl_domain_create_restore or libxl_set_vcpuaffinity.
      The version can be bumped if/when the libxl driver consumes the
      changed APIs.
      
      Further details can be found in the following discussion thread
      
      https://www.redhat.com/archives/libvir-list/2016-April/msg00178.htmlSigned-off-by: NJim Fehlig <jfehlig@suse.com>
      e7440656
  3. 14 4月, 2016 1 次提交
  4. 08 4月, 2016 1 次提交
    • W
      libxl: libxl_domain_create_restore has an extra argument · 216650f1
      Wei Liu 提交于
      In the latest libxenlight code, libxl_domain_create_restore accepts a
      new argument. Update libvirt's libxl driver for that. Use the macro
      provided by libxenlight to detect which version should be used.
      
      The new parameter (send_back_fd) is set to -1 because libvirt provides
      no such fd.
      Signed-off-by: NWei Liu <wei.liu2@citrix.com>
      Message-id: 1459866012-27081-1-git-send-email-wei.liu2@citrix.com
      216650f1
  5. 30 3月, 2016 3 次提交
  6. 09 3月, 2016 1 次提交
    • P
      conf: refactor checking for unsupported memory devices · 185d13b1
      Peter Krempa 提交于
      Introduce a helper to check supported device and domain config and move
      the memory hotplug checks to it.
      
      The advantage of this approach is that by default all new features are
      considered unsupported by all hypervisors unless specifically changed
      rather than the previous approach where every hypervisor would need to
      declare that a given feature is unsupported.
      185d13b1
  7. 25 2月, 2016 1 次提交
    • J
      libxl: implement virDomainInterfaceStats · 77fdd82e
      Joao Martins 提交于
      Introduce support for domainInterfaceStats API call for querying
      network interface statistics. Consequently it also enables the use of
      `virsh domifstat <dom> <interface name>` command plus seeing the
      interfaces names instead of "-" when doing `virsh domiflist <dom>`.
      
      After successful guest creation we fill the network interfaces names
      based on domain, device id and append suffix if it's emulated in the
      following form: vif<domid>.<devid>[-emu].  We extract the network
      interfaces info from the libxl_domain_config object in
      libxlDomainCreateIfaceNames() to generate ifname. On domain cleanup we
      also clear ifname, in case it was set by libvirt (i.e. being prefixed
      with "vif"). We also skip these two steps in case the name of the
      interface was manually inserted by the administrator. Since the
      introduction of netprefix (commit a040ba9e), ifnames with a registered
      prefix will be freed on virDomain{Obj,Def}Format*, thus eliminating
      the migration issues observed with the reverted commit d2e5538b whereas
      source and destination would have the same ifname.
      
      For getting the interface statistics we resort to virNetInterfaceStats
      and let libvirt handle the platform specific nits. Note that the
      latter is not yet supported in FreeBSD.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      77fdd82e
  8. 24 2月, 2016 1 次提交
  9. 08 2月, 2016 2 次提交
  10. 05 2月, 2016 1 次提交
  11. 04 2月, 2016 1 次提交
  12. 27 1月, 2016 1 次提交
    • P
      device: cleanup input device code · 36785c7e
      Pavel Hrdina 提交于
      The current code was a little bit odd.  At first we've removed all
      possible implicit input devices from domain definition to add them later
      back if there was any graphics device defined while parsing XML
      description.  That's not all, while formating domain definition to XML
      description we at first ignore any input devices with bus different to
      USB and VIRTIO and few lines later we add implicit input devices to XML.
      
      This seems to me as a lot of code for nothing.  This patch may look
      to be more complicated than original approach, but this is a preferred
      way to modify/add driver specific stuff only in those drivers and not
      deal with them in common parsing/formating functions.
      
      The update is to add those implicit input devices into config XML to
      follow the real HW configuration visible by guest OS.
      
      There was also inconsistence between our behavior and QEMU's in the way,
      that in QEMU there is no way how to disable those implicit input devices
      for x86 architecture and they are available always, even without graphics
      device.  This applies also to XEN hypervisor.  VZ driver already does its
      part by putting correct implicit devices into live XML.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      36785c7e
  13. 11 1月, 2016 1 次提交
  14. 16 12月, 2015 1 次提交
    • J
      libxl: implement virDomainGetJobInfo · ad716651
      Joao Martins 提交于
      Introduce support for domainGetJobInfo to get info about the
      ongoing job. If the job is active it will update the
      timeElapsed which is computed with the "started" field added to
      struct libxlDomainJobObj.  For now we support just the very basic
      info and all jobs have VIR_DOMAIN_JOB_UNBOUNDED (i.e. no completion
      time estimation) plus timeElapsed computed.
      
      Openstack Kilo uses the Job API to monitor live-migration
      progress which is currently nonexistent in libxl driver and
      therefore leads to a crash in the nova compute node. Right
      now, migration doesn't use jobs in the source node and will
      return VIR_DOMAIN_JOB_NONE. Though nova handles this case and
      will migrate it properly instead of crashing.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      ad716651
  15. 09 12月, 2015 1 次提交
  16. 08 12月, 2015 1 次提交
    • J
      Revert "libxl: implement virDomainInterfaceStats" · e4ac5919
      Jim Fehlig 提交于
      This reverts commit d2e5538b.
      
      A migration regression was introduced by this commit. When migrating
      a domain, its active XML is sent to the destination libvirtd, where
      it is parsed as inactive XML. d2e5538b copied the libxl generated
      interface name into the active config, which was being passed to the
      migration destination and being parsed into inactive config. Attempting
      to start the config could result in failure if an interface with the
      same generated name already exists.
      
      The qemu driver behaves similarly, but the parser contains a hack to
      skip interface names starting with 'vnet' when parsing inactive XML.
      We could extend the hack to skip names starting with 'vif' too, but a
      better fix would be to expose these hypervisor-specific interface name
      prefixes in capabilities. See the following discussion thread for more
      details
      
      https://www.redhat.com/archives/libvir-list/2015-December/msg00262.html
      
      For the pending 1.3.0 release, it is best to revert d2e5538b. It can
      be added again post release, after moving the prefix to capabilities.
      e4ac5919
  17. 03 12月, 2015 1 次提交
    • J
      libxl: implement virDomainInterfaceStats · d2e5538b
      Joao Martins 提交于
      Introduce support for domainInterfaceStats API call for querying
      network interface statistics. Consequently it also enables the
      use of `virsh domifstat <dom> <interface name>` command plus
      seeing the interfaces names instead of "-" when doing
      `virsh domiflist <dom>`.
      
      After successful guest creation we fill the network
      interfaces names based on domain, device id and append suffix
      if it's emulated in the following form: vif<domid>.<devid>[-emu].
      We extract the network interfaces info from the libxl_domain_config
      object in libxlDomainCreateIfaceNames() to generate ifname. On domain
      cleanup we also clear ifname, in case it was set by libvirt (i.e.
      being prefixed with "vif"). We also skip these two steps in case the name
      of the interface was manually inserted by the adminstrator.
      
      For getting the interface statistics we resort to virNetInterfaceStats
      and let libvirt handle the platform specific nits. Note that the latter
      is not yet supported in FreeBSD.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      d2e5538b
  18. 13 8月, 2015 1 次提交
  19. 09 7月, 2015 1 次提交
    • J
      libxl: rework setting the state of virDomainObj · e9c27344
      Jim Fehlig 提交于
      Set the state of virDomainObj in the functions that
      actually change the domain state, instead of the generic
      libxlDomainCleanup function. This approach gives functions
      calling libxlDomainCleanup more flexibility wrt when and
      how they change virDomainObj state via virDomainObjSetState.
      
      The prior approach of calling virDomainObjSetState in
      libxlDomainCleanup resulted in the following incorrect
      coding pattern in the various functions that change
      domain state
      
       libxlDomain<DoStateTransition>
         call libxl function to do state transition
         emit lifecycle event
         libxlDomainCleanup
           virDomainObjSetState
      
      Once simple manifestation of this bug is seeing a domain
      running in virt-manager after selecting the shutdown button,
      even after the domain has long shutdown.
      e9c27344
  20. 20 6月, 2015 1 次提交
    • I
      libxl: avoid freeing an uninitialised bitmap · cc99d240
      Ian Campbell 提交于
      If vm->def->cputune.nvcpupin is 0 in libxlDomainSetVcpuAffinities (as
      seems to be the case on arm) then the VIR_FREE after cleanup: would be
      operating on an uninitialised pointer in map.map.
      
      Fix this by using libxl_bitmap_init and libxl_bitmap_dispose in the
      appropriate places (like VIR_FREE, libxl_bitmap_dispose is also
      idempotent, so there is no double free on exit from the loop).
      
      libxl_bitmap_dispose is slightly preferable since it also sets
      map.size back to 0, avoiding a potential source of confusion.
      
      This fixes the crashes we've been seeing in the Xen automated tests on
      ARM.
      
      I had a glance at the handful of other users of libxl_bitmap and none
      of them looked to have a similar issue.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      cc99d240
  21. 19 6月, 2015 1 次提交
  22. 04 6月, 2015 2 次提交
  23. 03 6月, 2015 2 次提交
  24. 29 5月, 2015 2 次提交
  25. 30 4月, 2015 1 次提交
  26. 21 4月, 2015 2 次提交
  27. 17 4月, 2015 3 次提交
  28. 02 4月, 2015 1 次提交
    • J
      libxl: fix dom0 balloon logic · d685c0f9
      Jim Fehlig 提交于
      Recent testing on large memory systems revealed a bug in the Xen xl
      tool's freemem() function.  When autoballooning is enabled, freemem()
      is used to ensure enough memory is available to start a domain,
      ballooning dom0 if necessary.  When ballooning large amounts of memory
      from dom0, freemem() would exceed its self-imposed wait time and
      return an error.  Meanwhile, dom0 continued to balloon.  Starting the
      domain later, after sufficient memory was ballooned from dom0, would
      succeed.  The libvirt implementation in libxlDomainFreeMem() suffers
      the same bug since it is modeled after freemem().
      
      In the end, the best place to fix the bug on the Xen side was to
      slightly change the behavior of libxl_wait_for_memory_target().
      Instead of failing after caller-provided wait_sec, the function now
      blocks as long as dom0 memory ballooning is progressing.  It will return
      failure only when more memory is needed to reach the target and wait_sec
      have expired with no progress being made.  See xen.git commit fd3aa246.
      There was a dicussion on how this would affect other libxl apps like
      libvirt
      
      http://lists.xen.org/archives/html/xen-devel/2015-03/msg00739.html
      
      If libvirt containing this patch was build against a Xen containing
      the old libxl_wait_for_memory_target() behavior, libxlDomainFreeMem()
      will fail after 30 sec and domain creation will be terminated.
      Without this patch and with old libxl_wait_for_memory_target() behavior,
      libxlDomainFreeMem() does not succeed after 30 sec, but returns success
      anyway.  Domain creation continues resulting in all sorts of fun stuff
      like cpu soft lockups in the guest OS.  It was decided to properly fix
      libxl_wait_for_memory_target(), and if anything improve the default
      behavior of apps using the freemem reference impl in xl.
      
      xl was patched to accommodate the change in libxl_wait_for_memory_target()
      with xen.git commit 883b30a0.  This patch does the same in the libxl
      driver.  While at it, I changed the logic to essentially match
      freemem() in $xensrc/tools/libxl/xl_cmdimpl.c.  It was a bit cleaner
      IMO and will make it easier to spot future, potentially interesting
      divergences.
      d685c0f9
  29. 27 3月, 2015 1 次提交
  30. 25 3月, 2015 1 次提交
    • J
      libxl: remove per-domain libxl_ctx · a5bf06ba
      Jim Fehlig 提交于
      Although needed in the Xen 4.1 libxl days, there is no longer any
      benefit to having per-domain libxl_ctx.  On the contrary, their use
      makes the code unecessarily complicated and prone to deadlocks under
      load.  As suggested by the libxl maintainers, use a single libxl_ctx
      as a handle to libxl instead of per-domain ctx's.
      
      One downside to using a single libxl_ctx is there are no longer
      per-domain log files for log messages emitted by libxl.  Messages
      for all domains will be sent to /var/log/libvirt/libxl/libxl-driver.log.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      a5bf06ba