1. 13 2月, 2013 1 次提交
    • D
      Remove qemuDriverLock from almost everywhere · a9e97e0c
      Daniel P. Berrange 提交于
      With the majority of fields in the virQEMUDriverPtr struct
      now immutable or self-locking, there is no need for practically
      any methods to be using the QEMU driver lock. Only a handful
      of helper APIs in qemu_conf.c now need it
      a9e97e0c
  2. 08 2月, 2013 2 次提交
  3. 06 2月, 2013 1 次提交
    • D
      Merge virDomainObjListIsDuplicate into virDomainObjListAdd · eea87129
      Daniel P. Berrange 提交于
      The duplicate VM checking should be done atomically with
      virDomainObjListAdd, so shoud not be a separate function.
      Instead just use flags to indicate what kind of checks are
      required.
      
      This pair, used in virDomainCreateXML:
      
         if (virDomainObjListIsDuplicate(privconn->domains, def, 1) < 0)
           goto cleanup;
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def, false)))
           goto cleanup;
      
      Changes to
      
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def,
                                         VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                         NULL)))
           goto cleanup;
      
      This pair, used in virDomainRestoreFlags:
      
         if (virDomainObjListIsDuplicate(privconn->domains, def, 1) < 0)
           goto cleanup;
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def, true)))
           goto cleanup;
      
      Changes to
      
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def,
                                         VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
                                         VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                         NULL)))
           goto cleanup;
      
      This pair, used in virDomainDefineXML:
      
         if (virDomainObjListIsDuplicate(privconn->domains, def, 0) < 0)
           goto cleanup;
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def, false)))
           goto cleanup;
      
      Changes to
      
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def,
                                         0, NULL)))
           goto cleanup;
      eea87129
  4. 05 2月, 2013 3 次提交
    • D
      Rename all domain list APIs to have virDomainObjList prefix · 4f6ed6c3
      Daniel P. Berrange 提交于
      The APIs names for accessing the domain list object are
      very inconsistent. Rename them all to have a standard
      virDomainObjList prefix.
      4f6ed6c3
    • D
      Introduce a virQEMUDriverConfigPtr object · b090aa7d
      Daniel P. Berrange 提交于
      Currently the virQEMUDriverPtr struct contains an wide variety
      of data with varying access needs. Move all the static config
      data into a dedicated virQEMUDriverConfigPtr object. The only
      locking requirement is to hold the driver lock, while obtaining
      an instance of virQEMUDriverConfigPtr. Once a reference is held
      on the config object, it can be used completely lockless since
      it is immutable.
      
      NB, not all APIs correctly hold the driver lock while getting
      a reference to the config object in this patch. This is safe
      for now since the config is never updated on the fly. Later
      patches will address this fully.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b090aa7d
    • M
      qemu: Catch stderr of image compression binary · 137229bf
      Michal Privoznik 提交于
      If a compression binary prints something to stderr, currently
      it is discarded. However, it can contain useful data from
      debugging POV, so we should catch it.
      137229bf
  5. 19 1月, 2013 1 次提交
  6. 16 1月, 2013 1 次提交
  7. 14 1月, 2013 1 次提交
  8. 09 1月, 2013 1 次提交
  9. 21 12月, 2012 7 次提交
  10. 12 12月, 2012 1 次提交
    • P
      qemu: Make qemuMigrationIsAllowed more reusable · e5d3ab5e
      Peter Krempa 提交于
      This patch exports qemuMigrationIsAllowed and adds a new parameter to it
      to denote if it's a remote migration or a local migration. Local
      migrations are used in snapshots and saving of the machine state and
      have fewer restrictions. This patch also adjusts callers of the function
      and tweaks some error messages to be more universal.
      e5d3ab5e
  11. 11 12月, 2012 2 次提交
    • J
      qemu: fix uninitialized variable warning in doPeer2PeerMigrate · 07b64de5
      Ján Tomko 提交于
      False positive, but it breaks the build with gcc-4.6.3.
      
      qemu/qemu_migration.c:2931:37: error: 'offline' may be used
      uninitialized in this function [-Werror=uninitialized]
      qemu/qemu_migration.c:2887:10: note: 'offline' was declared here
      07b64de5
    • L
      Add support for offline migration · 8b9bf787
      liguang 提交于
      Offline migration transfers inactive definition of a domain (which may
      or may not be active). After successful completion, the domain remains
      in its current state on source host and is defined but inactive on
      destination host. It's a bit more clever than virDomainGetXMLDesc() on
      source host followed by virDomainDefineXML() on destination host, as
      offline migration will run pre-migration hook to update the domain XML
      on destination host. Currently, copying non-shared storage is not
      supported during offline migration.
      
      Offline migration can be requested with a new migration flag called
      VIR_MIGRATE_OFFLINE (which has to be combined with
      VIR_MIGRATE_PERSIST_DEST flag).
      8b9bf787
  12. 29 11月, 2012 1 次提交
  13. 16 11月, 2012 1 次提交
  14. 12 11月, 2012 1 次提交
    • M
      qemu: Allow migration to be cancelled at prepare phase · ab5e7d49
      Michal Privoznik 提交于
      Currently, if user calls virDomainAbortJob we just issue
      'migrate_cancel' and hope for the best. However, if user calls
      the API in wrong phase when migration hasn't been started yet
      (perform phase) the cancel request is just ignored. With this
      patch, the request is remembered and as soon as perform phase
      starts, migration is cancelled.
      ab5e7d49
  15. 02 11月, 2012 1 次提交
  16. 29 10月, 2012 1 次提交
  17. 27 10月, 2012 1 次提交
    • E
      blockjob: react to active block copy · b3822ed0
      Eric Blake 提交于
      For now, disk migration via block copy job is not implemented in
      libvirt.  But when we do implement it, we have to deal with the
      fact that qemu does not yet provide an easy way to re-start a qemu
      process with mirroring still intact.  Paolo has proposed an idea
      for a persistent dirty bitmap that might make this possible, but
      until that design is complete, it's hard to say what changes
      libvirt would need.  Even something like 'virDomainSave' becomes
      hairy, if you realize the implications that 'virDomainRestore'
      would be stuck with recreating the same mirror layout.
      
      But if we step back and look at the bigger picture, we realize that
      the initial client of live storage migration via disk mirroring is
      oVirt, which always uses transient domains, and that if a transient
      domain is destroyed while a mirror exists, oVirt can easily restart
      the storage migration by creating a new domain that visits just the
      source storage, with no loss in data.
      
      We can make life a lot easier by being cowards for now, forbidding
      certain operations on a domain.  This patch guarantees that we
      never get in a state where we would have to restart a domain with
      a mirroring block copy, by preventing saves, snapshots, migration,
      hot unplug of a disk in use, and conversion to a persistent domain
      (thankfully, it is still relatively easy to 'virsh undefine' a
      running domain to temporarily make it transient, run tests on
      'virsh blockcopy', then 'virsh define' to restore the persistence).
      Later, if the qemu design is enhanced, we can relax our code.
      
      The change to qemudDomainDefine looks a bit odd for undoing an
      assignment, rather than probing up front to avoid the assignment,
      but this is because of how virDomainAssignDef combines both a
      lookup and assignment into a single function call.
      
      * src/conf/domain_conf.h (virDomainHasDiskMirror): New prototype.
      * src/conf/domain_conf.c (virDomainHasDiskMirror): New function.
      * src/libvirt_private.syms (domain_conf.h): Export it.
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal)
      (qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot)
      (qemuDomainBlockJobImpl, qemudDomainDefine): Prevent dangerous
      actions while block copy is already in action.
      * src/qemu/qemu_hotplug.c (qemuDomainDetachDiskDevice): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Likewise.
      b3822ed0
  18. 24 10月, 2012 2 次提交
  19. 19 10月, 2012 2 次提交
    • J
      qemu: Do not require hostuuid in migration cookie · 8d75e47e
      Jiri Denemark 提交于
      Having hostuuid in migration cookie is a nice bonus since it provides an
      easy way of detecting migration to the same host. However, requiring it
      breaks backward compatibility with older libvirt releases.
      8d75e47e
    • J
      qemu: Allow migration with host USB devices · 9fcc5436
      Jiri Denemark 提交于
      Recently, patches were added support for (managed)saving, restoring, and
      migrating domains with host USB devices. However, qemu driver would
      still forbid migration of such domains because qemuMigrationIsAllowed
      was not updated.
      9fcc5436
  20. 17 10月, 2012 1 次提交
    • J
      qemu: Clear async job when p2p migration fails early · 837993d8
      Jiri Denemark 提交于
      When p2p migration fails early because qemuMigrationIsAllowed or
      qemuMigrationIsSafe say migration should be cancelled, we fail to clear
      the migration-out async job. As a result of that, further APIs called
      for the same domain may fail with Timed out during operation: cannot
      acquire state change lock.
      
      Reported by Guido Winkelmann.
      837993d8
  21. 11 10月, 2012 2 次提交
    • J
      qemu: Make save/restore with USB devices usable · bd1282d6
      Jiri Denemark 提交于
      Save/restore with passed through USB devices currently only works if the
      USB device can be found at the same USB address where it used to be
      before saving a domain. This makes sense in case a user explicitly
      configure the USB address in domain XML. However, if the device was
      found automatically by vendor/product identification, we should try to
      search for that device when restoring the domain and use any device we
      find as long as there is only one available. In other words, the USB
      device can now be removed and plugged again or the host can be rebooted
      between saving and restoring the domain.
      bd1282d6
    • J
      Add MIGRATABLE flag for virDomainGetXMLDesc · 28f8dfdc
      Jiri Denemark 提交于
      Using VIR_DOMAIN_XML_MIGRATABLE flag, one can request domain's XML
      configuration that is suitable for migration or save/restore. Such XML
      may contain extra run-time stuff internal to libvirt and some default
      configuration may be removed for better compatibility of the XML with
      older libvirt releases.
      
      This flag may serve as an easy way to get the XML that can be passed
      (after desired modifications) to APIs that accept custom XMLs, such as
      virDomainMigrate{,ToURI}2 or virDomainSaveFlags.
      28f8dfdc
  22. 26 9月, 2012 1 次提交
    • M
      qemu: wait for SPICE to migrate · 3521cd1c
      Michal Privoznik 提交于
      Recently, there have been some improvements made to qemu so it
      supports seamless migration or something very close to it.
      However, it requires libvirt interaction. Once qemu is migrated,
      the SPICE server needs to send its internal state to the destination.
      Once it's done, it fires SPICE_MIGRATE_COMPLETED event and this
      fact is advertised in 'query-spice' output as well.
      We must not kill qemu until SPICE server finishes the transfer.
      3521cd1c
  23. 21 9月, 2012 1 次提交
  24. 13 9月, 2012 1 次提交
    • D
      Turn QEMU capabilities object into a full virObjectPtr · beac09fd
      Daniel P. Berrange 提交于
      The current qemu capabilities are stored in a virBitmapPtr
      object, whose type is exposed to callers. We want to store
      more data besides just the flags, so we need to move to a
      struct type. This object will also need to be reference
      counted, since we'll be maintaining a cache of data per
      binary. This change introduces a 'qemuCapsPtr' virObject
      class. Most of the change is just renaming types and
      variables in all the callers
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      beac09fd
  25. 24 8月, 2012 1 次提交
    • E
      snapshot: make virDomainSnapshotObjList opaque · 3211deba
      Eric Blake 提交于
      We were failing to react to allocation failure when initializing
      a snapshot object list.  Changing things to store a pointer
      instead of a complete object adds one more possible point of
      allocation failure, but at the same time, will make it easier to
      react to failure now, as well as making it easier for a future
      patch to split all virDomainSnapshotPtr handling into a separate
      file, as I continue to add even more snapshot code.
      
      Luckily, there was only one client outside of domain_conf.c that
      was actually peeking inside the object, and a new wrapper function
      was easy.
      
      * src/conf/domain_conf.h (_virDomainObj): Use a pointer.
      (virDomainSnapshotObjListInit): Rename.
      (virDomainSnapshotObjListFree, virDomainSnapshotForEach): New
      declarations.
      (_virDomainSnapshotObjList): Move definitions...
      * src/conf/domain_conf.c: ...here.
      (virDomainSnapshotObjListInit, virDomainSnapshotObjListDeinit):
      Rename...
      (virDomainSnapshotObjListNew, virDomainSnapshotObjListFree): ...to
      these.
      (virDomainSnapshotForEach): New function.
      (virDomainObjDispose, virDomainListPopulate): Adjust callers.
      * src/qemu/qemu_domain.c (qemuDomainSnapshotDiscard)
      (qemuDomainSnapshotDiscardAllMetadata): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotLoad)
      (qemuDomainUndefineFlags, qemuDomainSnapshotCreateXML)
      (qemuDomainSnapshotListNames, qemuDomainSnapshotNum)
      (qemuDomainListAllSnapshots)
      (qemuDomainSnapshotListChildrenNames)
      (qemuDomainSnapshotNumChildren)
      (qemuDomainSnapshotListAllChildren)
      (qemuDomainSnapshotLookupByName, qemuDomainSnapshotGetParent)
      (qemuDomainSnapshotGetXMLDesc, qemuDomainSnapshotIsCurrent)
      (qemuDomainSnapshotHasMetadata, qemuDomainRevertToSnapshot)
      (qemuDomainSnapshotDelete): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Export new function.
      3211deba
  26. 09 8月, 2012 2 次提交
    • J
      qemu: Fix debug message in p2p migration · e18396f3
      Jiri Denemark 提交于
      When entering "confirm" phase, we are interested in the value of
      cancelled rather then ret variable which was interesting before "finish"
      phase and didn't change since then.
      e18396f3
    • J
      qemu: Migrate at unlimited speed by default · 6cfdeaac
      Jiri Denemark 提交于
      Previously, qemu did not respond to monitor commands during migration if
      the limit was too high. This prevented us from raising the limit
      earlier. The qemu issue seems to be fixed (according to my testing) and
      we may remove the 32Mb/s limit.
      6cfdeaac