1. 10 2月, 2016 2 次提交
    • J
      libxl: keepalive messages support · 5194eb95
      Joao Martins 提交于
      This patch introduces keep alive messages support for P2P migration
      and it adds two new configuration entries namely 'keepalive_interval'
      'keepalive_count' to control it. Behavior of these entries is the
      same as qemu driver thus the description is copied from there
      with just a few simplifications.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      5194eb95
    • J
      libxl: add p2p migration · a79da245
      Joao Martins 提交于
      Introduce support for VIR_MIGRATE_PEER2PEER in libvirt migration.
      Most of the changes occur at the source and no modifications at
      the receiver.
      
      In P2P mode there is only the Perform phase so we must handle the
      connection with the destination and actually perform the
      migration. libxlDomainPerformP2P implements the connection to the
      destination and libxlDoMigrateP2P implements the actual migration
      logic with virConnectPtr. In this function we take care of doing
      all phases of migration in the destination similar to
      virDomainMigrateVersion3Full. We appropriately save the last
      error reported in each of the phases to provide proper reporting.
      We don't yet support VIR_MIGRATE_TUNNELED and we always use V3
      with extensible params, thus it also makes the implementation
      simpler.
      
      It is worth noting that the receiver didn't have any changes, and
      since it's still the v3 sequence thus it is possible to migrate
      from a P2P to non-P2P host.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      a79da245
  2. 05 2月, 2016 1 次提交
  3. 04 2月, 2016 1 次提交
  4. 04 9月, 2015 1 次提交
  5. 28 8月, 2015 3 次提交
    • J
      libxl: acquire a job when receiving a migrating domain · e80b84a7
      Jim Fehlig 提交于
      Commit f86ae403 moved acquiring a job from libxlDomainStart()
      to its callers. One spot missed was in libxlDoMigrateReceive().
      Acquire a job in libxlDoMigrateReceive() before calling
      libxlDomainStart().
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      e80b84a7
    • J
      libxl: don't attempt to resume domain when suspend fails · 15120b8c
      Jim Fehlig 提交于
      Failure of libxl_domain_suspend() does not leave the domain in
      a suspended state, so no need to call libxl_domain_resume(),
      which btw will fail with "domain not suspended".
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      15120b8c
    • J
      libxl: fix ref counting of libxlMigrationDstArgs · 44a54eb0
      Jim Fehlig 提交于
      This patch fixes some flawed logic around ref counting the
      libxlMigrationDstArgs object.
      
      First, when adding sockets to the event loop with
      virNetSocketAddIOCallback(), the generic virObjectFreeCallback()
      was registered as a free function, with libxlMigrationDstArgs as
      its parameter. A reference was also taken on
      libxlMigrationDstArgs for each successful call to
      virNetSocketAddIOCallback(). The rational behind this logic was
      that the libxlMigrationDstArgs object had to out-live the socket
      objects. But virNetSocketAddIOCallback() already takes a
      reference on socket objects, ensuring their life until removed
      from the event loop and unref'ed in virNetSocketEventFree(). We
      only need to ensure libxlMigrationDstArgs lives until
      libxlDoMigrateReceive() finishes, which can be done by simply
      unref'ing libxlMigrationDstArgs at the end of
      libxlDoMigrateReceive().
      
      The second flaw was unref'ing the sockets in the failure path of
      libxlMigrateReceive() and at the end of libxlDoMigrateReceive().
      As mentioned above, the sockets are already unref'ed by
      virNetSocketEventFree() when removed from the event loop.
      Attempting to unref the socket a second time resulted in a
      libvirtd crash since the socket was previously unref'ed and
      disposed.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      44a54eb0
  6. 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
  7. 11 6月, 2015 1 次提交
  8. 06 5月, 2015 1 次提交
    • J
      libxl: Resolve Coverity RESOURCE_LEAK · 11b91679
      John Ferlan 提交于
      The returned socks from virNetSocketNewListenTCP needs to be VIR_FREE'd
      as well as seach of the Close/Unref on all the socks[i] that is
      already done
      11b91679
  9. 30 4月, 2015 1 次提交
  10. 21 4月, 2015 1 次提交
    • C
      domain: conf: Drop expectedVirtTypes · 835cf84b
      Cole Robinson 提交于
      This needs to specified in way too many places for a simple validation
      check. The ostype/arch/virttype validation checks later in
      DomainDefParseXML should catch most of the cases that this was covering.
      835cf84b
  11. 17 4月, 2015 1 次提交
    • J
      libxl: drop virDomainObj lock when destroying a domain · 6dfec1ef
      Jim Fehlig 提交于
      A destroy operation can take considerable time on large memory
      domains due to scrubbing the domain's memory.  Unlock the
      virDomainObj while libxl_domain_destroy is executing.
      
      Implement libxlDomainDestroyInternal wrapper to handle unlocking,
      calling destroy, and locking.  Change all callers of
      libxl_domain_destroy to use the wrapper.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      6dfec1ef
  12. 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
  13. 14 1月, 2015 1 次提交
    • D
      Give virDomainDef parser & formatter their own flags · 0ecd6851
      Daniel P. Berrange 提交于
      The virDomainDefParse* and virDomainDefFormat* methods both
      accept the VIR_DOMAIN_XML_* flags defined in the public API,
      along with a set of other VIR_DOMAIN_XML_INTERNAL_* flags
      defined in domain_conf.c.
      
      This is seriously confusing & error prone for a number of
      reasons:
      
       - VIR_DOMAIN_XML_SECURE, VIR_DOMAIN_XML_MIGRATABLE and
         VIR_DOMAIN_XML_UPDATE_CPU are only relevant for the
         formatting operation
       - Some of the VIR_DOMAIN_XML_INTERNAL_* flags only apply
         to parse or to format, but not both.
      
      This patch cleanly separates out the flags. There are two
      distint VIR_DOMAIN_DEF_PARSE_* and VIR_DOMAIN_DEF_FORMAT_*
      flags that are used by the corresponding methods. The
      VIR_DOMAIN_XML_* flags received via public API calls must
      be converted to the VIR_DOMAIN_DEF_FORMAT_* flags where
      needed.
      
      The various calls to virDomainDefParse which hardcoded the
      use of the VIR_DOMAIN_XML_INACTIVE flag change to use the
      VIR_DOMAIN_DEF_PARSE_INACTIVE flag.
      0ecd6851
  14. 02 12月, 2014 1 次提交
    • J
      libxl: Resolve Coverity CHECKED_RETURN · 5f1d3c6c
      John Ferlan 提交于
      Commit id 'cb88d433' refactored the calling sequence to use a thread;
      however, in doing so "lost" the check for if virNetSocketAccept returns
      failure.  Since other code makes that check, Coverity complains. Although
      a false positive, adding back the failure check pacifies Coverity
      5f1d3c6c
  15. 22 11月, 2014 4 次提交
    • J
      libxl: destroy domain in migration finish phase on failure · 42874fa4
      Jim Fehlig 提交于
      This patch contains three domain cleanup improvements in the migration
      finish phase, ensuring a domain is properly disposed when a failure is
      detected or the migration is cancelled.
      
      The check for virDomainObjIsActive is moved to libxlDomainMigrationFinish,
      where cleanup can occur if migration failed and the domain is inactive.
      
      The 'cleanup' label was missplaced in libxlDomainMigrationFinish, causing
      a migrated domain to remain in the event of an error or cancelled migration.
      
      In cleanup, the domain was not removed from the driver's list of domains.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      42874fa4
    • J
      libxl: start domain paused on migration dst · 60386825
      Jim Fehlig 提交于
      During the perform phase of migration, the domain is started on
      the dst host in a running state if VIR_MIGRATE_PAUSED flag is not
      specified.  In the finish phase, the domain is also unpaused if
      VIR_MIGRATE_PAUSED flag is unset.  I've noticed this second unpause
      fails if the domain was already unpaused following the perform phase.
      
      This patch changes the perform phase to always start the domain
      paused, and defers unpausing, if requested, to the finish phase.
      Unpausing should occur in the finish phase anyhow, where the domain
      can be properly destroyed if the perform phase fails and migration
      is cancelled.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      60386825
    • J
      libxl: acquire job in migration finish phase · a1f38951
      Jim Fehlig 提交于
      Moving data reception of the perform phase of migration to a
      thread introduces a race with the finish phase, where checking
      if the domain is active races with the thread finishing the
      perform phase.  The race is easily solved by acquiring a job in
      the finish phase, which must wait for the perform phase job to
      complete.
      
      While wrapping the finish phase in a job, noticed the virDomainObj
      was being unlocked in a callee - libxlDomainMigrationFinish.  Move
      the unlocking to libxlDomainMigrateFinish3Params, where the lock
      is acquired.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      a1f38951
    • J
      libxl: Receive migration data in a thread · cb88d433
      Jim Fehlig 提交于
      The libxl driver receives migration data within an IO callback invoked
      by the event loop, effectively disabling the event loop while migration
      occurs.
      
      This patch moves receving of the migration data to a thread.  The
      incoming connection is still accepted in the IO callback, but control
      is immediately returned to the event loop after spawning the thread.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      cb88d433
  16. 11 9月, 2014 1 次提交
  17. 29 8月, 2014 1 次提交
    • J
      libxl_migration: Resolve Coverity NULL_RETURNS · 0322643e
      John Ferlan 提交于
      Coverity noted that all callers to libxlDomainEventQueue() could ensure
      the second parameter (event) was true before calling except this case.
      As I look at the code and how events are used - it seems that prior to
      generating an event for the dom == NULL condition, the resume/suspend
      event should be queue'd after the virDomainSaveStatus() call which will
      goto cleanup and queue the saved event anyway.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      0322643e
  18. 28 8月, 2014 1 次提交
    • J
      libxl_migration: Resolve Coverity RESOURCE_LEAK · ad4966d9
      John Ferlan 提交于
      In libxlDomainMigrationPrepare() if the uri_in is false, then
      'hostname' is allocated and used "generically" in the routine,
      but not freed.  Conversely, if uri_in is true, then a uri is
      allocated and hostname is set to the uri->hostname value and
      likewise generically used.
      
      At function exit, hostname wasn't free'd in the !uri_in path,
      so that was added.  To just make it clearer on usage the else
      path became the call to virURIFree() although I suppose technically
      it didn't have to since it would be a call using (NULL)
      ad4966d9
  19. 09 7月, 2014 4 次提交
    • J
      libxl: fix crash in migrate confirm for transient domains · 72a84539
      Jim Fehlig 提交于
      In libxlDomainMigrationConfirm(), a transient domain is removed
      from the domain list after successful migration.  Later in cleanup,
      the domain object is unlocked, resulting in a crash
      
      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 0x7fb4208ed700 (LWP 12044)]
      0x00007fb4267251e6 in virClassIsDerivedFrom (klass=0xdeadbeef,
        parent=0x7fb42830d0c0) at util/virobject.c:169
      169	        if (klass->magic == parent->magic)
      (gdb) bt
      0  0x00007fb4267251e6 in virClassIsDerivedFrom (klass=0xdeadbeef,
        parent=0x7fb42830d0c0) at util/virobject.c:169
      1  0x00007fb42672591b in virObjectIsClass (anyobj=0x7fb4100082b0,
        klass=0x7fb42830d0c0) at util/virobject.c:365
      2  0x00007fb42672583c in virObjectUnlock (anyobj=0x7fb4100082b0)
        at util/virobject.c:338
      3  0x00007fb41a8c7d7a in libxlDomainMigrationConfirm (driver=0x7fb4100404c0,
        vm=0x7fb4100082b0, flags=1, cancelled=0) at libxl/libxl_migration.c:583
      
      Fix by setting the virDomainObjPtr to NULL after removing it from
      the domain list.
      72a84539
    • J
      libxl: acquire job though begin phase only · bab7ad4c
      Jim Fehlig 提交于
      During migration, the libxl driver starts a modify job in the
      begin phase, ending the job in the confirm phase.  This is
      essentially VIR_MIGRATE_CHANGE_PROTECTION semantics, but the
      driver does not support that flag.  Without CHANGE_PROTECTION
      support, the job would never be terminated in error conditions
      where migrate confirm phase is not executed.  Further attempts
      to modify the domain would result in failure to acquire a job
      after LIBXL_JOB_WAIT_TIME.
      
      Similar to the qemu driver, end the job in the begin phase.
      Protecting the domain object across all phases of migration can
      be done in a future patch adding CHANGE_PROTECTION support.
      bab7ad4c
    • J
      libxl: remove domain when migration prepare fails · c4f66bb8
      Jim Fehlig 提交于
      In libxlDomainMigrationPrepare(), a new virDomainObj is created
      from the incoming domain def and added to the driver's domain
      list, but never removed if there are subsequent failures during
      the prepare phase.
      
      targethost# virsh list --all
      
      sourcehost# virsh migrate --live dom xen+ssh://targethost/system
         error: operation failed: Fail to create socket for incoming migration.
      
      targethost# virsh list --all
      error: Failed to list domains
      error: name in virGetDomain must not be NULL
      
      After adding code to remove the domain on prepare failure, noticed
      that libvirtd crashed due to double free of the virDomainDef.  Similar
      to the qemu driver, pass a pointer to virDomainDefPtr so it can be set
      to NULL once a virDomainObj is created from it.
      c4f66bb8
    • J
      libxl: rename goto label · 92cd6b67
      Jim Fehlig 提交于
      In libxlDomainMigrationPrepare(), the cleanup label handles error
      conditions and should be renamed as such for clarity.
      92cd6b67
  20. 21 6月, 2014 1 次提交
  21. 12 6月, 2014 1 次提交
  22. 05 6月, 2014 1 次提交