1. 11 12月, 2012 3 次提交
    • P
      qemu: snapshot: Don't leak XML definition if restarting of CPUs fails · d5b28287
      Peter Krempa 提交于
      In case the snapshot code isn't able to restart CPUs after an external
      checkpoint we would leak a copy of the domains XML definition. This
      patch fixes the cleanup path.
      d5b28287
    • P
      qemu: Restart CPUs with valid async job type when doing external snapshots · 46b0c933
      Peter Krempa 提交于
      When restarting CPUs after an external snapshot, the restarting function
      was called without the appropriate async job type. This caused that a
      new sync job wasn't created and allowed races in the monitor.
      46b0c933
    • 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
  2. 05 12月, 2012 3 次提交
    • J
      qemu: Fix error code when attaching existing device · 935550c6
      Jiri Denemark 提交于
      An attempt to attach device that is already attached to a domain results
      in the following error:
      
      virsh # attach-device rhel6 pci2 --persistent
      error: Failed to attach device from pci2
      error: invalid argument: device is already in the domain configuration
      
      The "invalid argument" error code looks wrong, we usually use "operation
      invalid" when the action cannot be done in current state.
      935550c6
    • O
      qemu: Simplify the code · 9ee809d6
      Osier Yang 提交于
      "disk" is initialized to "dev->data.disk" in the beginning of the
      function.
      9ee809d6
    • E
      qemu: nicer error message if live disk snapshot unsupported · 3bef4adf
      Eric Blake 提交于
      Without this patch, attempts to create a disk snapshot when qemu
      is too old results in a cryptic message:
      
      virsh # snapshot-create 23 --disk-only
      error: operation failed: Failed to take snapshot: unknown command: 'snapshot_blkdev'
      
      Now it reports:
      
      virsh # snapshot-create 23 --disk-only
      error: unsupported configuration: live disk snapshot not supported with this QEMU binary
      
      All versions of qemu that support live disk snapshot also support
      QMP (basically upstream qemu 1.1 and later, and backports to RHEL 6.2).
      
      * src/qemu/qemu_capabilities.h (QEMU_CAPS_DISK_SNAPSHOT): New
      capability.
      * src/qemu/qemu_capabilities.c (qemuCaps): Track it.
      (qemuCapsProbeQMPCommands): Set it.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive): Use
      it.
      * src/qemu/qemu_monitor.c (qemuMonitorDiskSnapshot): Simplify.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDiskSnapshot):
      Likewise.
      * src/qemu/qemu_monitor_text.h (qemuMonitorTextDiskSnapshot):
      Delete.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextDiskSnapshot):
      Likewise.
      3bef4adf
  3. 04 12月, 2012 2 次提交
  4. 01 12月, 2012 1 次提交
  5. 30 11月, 2012 2 次提交
  6. 29 11月, 2012 4 次提交
  7. 28 11月, 2012 4 次提交
    • M
      qemu: Implement virDomainFSTrim · 6092fea9
      Michal Privoznik 提交于
      using qemu guest agent. As said in previous patch,
      @mountPoint must be NULL and @flags zero because
      qemu guest agent doesn't support these arguments
      yet. If qemu learns them, we can start supporting
      them as well.
      6092fea9
    • V
      qemu: Fix QMP Capabability Probing Failure · 1a50ba2c
      Viktor Mihajlovski 提交于
      QMP Capability probing will fail if QEMU cannot bind to the
      QMP monitor socket in the qemu_driver->libDir directory.
      That's because the child process is stripped of all
      capabilities and this directory is chown'ed to the configured
      QEMU user/group (normally qemu:qemu) by the QEMU driver.
      
      To prevent this from happening, the driver startup will now pass
      the QEMU uid and gid down to the capability probing code.
      All capability probing invocations of QEMU will be run with
      the configured QEMU uid instead of libvirtd's.
      
      Furter, the pid file handling is moved to libvirt, as QEMU
      cannot write to the qemu_driver->runDir (root:root). This also
      means that the libvirt daemonizing must be used.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      1a50ba2c
    • J
      qemu: fix a crash when save file can't be opened · 8927c0ea
      Ján Tomko 提交于
      In qemuDomainSaveMemory, wrapperFd might be NULL and should be checked before
      calling virFileWrapperFdCatchError. Same in doCoreDump.
      
      Bug: https://bugzilla.redhat.com/show_bug.cgi?id=880919
      8927c0ea
    • D
      s/qemud/qemu/ in QEMU driver sources · 74922763
      Daniel P. Berrange 提交于
      Change some legacy function names to use 'qemu' as their
      prefix instead of 'qemud' which was a hang over from when
      the QEMU driver ran inside a separate daemon
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      74922763
  8. 20 11月, 2012 1 次提交
    • E
      snapshot: make cloning of domain definition easier · 0b5617a6
      Eric Blake 提交于
      Upcoming patches for revert-and-clone branching of snapshots need
      to be able to copy a domain definition; make this step reusable.
      
      * src/conf/domain_conf.h (virDomainDefCopy): New prototype.
      * src/conf/domain_conf.c (virDomainObjCopyPersistentDef): Split...
      (virDomainDefCopy): ...into new function.
      (virDomainObjSetDefTransient): Use it.
      * src/libvirt_private.syms (domain_conf.h): Export it.
      * src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Use it.
      0b5617a6
  9. 15 11月, 2012 1 次提交
  10. 14 11月, 2012 1 次提交
    • P
      snapshot: qemu: Fix detection of external snapshots when deleting · 30f1bccf
      Peter Krempa 提交于
      This patch adds a helper to determine if snapshots are external and uses
      the helper to fix detection of those in snapshot deletion code.
      
      Snapshots are external if they have an external memory image or if the
      disk locations are external. As mixed snapshots are forbidden for now
      we need to check just one disk to know.
      30f1bccf
  11. 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
  12. 09 11月, 2012 1 次提交
    • P
      qemu: Fix domain ID numbering race condition · 02cf57c0
      Peter Krempa 提交于
      When the libvirt daemon is restarted it tries to reconnect to running
      qemu domains. Since commit d38897a5 the
      re-connection code runs in separate threads. In the original
      implementation the maximum of domain ID's (that is used as an
      initializer for numbering guests created next) while libvirt was
      reconnecting to the guest.
      
      With the threaded implementation this opens a possibility for race
      conditions with the thread that is autostarting guests. When there's a
      guest running with id 1 and the daemon is restarted. The autostart code
      is reached first and spawns the first guest that should be autostarted
      as id 1. This results into the following unwanted situation:
      
       # virsh list
         Id    Name                           State
        ----------------------------------------------------
         1     guest1                         running
         1     guest2                         running
      
      This patch extracts the detection code before the re-connection threads
      are started so that the maximum id of the guests being reconnected to is
      known.
      
      The only semantic change created by this is if the guest with greatest ID
      quits before we are able to reconnect it's ID is used anyway as the
      greatest one as without this patch the greatest ID of a process we could
      successfuly reconnect to would be used.
      02cf57c0
  13. 08 11月, 2012 2 次提交
    • P
      qemu: Fix function header formating of 2 functions · e124f498
      Peter Krempa 提交于
      Headers of qemuDomainSnapshotLoad and qemuDomainNetsRestart were
      improperly formatted.
      e124f498
    • P
      snapshot: qemu: Add support for external inactive snapshots · 9b5a514b
      Peter Krempa 提交于
      This patch adds support for external disk snapshots of inactive domains.
      The snapshot is created by calling using qemu-img by calling:
      
       qemu-img create -f format_of_snapshot -o
       backing_file=/path/to/src,backing_fmt=format_of_backing_image
       /path/to/snapshot
      
      in case the backing image format is known or probing is allowed and
      otherwise:
      
       qemu-img create -f format_of_snapshot -o  backing_file=/path/to/src
       /path/to/snapshot
      
      on each of the disks selected for snapshotting. This patch also modifies
      the snapshot preparing function to support creating external snapshots
      and to sanitize arguments. For now the user isn't able to mix external
      and internal snapshots but this restriction might be lifted in the
      future.
      9b5a514b
  14. 07 11月, 2012 1 次提交
    • M
      qemu: Emit event if 'cont' fails · a08fc66d
      Michal Privoznik 提交于
      Some operations, APIs needs domain to be paused prior operation can be
      performed, e.g. (managed-) save of a domain. The processors should be
      restored in the end. However, if 'cont' fails for some reason, we log a
      message but this is not sufficient as an event should be emitted as
      well. Mgmt application can then decide what to do.
      a08fc66d
  15. 06 11月, 2012 1 次提交
    • P
      qemu: Don't corrupt pointer in qemuDomainSaveMemory() · fb58f8e2
      Peter Krempa 提交于
      The code that was split out into the qemuDomainSaveMemory expands the
      pointer containing the XML description of the domain that it gets from
      higher layers. If the pointer changes the old one is invalid and the
      upper layer function tries to free it causing an abort.
      
      This patch changes the expansion of the original string to a new
      allocation and copy of the contents.
      fb58f8e2
  16. 05 11月, 2012 1 次提交
  17. 04 11月, 2012 1 次提交
    • P
      snapshot: qemu: Add support for external checkpoints · f569b87f
      Peter Krempa 提交于
      This patch adds support to take external system checkpoints.
      
      The functionality is layered on top of the previous disk-only snapshot
      code. When the checkpoint is requested the domain memory is saved to the
      memory image file using migration to file. (The user may specify to
      take the memory image while the guest is live with the
      VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag.)
      
      The memory save image shares format with the image created by
      virDomainSave() API.
      f569b87f
  18. 03 11月, 2012 6 次提交
    • P
      snapshot: qemu: Rename qemuDomainSnapshotCreateActive · b5fd4044
      Peter Krempa 提交于
      Before now, libvirt supported only internal snapshots for active guests.
      This patch renames this function to qemuDomainSnapshotCreateActiveInternal
      to prepare the grounds for external active snapshots.
      b5fd4044
    • P
      qemu: Split out domain memory saving code to allow reuse · 2771f8b7
      Peter Krempa 提交于
      The code that saves domain memory by migration to file can be reused
      while doing external checkpoints of a machine. This patch extracts the
      common code and places it in a separate function.
      2771f8b7
    • P
      qemu: Clean up snapshot retrieval to use the new helper · ec69ca14
      Peter Krempa 提交于
      Two other places were left with the old code to look up snapshots.
      Change them to use the snapshot lookup helper.
      ec69ca14
    • P
      qemu: Fix possible race when pausing guest · d0fc6dc8
      Peter Krempa 提交于
      When pausing the guest while migration is running (to speed up
      convergence) the virDomainSuspend API checks if the migration job is
      active before entering the job. This could cause a possible race if the
      virDomainSuspend is called while the job is active but ends before the
      Suspend API enters the job (this would require that the migration is
      aborted). This would cause a incorrect event to be emitted.
      d0fc6dc8
    • E
      snapshot: merge pre-snapshot checks · de76cae9
      Eric Blake 提交于
      Both system checkpoint snapshots and disk snapshots were iterating
      over all disks, doing a final sanity check before doing any work.
      But since future patches will allow offline snapshots to be either
      external or internal, it makes sense to share the pass over all
      disks, and then relax restrictions in that pass as new modes are
      implemented.  Future patches can then handle external disks when
      the domain is offline, then handle offline --disk-snapshot, and
      finally, combine with migration to file to gain a complete external
      system checkpoint snapshot of an active domain without using 'savevm'.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDiskPrepare)
      (qemuDomainSnapshotIsAllowed): Merge...
      (qemuDomainSnapshotPrepare): ...into one function.
      (qemuDomainSnapshotCreateXML): Update caller.
      de76cae9
    • E
      snapshot: populate new XML info for qemu snapshots · e260e401
      Eric Blake 提交于
      Now that the XML supports listing internal snapshots, it is worth
      always populating the <memory> and <disks> element to match.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Always
      parse disk info and set memory info.
      e260e401
  19. 02 11月, 2012 2 次提交
  20. 01 11月, 2012 1 次提交
    • E
      build: prefer mkostemp for multi-thread safety · 4dbd6e96
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=871756
      
      Commit cd1e8d1c assumed that systems new enough to have journald
      also have mkostemp; but this is not true for uclibc.
      
      For that matter, use of mkstemp[s] is unsafe in a multi-threaded
      program.  We should prefer mkostemp[s] in the first place.
      
      * bootstrap.conf (gnulib_modules): Add mkostemp, mkostemps; drop
      mkstemp and mkstemps.
      * cfg.mk (sc_prohibit_mkstemp): New syntax check.
      * tools/virsh.c (vshEditWriteToTempFile): Adjust caller.
      * src/qemu/qemu_driver.c (qemuDomainScreenshot)
      (qemudDomainMemoryPeek): Likewise.
      * src/secret/secret_driver.c (replaceFile): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainScreenshot): Likewise.
      4dbd6e96
  21. 31 10月, 2012 1 次提交