1. 11 10月, 2011 1 次提交
    • E
      snapshot: implement snapshot children listing in qemu · 59074037
      Eric Blake 提交于
      Not too hard to wire up.  The trickiest part is realizing that
      listing children of a snapshot cannot use SNAPSHOT_LIST_ROOTS,
      and that we overloaded that bit to also mean SNAPSHOT_LIST_DESCENDANTS;
      we use that bit to decide which iteration to use, but don't want
      the existing counting/listing functions to see that bit.
      
      * src/conf/domain_conf.h (virDomainSnapshotObjListNumFrom)
      (virDomainSnapshotObjListGetNamesFrom): New prototypes.
      * src/conf/domain_conf.c (virDomainSnapshotObjListNumFrom)
      (virDomainSnapshotObjListGetNamesFrom): New functions.
      * src/libvirt_private.syms (domain_conf.h): Export them.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotNumChildren)
      (qemuDomainSnapshotListChildrenNames): New functions.
      59074037
  2. 09 10月, 2011 1 次提交
    • M
      qemuDomainAttach: Initialize pidfile variable · cd016a46
      Michal Privoznik 提交于
      If parsing qemu command line fails (e.g. because of non-existing
      process number supplied), we jump to cleanup label where we free
      pidfile. Therefore it needs to be initialized. Otherwise we free
      random pointer.
      cd016a46
  3. 06 10月, 2011 1 次提交
    • E
      snapshot: enforce REVERT_FORCE on qemu · 29879b55
      Eric Blake 提交于
      Implements the documentation for snapshot revert vs. force.
      
      Part of the patch tightens existing behavior (previously, reverting
      to an old snapshot without <domain> was blindly attempted, now it
      requires force), while part of it relaxes behavior (previously, it
      was not possible to revert an active domain to an ABI-incompatible
      active snapshot, now force allows this transition).
      
      * src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Check for
      risky situations, and allow force to get past them.
      29879b55
  4. 05 10月, 2011 1 次提交
    • J
      qemu: Don't fail virDomainGetInfo if we can't update balloon info · fcd2bd55
      Jiri Denemark 提交于
      Qemu driver tries to update balloon data in virDomainGetInfo and if it
      can't do so because there is another monitor job running, it just
      reports what's known in domain def. However, if there was no job running
      but getting the data from qemu fails, we would fail the whole API. This
      doesn't make sense. Let's make the failure nonfatal.
      fcd2bd55
  5. 30 9月, 2011 1 次提交
    • M
      qemu: Check for outstanding async job too · a111b9e2
      Michal Privoznik 提交于
      Currently, qemuDomainGetXMLDesc and qemudDomainGetInfo check for
      outstanding synchronous job before (eventual) monitor entering.
      However, there can be already async job set, e.g. migration.
      a111b9e2
  6. 29 9月, 2011 2 次提交
  7. 28 9月, 2011 2 次提交
  8. 22 9月, 2011 3 次提交
    • E
      snapshot: remove snapshot metadata on transient exit · e485dcc9
      Eric Blake 提交于
      Commit 282fe1f0 documented that transient domains will auto-delete
      any snapshot metadata when the last reference to the domain is
      removed, and that management apps are in charge of grabbing any
      snapshot metadata prior to that point.  However, this was not
      actually implemented for qemu until now.
      
      * src/qemu/qemu_driver.c (qemudDomainCreate)
      (qemuDomainDestroyFlags, qemuDomainSaveInternal)
      (qemudDomainCoreDump, qemuDomainRestoreFlags, qemudDomainDefine)
      (qemuDomainUndefineFlags, qemuDomainMigrateConfirm3)
      (qemuDomainRevertToSnapshot): Clean up snapshot metadata.
      * src/qemu/qemu_migration.c (qemuMigrationPrepareAny)
      (qemuMigrationPerformJob, qemuMigrationPerformPhase)
      (qemuMigrationFinish): Likewise.
      * src/qemu/qemu_process.c (qemuProcessHandleMonitorEOF)
      (qemuProcessReconnect, qemuProcessReconnectHelper)
      (qemuProcessAutoDestroyDom): Likewise.
      e485dcc9
    • E
      snapshot: prepare to remove transient snapshot metadata · bcf974b9
      Eric Blake 提交于
      This patch is mostly code motion - moving some functions out
      of qemu_driver and into qemu_domain so they can be reused by
      multiple qemu_* files (since qemu_driver.h must not grow).
      It also adds a new helper function, qemuDomainRemoveInactive,
      which will be used in the next patch.
      
      * src/qemu/qemu_domain.h (qemuFindQemuImgBinary)
      (qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
      (qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll)
      (qemuDomainRemoveInactive): New prototypes.
      (struct qemu_snap_remove): New struct.
      * src/qemu/qemu_domain.c (qemuDomainRemoveInactive)
      (qemuDomainSnapshotDiscardAllMetadata): New functions.
      (qemuFindQemuImgBinary, qemuDomainSnapshotWriteMetadata)
      (qemuDomainSnapshotForEachQcow2, qemuDomainSnapshotDiscard)
      (qemuDomainSnapshotDiscardAll): Move here...
      * src/qemu/qemu_driver.c (qemuFindQemuImgBinary)
      (qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
      (qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll): ...from
      here.
      (qemuDomainUndefineFlags): Update caller.
      * src/conf/domain_conf.c (virDomainRemoveInactive): Doc fixes.
      bcf974b9
    • E
      snapshot: fix logic bug in qemu undefine · e6966fa7
      Eric Blake 提交于
      Commit 19f8c980 introduced VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA,
      with the intent that omitting the flag makes undefine fail, and
      including the flag deletes metadata.  But it used the wrong logic.
      Also, hoist the transient domain sooner, so that we don't
      accidentally remove metadata of a transient domain.
      
      * src/qemu/qemu_driver.c (qemuDomainUndefineFlags): Check correct
      flag value.
      e6966fa7
  9. 21 9月, 2011 1 次提交
    • J
      qemu: Fix shutdown regression with buggy qemu · f84aedad
      Jiri Denemark 提交于
      The commit that prevents disk corruption on domain shutdown
      (96fc4784) causes regression with QEMU
      0.14.* and 0.15.* because of a regression bug in QEMU that was fixed
      only recently in QEMU git. The affected versions of QEMU do not quit on
      SIGTERM if started with -no-shutdown, which we use to implement fake
      reboot. Since -no-shutdown tells QEMU not to quit automatically on guest
      shutdown, domains started using the affected QEMU cannot be shutdown
      properly and stay in a paused state.
      
      This patch disables fake reboot feature on such QEMU by not using
      -no-shutdown, which makes shutdown work as expected. However,
      virDomainReboot will not work in this case and it will report "Requested
      operation is not valid: Reboot is not supported with this QEMU binary".
      f84aedad
  10. 20 9月, 2011 1 次提交
    • P
      virsh: doc: Fix supported driver types for attach-disk command · 2ad83bf4
      Peter Krempa 提交于
      Virsh man page lists driver types to be used with attach-device
      command, but does not specify that those are usable only with the XEN
      Hypervisor.
      
      This patch adds statement, that those options specified are applicable
      only on the Xen hypervisor and adds option usable with qemu emulator.
      
      This patch also changes type of error returned by QEMU driver if the
      user specifies incompatible driver type from VIR_ERR_INTERNAL_ERROR to
      VIR_ERR_CONFIG_UNSUPPORTED.
      2ad83bf4
  11. 17 9月, 2011 2 次提交
    • E
      snapshot: allow disk snapshots of qcow2 disks · 43c2641c
      Eric Blake 提交于
      For all types of disks other than qcow2, we were requesting that
      SELinux labeling visit the new file as if it were qcow2, which
      means labeling would try to find the backing files of an empty file.
      And for a pre-existing qcow2 disk, we were passing NULL, which meant
      that labelling tried to probe the file type (and if probing is
      disabled, per the default qemu.conf, this made snapshots fail).
      What we really want is to make SELinux labeling visit the new
      file as raw; it will later be converted to qcow2 if qemu successfully
      made the snapshot.
      
      * src/qemu/qemu_driver.c
      (qemuDomainSnapshotCreateSingleDiskActive): Force SELinux labeling
      to avoid probe of new file.
      43c2641c
    • E
      snapshot: affect persistent xml after disk snapshot · 2895905a
      Eric Blake 提交于
      For external snapshots to be useful on persistent domains, we must
      alter the persistent definition alongside the running definition.
      Thanks to the possibility of disk hotplug as well as of edits that
      only affect the persistent xml, we can't assume that vm->def and
      vm->newDef have the same disk at the same index, so we can only
      update the persistent copy if the device destination matches up.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive)
      (qemuDomainSnapshotCreateSingleDiskActive): Also affect newDef, if
      present.
      2895905a
  12. 16 9月, 2011 2 次提交
    • J
      qemu: Prevent disk corruption on domain shutdown · 96fc4784
      Jiri Denemark 提交于
      Ever since we introduced fake reboot, we call qemuProcessKill as a
      reaction to SHUTDOWN event. Unfortunately, qemu doesn't guarantee it
      flushed all internal buffers before sending SHUTDOWN, in which case
      killing the process forcibly may result in (virtual) disk corruption.
      
      By sending just SIGTERM without SIGKILL we give qemu time to to flush
      all buffers and exit. Once qemu exits, we will see an EOF on monitor
      connection and tear down the domain. In case qemu ignores SIGTERM or
      just hangs there, the process stays running but that's not any different
      from a possible hang anytime during the shutdown process so I think it's
      just fine.
      
      Also qemu (since 0.14 until it's fixed) has a bug in SIGTERM processing
      which causes it not to exit but instead send new SHUTDOWN event and keep
      waiting. I think the best we can do is to ignore duplicate SHUTDOWN
      events to avoid a SHUTDOWN-SIGTERM loop and leave the domain in paused
      state.
      96fc4784
    • P
      Avoid using "devname" as an identifier. · 79cf07af
      Peter Krempa 提交于
      /usr/lib/stdlib.h in Mac OS X and probably also in BSD's
      exports this symbol :(
      79cf07af
  13. 15 9月, 2011 3 次提交
  14. 13 9月, 2011 1 次提交
    • G
      snapshot: fix double free of qemuImgBinary · 011eeb41
      Guannan Ren 提交于
      Regression introduced in commit 3881a470, due to an improper rebase
      of a cleanup written beforehand but only applied after a rebased of
      a refactoring that created a new function in commit 25fb3ef1.
      
      Also avoids passing NULL to printf %s.
      
      * src/qemu/qemu_driver.c: In qemuDomainSnapshotForEachQcow2()
      it free up the memory of qemu_driver->qemuImgBinary in the
      cleanup tag which leads to the garbage value of qemuImgBinary
      in qemu_driver struct and libvirtd crash when running
      "virsh snapshot-create" command a second time.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      011eeb41
  15. 08 9月, 2011 1 次提交
  16. 06 9月, 2011 5 次提交
    • P
      link-state: qemu: Add net intf modification to virUpdateDeviceFlags · e0a07bb1
      Peter Krempa 提交于
      This patch enables modifying network device configuration using the
      virUpdateDeviceFlags API method. Matching of devices is accomplished
      using MAC addresses.
      
      While updating live configuration of a running domain, the user is
      allowed only to change link state of the interface. Additional
      modifications may be added later. For now the code checks for
      unsupported changes and thereafter changes the link state, if
      applicable.
      
      When updating persistent configuration of guest's network interface the
      whole configuration (except for the MAC address) may be modified and
      is stored for the next startup.
      
      * src/qemu/qemu_driver.c   - Add dispatching of virUpdateDevice for
                                   network devices update (live/config)
      * src/qemu/qemu_hotplug.c  - add setting of initial link state on live
                                   device addition
                                 - add function to change network device
                                   configuration. By now it supports only
                                   changing of link state
      * src/qemu/qemu_hotplug.h  - Headers to above functions
      * src/qemu/qemu_process.c  - set link states before virtual machine
                                   start. Qemu does not support setting of
                                   this on the command line.
      e0a07bb1
    • O
      latency: Implemente internal API for qemu driver · ee0d8c3b
      Osier Yang 提交于
      ee0d8c3b
    • O
      latency: Update monitor functions for new latency fields · 2f58ba89
      Osier Yang 提交于
      The mainly changes are:
      
      1) Update qemuMonitorGetBlockStatsInfo and it's children (Text/JSON)
         functions to return the value of new latency fields.
      2) Add new function qemuMonitorGetBlockStatsParamsNumber, which is
         to count how many parameters the underlying QEMU supports.
      3) Update virDomainBlockStats in src/qemu/qemu_driver.c to be
         compatible with the changes by 1).
      2f58ba89
    • M
      qemu: Deal with stucked qemu on daemon startup · d38897a5
      Michal Privoznik 提交于
      If libvirt daemon gets restarted and there is (at least) one
      unresponsive qemu, the startup procedure hangs up. This patch creates
      one thread per vm in which we try to reconnect to monitor. Therefore,
      blocking in one thread will not affect other APIs.
      d38897a5
    • M
      daemon: Create priority workers pool · 597fe3ce
      Michal Privoznik 提交于
      This patch annotates APIs with low or high priority.
      In low set MUST be all APIs which might eventually access monitor
      (and thus block indefinitely). Other APIs may be marked as high
      priority. However, some must be (e.g. domainDestroy).
      
      For high priority calls (HPC), there are some high priority workers
      (HPW) created in the pool. HPW can execute only HPC, although normal
      worker can process any call regardless priority. Therefore, only those
      APIs which are guaranteed to end in reasonable small amount of time
      can be marked as HPC.
      
      The size of this HPC pool is static, because HPC are expected to end
      quickly, therefore jobs assigned to this pool will be served quickly.
      It can be configured in libvirtd.conf via prio_workers variable.
      Default is set to 5.
      
      To mark API with low or high priority, append priority:{low|high} to
      it's comment in src/remote/remote_protocol.x. This is similar to
      autogen|skipgen. If not marked, the generator assumes low as default.
      597fe3ce
  17. 05 9月, 2011 7 次提交
    • E
      snapshot: use SELinux and lock manager with external snapshots · 63379890
      Eric Blake 提交于
      With this, it is now possible to create external snapshots even
      when SELinux is enforcing, and to protect the new file with a
      lock manager.
      
      * src/qemu/qemu_driver.c
      (qemuDomainSnapshotCreateSingleDiskActive): Create and register
      new file with proper permissions and locks.
      (qemuDomainSnapshotCreateDiskActive): Update caller.
      63379890
    • E
      snapshot: wire up live qemu disk snapshots · 9c21b441
      Eric Blake 提交于
      Lots of earlier patches led up to this point - the qemu snapshot_blkdev
      monitor command can now be controlled by libvirt!  Well, insofar as
      SELinux doesn't prevent qemu from open(O_CREAT) on the files.  There's
      still some followup work before things work with SELinux enforcing,
      but this patch is big enough to post now.
      
      There's still room for other improvements, too (for example, taking a
      disk snapshot of an inactive domain, by using qemu-img for both internal
      and external snapshots; wiring up delete and revert control, including
      additional flags from my RFC; supporting active QED disk snapshots;
      supporting per-storage-volume snapshots such as LVM or btrfs snapshots;
      etc.).  But this patch is the one that proves the new XML works!
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Wire in
      active disk snapshots.
      (qemuDomainSnapshotDiskPrepare)
      (qemuDomainSnapshotCreateDiskActive)
      (qemuDomainSnapshotCreateSingleDiskActive): New functions.
      9c21b441
    • E
      snapshot: reject unimplemented disk snapshot features · 7807e05d
      Eric Blake 提交于
      My RFC for snapshot support [1] proposes several rules for when it is
      safe to delete or revert to an external snapshot, predicated on
      the existence of new API flags.  These will be incrementally added
      in future patches, but until then, blindly mishandling a disk
      snapshot risks corrupting internal state, so it is better to
      outright reject the attempts until the other pieces are in place,
      thus incrementally relaxing the restrictions added in this patch.
      
      [1] https://www.redhat.com/archives/libvir-list/2011-August/msg00361.html
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCountExternal): New
      function.
      (qemuDomainUndefineFlags, qemuDomainSnapshotDelete): Use it to add
      safety valve.
      (qemuDomainRevertToSnapshot, qemuDomainSnapshotCreateXML): Add safety
      valve.
      7807e05d
    • E
      snapshot: add flag for requesting disk snapshot · e03a62b4
      Eric Blake 提交于
      Prior to this patch, <domainsnapshot>/<disks> was ignored.  This
      changes it to be an error unless an explicit disk snapshot is
      requested (a future patch may relax things if it turns out to
      be useful to have a <disks> specification alongside a system
      checkpoint).
      
      * include/libvirt/libvirt.h.in
      (VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY): New flag.
      * src/libvirt.c (virDomainSnapshotCreateXML): Document it.
      * src/esx/esx_driver.c (esxDomainSnapshotCreateXML): Disk
      snapshots not supported yet.
      * src/vbox/vbox_tmpl.c (vboxDomainSnapshotCreateXML): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Likewise.
      e03a62b4
    • E
      snapshot: also support disks by path · 89b6284f
      Eric Blake 提交于
      I got confused when 'virsh domblkinfo dom disk' required the
      path to a disk (which can be ambiguous, since a single file
      can back multiple disks), rather than the unambiguous target
      device name that I was using in disk snapshots.  So, in true
      developer fashion, I went for the best of both worlds - all
      interfaces that operate on a disk (aka block) now accept
      either the target name or the unambiguous path to the backing
      file used by the disk.
      
      * src/conf/domain_conf.h (virDomainDiskIndexByName): Add
      parameter.
      (virDomainDiskPathByName): New prototype.
      * src/libvirt_private.syms (domain_conf.h): Export it.
      * src/conf/domain_conf.c (virDomainDiskIndexByName): Also allow
      searching by path, and decide whether ambiguity is okay.
      (virDomainDiskPathByName): New function.
      (virDomainDiskRemoveByName, virDomainSnapshotAlignDisks): Update
      callers.
      * src/qemu/qemu_driver.c (qemudDomainBlockPeek)
      (qemuDomainAttachDeviceConfig, qemuDomainUpdateDeviceConfig)
      (qemuDomainGetBlockInfo, qemuDiskPathToAlias): Likewise.
      * src/qemu/qemu_process.c (qemuProcessFindDomainDiskByPath):
      Likewise.
      * src/libxl/libxl_driver.c (libxlDomainAttachDeviceDiskLive)
      (libxlDomainDetachDeviceDiskLive, libxlDomainAttachDeviceConfig)
      (libxlDomainUpdateDeviceConfig): Likewise.
      * src/uml/uml_driver.c (umlDomainBlockPeek): Likewise.
      * src/xen/xend_internal.c (xenDaemonDomainBlockPeek): Likewise.
      * docs/formatsnapshot.html.in: Update documentation.
      * tools/virsh.pod (domblkstat, domblkinfo): Likewise.
      * docs/schemas/domaincommon.rng (diskTarget): Tighten pattern on
      disk targets.
      * docs/schemas/domainsnapshot.rng (disksnapshot): Update to match.
      * tests/domainsnapshotxml2xmlin/disk_snapshot.xml: Update test.
      89b6284f
    • E
      snapshot: allow halting after snapshot · 6f66423e
      Eric Blake 提交于
      Since a snapshot is fully recoverable, it is useful to have a
      snapshot as a means of hibernating a guest, then reverting to
      the snapshot to wake the guest up.  This mode of usage is
      similar to 'virsh save/virsh restore', except that virsh
      save uses an external file while virsh snapshot keeps the
      vm state internal to a qcow2 file.  However, it only works on
      persistent domains.
      
      In the usage pattern of snapshot/revert for hibernating a guest,
      there is no need to keep the guest running between the two points
      in time, especially since that would generate runtime state that
      would just be discarded.  Add a flag to make it possible to
      stop the domain after the snapshot has completed.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_SNAPSHOT_CREATE_HALT):
      New flag.
      * src/libvirt.c (virDomainSnapshotCreateXML): Document it.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML)
      (qemuDomainSnapshotCreateActive): Implement it.
      6f66423e
    • E
      snapshot: introduce new deletion flag · 3d77d0a6
      Eric Blake 提交于
      Reverting to a state prior to an external snapshot risks
      corrupting any other branches in the snapshot hierarchy that
      were using the snapshot as a read-only backing file.  So
      disk snapshot code will default to preventing reverting to
      a snapshot that has any children, meaning that deleting just
      the children of a snapshot becomes a useful operation in
      preparing that snapshot for being a future reversion target.
      The code for the new flag is simple - it's one less deletion,
      plus a tweak to keep the current snapshot correct.
      
      * include/libvirt/libvirt.h.in
      (VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY): New flag.
      * src/libvirt.c (virDomainSnapshotDelete): Document it, and
      enforce mutual exclusion.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDelete): Implement
      it.
      3d77d0a6
  18. 03 9月, 2011 5 次提交
    • E
      snapshot: store qemu domain details in xml · 973fcd8f
      Eric Blake 提交于
      When reverting to a snapshot, the inactive domain configuration
      has to be rolled back to what it was at the time of the snapshot.
      Additionally, if the VM is active and the snapshot was active,
      this now adds a failure if the two configurations are ABI
      incompatible, rather than risking qemu confusion.
      
      A future patch will add a VIR_DOMAIN_SNAPSHOT_FORCE flag, which
      will be required for two risky code paths - reverting to an
      older snapshot that lacked full domain information, and reverting
      from running to a live snapshot that requires starting a new qemu
      process.  Any reverting that stops a running vm is also a form
      of data loss (discarding the current running state to go back in
      time), but as that is what reversion usually implies, it is
      probably not worth requiring a force flag.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Copy out
      domain.
      (qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot): Perform
      ABI compatibility checks.
      973fcd8f
    • E
      snapshot: allow full domain xml in snapshot · f609cb85
      Eric Blake 提交于
      Just like VM saved state images (virsh save), snapshots MUST
      track the inactive domain xml to detect any ABI incompatibilities.
      
      The indentation is not perfect, but functionality comes before form.
      
      Later patches will actually supply a full domain; for now, this
      wires up the storage to support one, but doesn't ever generate one
      in dumpxml output.
      
      Happily, libvirt.c was already rejecting use of VIR_DOMAIN_XML_SECURE
      from read-only connections, even though before this patch, there was
      no information to be secured by the use of that flag.
      
      And while we're at it, mark the libvirt snapshot metadata files
      as internal-use only.
      
      * src/libvirt.c (virDomainSnapshotGetXMLDesc): Document flag.
      * src/conf/domain_conf.h (_virDomainSnapshotDef): Add member.
      (virDomainSnapshotDefParseString, virDomainSnapshotDefFormat):
      Update signature.
      * src/conf/domain_conf.c (virDomainSnapshotDefFree): Clean up.
      (virDomainSnapshotDefParseString): Optionally parse domain.
      (virDomainSnapshotDefFormat): Output full domain.
      * src/esx/esx_driver.c (esxDomainSnapshotCreateXML)
      (esxDomainSnapshotGetXMLDesc): Update callers.
      * src/vbox/vbox_tmpl.c (vboxDomainSnapshotCreateXML)
      (vboxDomainSnapshotGetXMLDesc): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML)
      (qemuDomainSnapshotLoad, qemuDomainSnapshotGetXMLDesc)
      (qemuDomainSnapshotWriteMetadata): Likewise.
      * docs/formatsnapshot.html.in: Rework doc example.
      Based on a patch by Philipp Hahn.
      f609cb85
    • E
      snapshot: support new undefine flags in qemu · 19f8c980
      Eric Blake 提交于
      A nice benefit of deleting all snapshots at undefine time is that
      you don't have to do any reparenting or subtree identification - since
      everything goes, this is an O(n) process, whereas using multiple
      virDomainSnapshotDelete calls would be O(n^2) or worse.  But it is
      only doable for snapshot metadata, where we are in control of the
      data being deleted; for the actual snapshots, there's too much
      likelihood of something going wrong, and requiring even more API
      calls to figure out what failed in the meantime, so callers are
      better off deleting the snapshot data themselves one snapshot at
      a time where they can deal with failures as they happen.
      
      * src/qemu/qemu_driver.c (qemuDomainUndefineFlags): Honor new flags.
      19f8c980
    • E
      snapshot: cache qemu-img location · 3881a470
      Eric Blake 提交于
      As more clients start to want to know this information, doing
      a PATH stat walk and malloc for every client adds up.
      
      We are only caching the location, not the capabilities, so even
      if qemu-img is updated in the meantime, it will still probably
      live in the same location.  So there is no need to worry about
      clearing this particular cache.
      
      * src/qemu/qemu_conf.h (qemud_driver): Add member.
      * src/qemu/qemu_driver.c (qemudShutdown): Cleanup.
      (qemuFindQemuImgBinary): Add an argument, and cache result.
      (qemuDomainSnapshotForEachQcow2, qemuDomainSnapshotDiscard)
      (qemuDomainSnapshotCreateInactive, qemuDomainSnapshotRevertInactive)
      (qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot): Update
      callers.
      3881a470
    • E
      snapshot: refactor some qemu code · 8055e5af
      Eric Blake 提交于
      Prepare for code sharing.  No semantic change.
      
      * src/qemu/qemu_driver.c (qemuFindQemuImgBinary)
      (qemuDomainSnapshotWriteMetadata)
      (qemuDomainSnapshotDiscard)
      (qemuDomainSnapshotForEachQcow2): Float up.
      (qemuDomainSnapshotDiscardDescendant): Likewise, and rename...
      (qemuDomainSnapshotDiscardAll): ...for generic use.
      (qemuDomainSnapshotDelete): Update caller.
      8055e5af