1. 27 3月, 2019 1 次提交
  2. 22 3月, 2019 8 次提交
    • E
      snapshot: Make virDomainSnapshotObjList use MomentObjList · ac037904
      Eric Blake 提交于
      Now that the generic moment code does pretty much everything that both
      snapshots and checkpoints will need, it's time to replace the
      now-duplicate code in virdomainsnapshotobjlist.c with simpler calls
      into the generic code. I considered using sub-classing (a
      'virDomainMomentObjList parent;' member, but that requires making the
      opaque type visible in headers; so for now, I stuck with a container
      instead (a 'virDomainMomentObjListPtr base;' member).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      ac037904
    • E
      snapshot: Rename file for virDomainMomentObj · 5d23cd1c
      Eric Blake 提交于
      Now that we have made virDomainMomentObj sufficiently generic to
      support both snapshots and checkpoints, it is time to rename the file
      that it lives in. The split between a generic object and a list of the
      generic objects doesn't buy us as much, so it will be easier to stick
      all the moment list code in one file, with more code moving in the
      next patch.  The changes during the move are fairly minor, although it
      is worth pointing out that the log/error messages for the new file
      report that they are from "domain", since the file will eventually be
      shared by both "domain snapshot" and "domain checkpoint".
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      5d23cd1c
    • E
      snapshot: Rename virDomainSnapshotObjPtr · e055a816
      Eric Blake 提交于
      Now that the core of SnapshotObj is agnostic to snapshots and can be
      shared with upcoming checkpoint code, it is time to rename the struct
      and the functions specific to list operations. A later patch will
      shuffle which file holds the common code. This is a fairly mechanical
      patch.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      e055a816
    • E
      snapshot: Switch type of virDomainSnapshotObj.def · 1ab05da2
      Eric Blake 提交于
      Another step towards making the object list reusable for both
      snapshots and checkpoints: the list code only ever needs items that
      are in the common virDomainMomentDef base type. This undoes a lot of
      the churn in accessing common members added in the previous patch, and
      the bulk of the patch is mechanical. But there was one spot where I
      had to unroll a VIR_STEAL_PTR to work around changed types.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      1ab05da2
    • E
      snapshot: Refactor list filtering · de80cdbc
      Eric Blake 提交于
      Separate the algorithm for which list members to vist (which is
      generic and can be shared with checkpoints, provided that common
      filtering bits are either declared with the same value or have a
      mapping from public API to common value) from the decision on which
      members to return (which is specific to snapshots).  The typedef for
      the callback function feels a bit heavy here, but will make it easier
      to move the common portions in a later patch.
      
      As part of the refactoring, note that the macros for selecting filter
      bits are specific to listing functionality, so they belong better in
      virdomainsnapshotobjlist.h (missed in commit 9b75154c).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      de80cdbc
    • E
      snapshot: Access snapshot def directly when needed · 55c2ab3e
      Eric Blake 提交于
      An upcoming patch will rework virDomainSnapshotObjList to be generic
      for both snapshots and checkpoints; reduce the churn by adding a new
      accessor virDomainSnapshotObjGetDef() which returns the
      snapshot-specific definition even when the list is rewritten to
      operate only on a base class, then using it at sites that that are
      specific to snapshots.  Use VIR_STEAL_PTR when appropriate in the
      affected lines.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      55c2ab3e
    • E
      snapshot: Add accessors for updating snapshot list relations · 02c4e24d
      Eric Blake 提交于
      Rather than allowing a leaky abstraction where multiple drivers have
      to open-code operations that update the relations in a
      virDomainSnapshotObjList, it is better to add accessor functions so
      that updates to relations are maintained closer to the internals.
      This patch finishes the job started in the previous patch, by getting
      rid of all direct access to nchildren, first_child, or sibling outside
      of the lowest level functions, making it easier to refactor later on.
      
      The lone new caller to virDomainSnapshotObjListSize() checks for a
      return != 0, because it wants to handles errors (-1, only possible if
      the hash table wasn't allocated) and existing snapshots (> 0) in the
      same manner; we can drop the check for a current snapshot on the
      grounds that there shouldn't be one if there are no snapshots.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      02c4e24d
    • E
      snapshot: Track current snapshot in virDomainSnapshotObjList · 4819f54b
      Eric Blake 提交于
      It is easier to track the current snapshot as part of the list of
      snapshots. In particular, doing so lets us guarantee that the current
      snapshot is cleared if that snapshot is removed from the list (rather
      than depending on the caller to do so, and risking a use-after-free
      problem, such as the one recently patched in 1db9d0ef).  This
      requires the addition of several new accessor functions, as well as a
      useful return type for virDomainSnapshotObjListRemove().  A few error
      handling sites that were previously setting vm->current_snapshot =
      NULL can now be dropped, because the previous function call has now
      done it already.  Also, qemuDomainRevertToSnapshot() was setting the
      current vm twice, so keep only the one used on the success path.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      4819f54b
  3. 16 3月, 2019 1 次提交