1. 14 11月, 2012 2 次提交
  2. 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
  3. 10 11月, 2012 1 次提交
    • V
      capabilities: defaultConsoleTargetType can depend on architecture · b1c88c14
      Viktor Mihajlovski 提交于
      For S390, the default console target type cannot be of type 'serial'.
      It is necessary to at least interpret the 'arch' attribute
      value of the os/type element to produce the correct default type.
      
      Therefore we need to extend the signature of defaultConsoleTargetType
      to account for architecture. As a consequence all the drivers
      supporting this capability function must be updated.
      
      Despite the amount of changed files, the only change in behavior is
      that for S390 the default console target type will be 'virtio'.
      
      N.B.: A more future-proof approach could be to to use hypervisor
      specific capabilities to determine the best possible console type.
      For instance one could add an opaque private data pointer to the
      virCaps structure (in case of QEMU to hold capsCache) which could
      then be passed to the defaultConsoleTargetType callback to determine
      the console target type.
      Seems to be however a bit overengineered for the use case...
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      b1c88c14
  4. 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
  5. 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
  6. 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
  7. 06 11月, 2012 3 次提交
    • 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
    • M
      qemu: Add controllers in specified order · 0f720ab3
      Michal Privoznik 提交于
      qemu is sensitive to the order of arguments passed. Hence, if a
      device requires a controller, the controller cmd string must
      precede device cmd string. The same apply for controllers, when
      for instance ccid controller requires usb controller. So
      controllers create partial ordering in which they should be added
      to qemu cmd line.
      0f720ab3
    • M
      qemu: Wrap controllers code into dummy loop · 77b93dbc
      Michal Privoznik 提交于
      which just re-indent code and prepare it for next patch.
      77b93dbc
  8. 05 11月, 2012 1 次提交
  9. 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
  10. 03 11月, 2012 7 次提交
    • 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
      snapshot: qemu: Add async job type for snapshots · 2a59a3d5
      Peter Krempa 提交于
      The new external system checkpoints will require an async job while the
      snapshot is taken. This patch adds QEMU_ASYNC_JOB_SNAPSHOT to track this
      job type.
      2a59a3d5
    • 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
  11. 02 11月, 2012 5 次提交
  12. 01 11月, 2012 2 次提交
  13. 31 10月, 2012 2 次提交
    • M
      qemu: Fix EmulatorPinInfo without emulatorpin · 10c5212b
      Martin Kletzander 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=871312
      
      Recent fixes made almost all the right steps to make emulator pinned
      to the cpuset of the whole domain in case <emulatorpin> isn't
      specified, but qemudDomainGetEmulatorPinInfo still reports all the
      CPUs even when cpuset is specified.  This patch fixes that.
      10c5212b
    • M
      Make non-KVM machines work with QMP probing · 037a49dc
      Martin Kletzander 提交于
      When there is no 'qemu-kvm' binary and the emulator used for a machine
      is, for example, 'qemu-system-x86_64' that, by default, runs without
      kvm enabled, libvirt still supplies '-no-kvm' option to this process,
      even though it does not recognize such option (making the start of a
      domain fail in that case).
      
      This patch fixes building a command-line for QEMU machines without KVM
      acceleration and is based on following assumptions:
      
       - QEMU_CAPS_KVM flag means that QEMU is running KVM accelerated
         machines by default (without explicitly requesting that using a
         command-line option).  It is the closest to the truth according to
         the code with the only exception being the comment next to the
         flag, so it's fixed in this patch as well.
      
       - QEMU_CAPS_ENABLE_KVM flag means that QEMU is, by default, running
         without KVM acceleration and in case we need KVM acceleration it
         needs to be explicitly instructed to do so.  This is partially
         true for the past (this option essentially means that QEMU
         recognizes the '-enable-kvm' option, even though it's almost the
         same).
      037a49dc
  14. 30 10月, 2012 3 次提交
  15. 29 10月, 2012 2 次提交
    • J
      xml: print uuids in the warning · 0b121614
      Ján Tomko 提交于
      In the XML warning, we print a virsh command line that can be used to
      edit that XML. This patch prints UUIDs if the entity name contains
      special characters (like shell metacharacters, or "--" that would break
      parsing of the XML comment). If the entity doesn't have a UUID, just
      print the virsh command that can be used to edit it.
      0b121614
    • J
      Revert "qemu: Do not require hostuuid in migration cookie" · 23f5e74e
      Jiri Denemark 提交于
      This reverts commit 8d75e47e.
      
      Libvirt was never released with support for migration cookies without
      hostuuid.
      23f5e74e
  16. 28 10月, 2012 1 次提交
  17. 27 10月, 2012 5 次提交
    • E
      build: typo fix for qemu cpu affinity · dd0a7040
      Eric Blake 提交于
      Introduced in commit 0039a32f.
      
      * src/qemu/qemu_process.c (qemuPrepareCpumap): s/covert/convert/
      dd0a7040
    • E
      blockjob: relabel entire existing chain · 5a3501be
      Eric Blake 提交于
      When using block copy to pivot over to a new chain, the backing files
      for the new chain might still need labeling (particularly if the user
      passes --reuse-ext with a relative backing file name).  Relabeling a
      file that is already labeled won't hurt, so this just labels the entire
      chain at the point of the pivot.  Doing the relabel of the chain uses
      the fact that we already safely probed the file type of an external
      file at the start of the block copy.
      
      * src/qemu/qemu_driver.c (qemuDomainBlockPivot): Relabel chain before
      asking qemu to pivot.
      5a3501be
    • E
      blockjob: allow mirroring under SELinux and cgroup · 35c7701c
      Eric Blake 提交于
      Use the recent addition of qemuDomainPrepareDiskChainElement to
      obtain locking manager lease, permit a block device through cgroups,
      and set the SELinux label; then audit the fact that we hand a new
      file over to qemu.  Alas, releasing the lease and label at the end
      of the mirroring is a trickier prospect (we would have to trace the
      backing chain of both source and destination, and be sure not to
      revoke rights to any part of the chain that is shared), so for now,
      virDomainBlockJobAbort still leaves things with additional access
      granted (as block-pull and block-commit have the same problem of
      not clamping access after completion, a future cleanup would cover
      all three commands).
      
      * src/qemu/qemu_driver.c (qemuDomainBlockCopy): Set up labeling.
      35c7701c
    • E
      blockjob: allow for existing files in block-copy · 8ee5073c
      Eric Blake 提交于
      Support the REUSE_EXT flag, in part by copying sanity checks from
      snapshot code.  This code introduces a case of probing an external
      file for its type; such an action would be a security risk if the
      existing file is supposed to be raw but the contents resemble some
      other format; however, since the virDomainBlockRebase API has a
      flag to force treating the file as raw rather than probe, we can
      assume that probing is safe in all other instances.  Besides, if
      we don't probe or force raw, then qemu will.
      
      * src/qemu/qemu_driver.c (qemuDomainBlockRebase): Allow REUSE_EXT
      flag.
      (qemuDomainBlockCopy): Wire up flag, and add some sanity checks.
      8ee5073c
    • E
      blockjob: implement block copy for qemu · c1eb3805
      Eric Blake 提交于
      Minimal patch to wire up all the pieces in the previous patches
      to actually enable a block copy job.  By minimal, I mean that
      qemu creates the file (that is, no REUSE_EXT flag support yet),
      SELinux must be disabled, a lock manager is not informed, and the
      audit logs aren't updated.  But those will be added as
      improvements in future patches.
      
      This patch is designed so that if we ever add a future API
      virDomainBlockCopy with more bells and whistles (such as letting
      the user specify a destination image format different than the
      source), where virDomainBlockRebase is a wrapper around the
      simpler portions of the new functionality, then the new API can
      just reuse the new qemuDomainBlockCopy function and already
      support _SHALLOW and _REUSE_EXT flags.  Also note that libvirt.c
      already filtered the new flags if _COPY is not present, so that
      we are not impacting the case of BlockRebase being a wrapper
      around BlockPull.
      
      * src/qemu/qemu_driver.c (qemuDomainBlockCopy): New function.
      (qemuDomainBlockRebase): Call it when appropriate.
      c1eb3805